Examples of FindQueryTestCase


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

        re.assertStatus(200);

    }
   
    private void testFindNameQuery() throws IOException, JSONException {
        FindQueryTestCase test = new FindQueryTestCase("Apache Stanbol",
            Arrays.asList(
                "http://stanbol.apache.org"));//,
                //"http://dbpedia.org/resource/Paris_Hilton"));
        test.setField("http://usefulinc.com/ns/doap#name");
        test.setLanguage(null);
        executeQuery(test);
    }
View Full Code Here

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

        test.setField("http://usefulinc.com/ns/doap#name");
        test.setLanguage(null);
        executeQuery(test);
    }
    private void testFindWildcards() throws IOException, JSONException {
        FindQueryTestCase test = new FindQueryTestCase("Hiv*",
            Arrays.asList(
                "http://hive.apache.org",
                "http://jakarta.apache.org/hivemind/"),
            Arrays.asList(
                "http://beehive.apache.org"));
        test.setField("http://usefulinc.com/ns/doap#name");
        test.setLanguage(null);
        executeQuery(test);
    }
View Full Code Here

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

    }

    private void testFindLimitAndOffsetQuery() throws IOException, JSONException {
      //With Solr4 we need a test that produces different scores for results,
      //to ensure consistant odering
        FindQueryTestCase test = new FindQueryTestCase("XML XSL*",
            Arrays.asList(
                    "http://velocity.apache.org/anakia/",
                    "http://xalan.apache.org/xalan-c/",
                    "http://xalan.apache.org/xalan-j/",
                    "http://velocity.apache.org/dvsl/devel/",
                    "http://xmlgraphics.apache.org/commons/",
                    "http://xmlgraphics.apache.org/fop"),
            null);
        test.setField("http://usefulinc.com/ns/doap#description");
        test.setLimit(10);
        test.setLanguage(null);
        RequestExecutor re = executeQuery(test);
        //get the list of results (will assert the response twice)
        //to check the expected limit and offset results
        List<String> resultList = assertQueryResults(re,test);
        List<String> expected = resultList.subList(2, 4); //3rd and 4th element
        List<String> excluded = new ArrayList<String>(); //all other
        excluded.addAll(resultList.subList(0, 2));
        excluded.addAll(resultList.subList(4, resultList.size()));
        //repeat the test with offset 2 and limit 2 to only retrieve the 3-4 result
        test = new FindQueryTestCase("XML XSL*", expected, excluded);
        test.setField("http://usefulinc.com/ns/doap#description");
        test.setOffset(2);
        test.setLimit(2);
        test.setLanguage(null);
        executeQuery(test);
       
    }
View Full Code Here

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

    public DbpediaQueryTest(String path,String referencedSite) {
        super(path,referencedSite);
    }
    @Test
    public void testFindNameQuery() throws IOException, JSONException {
        FindQueryTestCase test = new FindQueryTestCase("Paris",
            Arrays.asList(
                "http://dbpedia.org/resource/Paris",
                "http://dbpedia.org/resource/Paris_Hilton",
                "http://dbpedia.org/resource/University_of_Paris")); //and more
        executeQuery(test);
View Full Code Here

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

        // Paris: 16.905037
        // University_of_Paris: 10.565648
        // Paris_Hilton, Salon_(Paris), Paris_M%C3%A9tro, Paris_Opera,
        //    Paris_Saint-Germain_F.C., Paris_Commune, Paris_Masters: 8.452518
        //only the first result
        FindQueryTestCase test = new FindQueryTestCase("Paris",
            Arrays.asList(
                "http://dbpedia.org/resource/Paris"),
            Arrays.asList(
                "http://dbpedia.org/resource/University_of_Paris",
                "http://dbpedia.org/resource/Paris_Hilton",
                "http://dbpedia.org/resource/Paris_Saint-Germain_F.C."));
        test.setLanguage("en");
        test.setLimit(1);
        executeQuery(test);
        //the second result
        test = new FindQueryTestCase("Paris",
            Arrays.asList(
                "http://dbpedia.org/resource/University_of_Paris"),
            Arrays.asList(
                "http://dbpedia.org/resource/Paris",
                "http://dbpedia.org/resource/Paris_Hilton",
                "http://dbpedia.org/resource/Paris_Saint-Germain_F.C."));
        test.setLanguage("en");
        test.setLimit(1);
        test.setOffset(1);
        executeQuery(test);
        //the second and third
        test = new FindQueryTestCase("Paris",
            Arrays.asList(
                "http://dbpedia.org/resource/Paris_Saint-Germain_F.C.",
                "http://dbpedia.org/resource/Paris_Hilton"),
            Arrays.asList(
                "http://dbpedia.org/resource/University_of_Paris",
                "http://dbpedia.org/resource/Paris"));
        test.setLanguage("en");
        test.setLimit(10);
        test.setOffset(2);
        executeQuery(test);
    }
