use of org.apache.stanbol.entityhub.test.query.FindQueryTestCase in project stanbol by apache.
the class DbpediaQueryTest method testFindLanguageQuery.
@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
//no results
test = new FindQueryTestCase("Parigi", false);
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);
}
use of org.apache.stanbol.entityhub.test.query.FindQueryTestCase in project stanbol by apache.
the class EntityhubTest method testFindLimitAndOffsetQuery.
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);
//3rd and 4th element
List<String> expected = resultList.subList(2, 4);
//all other
List<String> excluded = new ArrayList<String>();
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);
}
use of org.apache.stanbol.entityhub.test.query.FindQueryTestCase in project stanbol by apache.
the class EntityhubTest method testFindWildcards.
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);
}
use of org.apache.stanbol.entityhub.test.query.FindQueryTestCase in project stanbol by apache.
the class EntityhubTest method testFindNameQuery.
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);
}
use of org.apache.stanbol.entityhub.test.query.FindQueryTestCase in project stanbol by apache.
the class DbpediaQueryTest method testFindNameQuery.
@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", //and more
"http://dbpedia.org/resource/University_of_Paris"));
executeQuery(test);
}
Aggregations