Package org.apache.stanbol.entityhub.test.query

Examples of org.apache.stanbol.entityhub.test.query.FieldQueryTestCase


     */
    @Test
    public void testSimilaritySearch() throws IOException, JSONException {
       
        //searches Places with "Wolfgang Amadeus Mozart" as context
        FieldQueryTestCase test = new FieldQueryTestCase(
            "{ "+
                "'selected': ["+
                    "'http:\\/\\/www.w3.org\\/2000\\/01\\/rdf-schema#label'],"+
                "'offset': '0',"+
                "'limit': '5',"+
View Full Code Here


       
    }
    @Test
    public void testBoostAndProximityRanking() throws IOException, JSONException {
            //test features added with STANBOL-1105, STANBOL-1106
            FieldQueryTestCase test = new FieldQueryTestCase(
                "{ "+
                    "'selected': ["+
                        "'http:\\/\\/www.w3.org\\/2000\\/01\\/rdf-schema#label'],"+
                    "'offset': '0',"+
                    "'limit': '10',"+
View Full Code Here

        //default dataset :(
    }
   
    @Test
    public void testFieldQueryRangeConstraints() throws IOException, JSONException {
        FieldQueryTestCase test = new FieldQueryTestCase(
            "{ "+
                "'selected': ["+
                    "'http:\\/\\/www.w3.org\\/2000\\/01\\/rdf-schema#label',"+
                    "'http:\\/\\/www.w3.org\\/1999\\/02\\/22-rdf-syntax-ns#type',"+
                    "'http:\\/\\/dbpedia.org\\/ontology\\/birthDate',"+
                    "'http:\\/\\/dbpedia.org\\/ontology\\/deathDate'],"+
                "'offset': '0',"+
                "'limit': '3',"+
                "'constraints': [{ "+
                    "'type': 'range', "+
                    "'field': 'http:\\/\\/dbpedia.org\\/ontology\\/birthDate', "+
                    "'lowerBound': '1946-01-01T00:00:00.000Z',"+
                    "'upperBound': '1946-12-31T23:59:59.999Z',"+
                    "'inclusive': true,"+
                    "'datatype': 'xsd:dateTime'"+
                "},{ "+
                    "'type': 'reference', "+
                    "'field': 'http:\\/\\/www.w3.org\\/1999\\/02\\/22-rdf-syntax-ns#type', "+
                    "'value': 'http:\\/\\/dbpedia.org\\/ontology\\/Person', "+
                "}]"+
             "}",
             Arrays.asList( //list of expected results
                 "http://dbpedia.org/resource/Bill_Clinton",
                 "http://dbpedia.org/resource/George_W._Bush",
                 "http://dbpedia.org/resource/Donald_Trump"),
             Arrays.asList( //list of required fields for results
                "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
                "http://www.w3.org/2000/01/rdf-schema#label",
                "http://dbpedia.org/ontology/birthDate"));
        //now execute the test
        executeQuery(test);
       
        //cities with more than 1 million inhabitants and an altitude over
        //1000 meter
        test = new FieldQueryTestCase(
            "{"+
                "'selected': ["+
                    "'http:\\/\\/www.w3.org\\/2000\\/01\\/rdf-schema#label',"+
                    "'http:\\/\\/dbpedia.org\\/ontology\\/populationTotal',"+
                    "'http:\\/\\/www.w3.org\\/2003\\/01\\/geo\\/wgs84_pos#alt'],"+
View Full Code Here

        executeQuery(test);
    }
   
    @Test
    public void testFieldQueryTextConstraints() throws IOException, JSONException {
        FieldQueryTestCase test = new FieldQueryTestCase(
            "{ "+
                "'selected': ["+
                    "'http:\\/\\/www.w3.org\\/2000\\/01\\/rdf-schema#label'],"+
                "'offset': '0',"+
                "'limit': '3',"+
                "'constraints': [{ "+
                    "'type': 'text', "+
                    "'language': 'de', "+
                    "'patternType': 'wildcard', "+
                    "'text': 'Frankf*', "+
                    "'field': 'http:\\/\\/www.w3.org\\/2000\\/01\\/rdf-schema#label' "+
                "}]"+
             "}",
             Arrays.asList( //list of expected results
                 "http://dbpedia.org/resource/Frankfurt",
                 "http://dbpedia.org/resource/Eintracht_Frankfurt",
                 "http://dbpedia.org/resource/Frankfort,_Kentucky"),
             Arrays.asList( //list of required fields for results
                "http://www.w3.org/2000/01/rdf-schema#label"));
        //now execute the test
        executeQuery(test)

        test = new FieldQueryTestCase(
            "{ "+
                "'selected': ["+
                    "'http:\\/\\/www.w3.org\\/2000\\/01\\/rdf-schema#label'],"+
                "'offset': '0',"+
                "'limit': '3',"+
View Full Code Here

        //now execute the test
        executeQuery(test)
    }
    @Test
    public void testFieldQueryValueConstraints() throws IOException, JSONException {
        FieldQueryTestCase test = new FieldQueryTestCase(
            "{ "+
                "'selected': ["+
                    "'http:\\/\\/www.w3.org\\/2000\\/01\\/rdf-schema#label'],"+
                "'offset': '0',"+
                "'limit': '3',"+
                "'constraints': [{ "+
                    "'type': 'value',"+
                    "'value': '34',"+
                    "'field': 'http:\\/\\/www.w3.org\\/2003\\/01\\/geo\\/wgs84_pos#alt',"+
                    "'datatype': 'xsd:int'"+
                    "}]"+
             "}",
             Arrays.asList( //list of expected results
                 "http://dbpedia.org/resource/Berlin",
                 "http://dbpedia.org/resource/Baghdad",
                 "http://dbpedia.org/resource/Orlando,_Florida"),
             Arrays.asList( //list of required fields for results
                "http://www.w3.org/2000/01/rdf-schema#label"));
        //now execute the test
        executeQuery(test);
       
        // now the same query but with no datatype
        test = new FieldQueryTestCase(
            "{ "+
                "'selected': ["+
                    "'http:\\/\\/www.w3.org\\/2000\\/01\\/rdf-schema#label'],"+
                "'offset': '0',"+
                "'limit': '3',"+
                "'constraints': [{ "+
                    "'type': 'value',"+
                    "'value': '34',"+ //NOTE this is a JSON String!
                    "'field': 'http:\\/\\/www.w3.org\\/2003\\/01\\/geo\\/wgs84_pos#alt',"+
                    "}]"+
             "}",
             false); //we expect no results, because the datatype should be xsd:string

        //a third time the same query (without a datatype), but now we parse a
        //JSON number as value
        test = new FieldQueryTestCase(
            "{ "+
                "'selected': ["+
                    "'http:\\/\\/www.w3.org\\/2000\\/01\\/rdf-schema#label'],"+
                "'offset': '0',"+
                "'limit': '3',"+
View Full Code Here

TOP

Related Classes of org.apache.stanbol.entityhub.test.query.FieldQueryTestCase

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.