View Full Code Here

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

        test.setOffset(2);
        executeQuery(test);
    }
    @Test
    public void testFindLanguageQuery() throws IOException, JSONException {
        FindQueryTestCase test = new FindQueryTestCase("Parigi",
            Arrays.asList(
                "http://dbpedia.org/resource/Paris",
                "http://dbpedia.org/resource/University_of_Paris",
                "http://dbpedia.org/resource/Paris_M%C3%A9tro",
                "http://dbpedia.org/resource/Paris_Commune",
                "http://dbpedia.org/resource/Paris-Charles_de_Gaulle_Airport"));
        test.setLimit(10);
        executeQuery(test);

        //now the same test but only in English labels
        test = new FindQueryTestCase("Parigi",false); //no results
        test.setLanguage("en");
        test.setLimit(3);
        executeQuery(test);
       
        //now in Italian (expects the same as the query with no language constriants
        test = new FindQueryTestCase("Parigi",
            Arrays.asList(
                "http://dbpedia.org/resource/Paris",
                "http://dbpedia.org/resource/University_of_Paris",
                "http://dbpedia.org/resource/Paris_M%C3%A9tro",
                "http://dbpedia.org/resource/Paris_Peace_Conference,_1919",
                "http://dbpedia.org/resource/Paris-Charles_de_Gaulle_Airport"));
        test.setLanguage("it");
        test.setLimit(10);
        executeQuery(test);

        //now search for Paris in Italian labels
        test = new FindQueryTestCase("Paris",
            Arrays.asList(
                "http://dbpedia.org/resource/Paris_Hilton",
                "http://dbpedia.org/resource/Paris_Saint-Germain_F.C.",
                "http://dbpedia.org/resource/Paris_Opera",
                "http://dbpedia.org/resource/Stade_Fran%C3%A7ais",
                "http://dbpedia.org/resource/Institut_d'%C3%89tudes_Politiques_de_Paris"),
            Arrays.asList(
                "http://dbpedia.org/resource/Paris",
                "http://dbpedia.org/resource/University_of_Paris",
                "http://dbpedia.org/resource/Paris_M%C3%A9tro",
                "http://dbpedia.org/resource/Paris_Peace_Conference,_1919",
                "http://dbpedia.org/resource/Paris-Charles_de_Gaulle_Airport"));
        test.setLanguage("it");
        test.setLimit(10);
        executeQuery(test);
    }
View Full Code Here

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

        executeQuery(test);
    }
    @Test
    public void testFindWildcards() throws IOException, JSONException {
        //first a search without wildcards
        FindQueryTestCase test = new FindQueryTestCase("cia",
            Arrays.asList(
                "http://dbpedia.org/resource/Central_Intelligence_Agency",
                "http://dbpedia.org/resource/The_World_Factbook"),
            Arrays.asList(
                "http://dbpedia.org/resource/Ciara"));
        test.setField("http://dbpedia.org/ontology/surfaceForm");
        test.setLanguage("en");
        test.setLimit(5); //there are a lot of those
        executeQuery(test);
        //now the same search with wildcards
        test = new FindQueryTestCase("cia*",
            Arrays.asList(
                "http://dbpedia.org/resource/Central_Intelligence_Agency",
                "http://dbpedia.org/resource/County_Kerry", //Ciarraí (county)
                "http://dbpedia.org/resource/Vitamin_C", //Ciamin
                "http://dbpedia.org/resource/Ciara",
                "http://dbpedia.org/resource/The_World_Factbook")); //CIA World Factbook
        test.setField("http://dbpedia.org/ontology/surfaceForm");
        test.setLanguage("en");
        test.setLimit(10); //there are a lot of those
        executeQuery(test);
       
        test = new FindQueryTestCase("proto*",
            Arrays.asList(
                "http://dbpedia.org/resource/Prototype",
                "http://dbpedia.org/resource/Proton",
                "http://dbpedia.org/resource/Hypertext_Transfer_Protocol",
                "http://dbpedia.org/resource/File_Transfer_Protocol"),
            Arrays.asList(
                "http://dbpedia.org/resource/Pretoria"));
        test.setLanguage("en");
        test.setLimit(100); //there a a lot of those
        executeQuery(test);
        //now the same search with wildcards
        test = new FindQueryTestCase("pr?to*",
            Arrays.asList(
                "http://dbpedia.org/resource/Pretoria",
                "http://dbpedia.org/resource/Prototype",
                "http://dbpedia.org/resource/Proton",
                "http://dbpedia.org/resource/Program_and_System_Information_Protocol",
                "http://dbpedia.org/resource/Hypertext_Transfer_Protocol"));
        test.setLanguage("en");
        test.setLimit(100); //there a a lot of those
        executeQuery(test);
    }
View Full Code Here

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

    public DbpediaQueryTest(String path,String referencedSite) {
        super(path,referencedSite);
    }
    @Test
    public void testFindNameQuery() throws IOException, JSONException {
        FindQueryTestCase test = new FindQueryTestCase("Paris",
            Arrays.asList(
                "http://dbpedia.org/resource/Paris",
                "http://dbpedia.org/resource/Paris_Saint-Germain_F.C.",
                "http://dbpedia.org/resource/University_of_Paris"));//,
                //"http://dbpedia.org/resource/Paris_Hilton"));
View Full Code Here

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

        executeQuery(test);
    }
    @Test
    public void testFindLimitAndOffsetQuery() throws IOException, JSONException {
        //only the first result
        FindQueryTestCase test = new FindQueryTestCase("Paris",
            Arrays.asList(
                "http://dbpedia.org/resource/Paris"),
            Arrays.asList(
                "http://dbpedia.org/resource/Paris_Saint-Germain_F.C.",
                "http://dbpedia.org/resource/University_of_Paris",
                "http://dbpedia.org/resource/Paris_Hilton"));
        test.setLimit(1);
        executeQuery(test);
        //the second result
        test = new FindQueryTestCase("Paris",
            Arrays.asList(
                "http://dbpedia.org/resource/Paris_Saint-Germain_F.C.",
                "http://dbpedia.org/resource/University_of_Paris"),
            Arrays.asList(
                "http://dbpedia.org/resource/Paris",
                "http://dbpedia.org/resource/Paris_Hilton"));
        test.setLimit(2);
        test.setOffset(1);
        executeQuery(test);
        //the second and third
        test = new FindQueryTestCase("Paris",
            Arrays.asList(
                "http://dbpedia.org/resource/University_of_Paris",
                "http://dbpedia.org/resource/Paris_Hilton"),
            Arrays.asList(
                "http://dbpedia.org/resource/Paris_Saint-Germain_F.C.",
                "http://dbpedia.org/resource/Paris"));
        test.setLimit(2);
        test.setOffset(2);
        executeQuery(test);
    }
View Full Code Here

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

        test.setOffset(2);
        executeQuery(test);
    }
    @Test
    public void testFindLanguageQuery() throws IOException, JSONException {
        FindQueryTestCase test = new FindQueryTestCase("Parigi",
            Arrays.asList(
                "http://dbpedia.org/resource/Paris",
                "http://dbpedia.org/resource/University_of_Paris",
                "http://dbpedia.org/resource/Paris_M%C3%A9tro"));
        executeQuery(test);

        //now the same test but only in English labels
        test = new FindQueryTestCase("Parigi",false); //no results
        test.setLanguage("en");
        executeQuery(test);
       
        //now in Italian
        test = new FindQueryTestCase("Parigi",
            Arrays.asList(
                "http://dbpedia.org/resource/Paris",
                "http://dbpedia.org/resource/University_of_Paris",
                "http://dbpedia.org/resource/Paris%E2%80%93Roubaix",
                "http://dbpedia.org/resource/Dakar_Rally"));
        test.setLanguage("it");
        executeQuery(test);

        //now search for Paris in Italian labels
        test = new FindQueryTestCase("Paris",
            Arrays.asList(
                "http://dbpedia.org/resource/Paris_Hilton",
                "http://dbpedia.org/resource/Paris%E2%80%93Nice",
                "http://dbpedia.org/resource/Paris,_Texas"));
        test.setLanguage("it");
        executeQuery(test);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.