use of org.apache.stanbol.commons.owl.RunSingleSPARQL in project stanbol by apache.
the class RunSingleSPARQLTest method testCreateSPARQLQueryExecutionFactory.
/**
* Test of testCreateSPARQLQueryExecutionFactory() method, of class RunSingleSPARQL.
*/
@Test
public void testCreateSPARQLQueryExecutionFactory() {
Map<String, String> map = new HashMap<String, String>();
map.put("rdfs", "<http://www.w3.org/2000/01/rdf-schema#>");
map.put("xsd", "<http://www.w3.org/2000/01/rdf-schema#>");
map.put("owl", "<http://www.w3.org/2000/01/rdf-schema#>");
map.put("rdf", "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>");
map.put("ex", "<http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#>");
String query = "SELECT * WHERE {?p rdf:type ex:Person .}";
RunSingleSPARQL instance = new RunSingleSPARQL(owl, map);
QueryExecution queryExecution = instance.createSPARQLQueryExecutionFactory(query);
if (queryExecution == null) {
fail("Some errors occurred in createSPARQLQueryExecutionFactory of KReSRunSPARQL");
}
ResultSet result = queryExecution.execSelect();
if (result != null) {
int m = 0;
while (result.hasNext()) {
result.next();
m++;
}
queryExecution.close();
assertEquals(3, m);
// TODO review the generated test code and remove the default call to fail.
} else {
fail("Some errors occur in createSPARQLQueryExecutionFactory of KReSRunSPARQL");
}
}
use of org.apache.stanbol.commons.owl.RunSingleSPARQL in project stanbol by apache.
the class RunSingleSPARQLTest method testRemoveSPARQLprefix.
/**
* Test of removeSPARQLprefix method, of class RunSingleSPARQL.
*/
@Test
public void testRemoveSPARQLprefix() {
Map<String, String> map = new HashMap<String, String>();
map.put("rdfs", "<http://www.w3.org/2000/01/rdf-schema#>");
map.put("xsd", "<http://www.w3.org/2000/01/rdf-schema#>");
map.put("owl", "<http://www.w3.org/2000/01/rdf-schema#>");
map.put("rdf", "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>");
map.put("ex", "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>");
RunSingleSPARQL instance = new RunSingleSPARQL(owl, map);
boolean result = instance.removeSPARQLprefix("ex");
if (result) {
Map<String, String> mymap = instance.getSPARQLprefix();
assertEquals(false, mymap.containsKey("ex"));
// TODO review the generated test code and remove the default call to fail.
} else {
fail("Some errors occur in removeSPARQLprefix of KReSRunSPARQL.");
}
}
use of org.apache.stanbol.commons.owl.RunSingleSPARQL in project stanbol by apache.
the class RunSingleSPARQLTest method testGetSPARQLprefix.
/**
* Test of getSPARQLprefix method, of class RunSingleSPARQL.
*/
@Test
public void testGetSPARQLprefix() {
Map<String, String> map = new HashMap<String, String>();
map.put("rdfs", "<http://www.w3.org/2000/01/rdf-schema#>");
map.put("xsd", "<http://www.w3.org/2000/01/rdf-schema#>");
map.put("owl", "<http://www.w3.org/2000/01/rdf-schema#>");
map.put("rdf", "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>");
map.put("ex", "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>");
RunSingleSPARQL instance = new RunSingleSPARQL(owl, map);
Map<String, String> expResult = map;
Map<String, String> result = instance.getSPARQLprefix();
if (!result.isEmpty()) {
assertEquals(expResult, result);
} else {
// TODO review the generated test code and remove the default call to fail.
fail("Some errors occur in getSPARQLprefix of KReSRunSPARQL.");
}
}
use of org.apache.stanbol.commons.owl.RunSingleSPARQL in project stanbol by apache.
the class RunSingleSPARQLTest method testAddSPARQLprefix.
/**
* Test of addSPARQLprefix method, of class RunSingleSPARQL.
*/
@Test
public void testAddSPARQLprefix() {
String label = "mylabel";
String prefix = "<http://prova.mylabel.org#>";
Map<String, String> map = new HashMap<String, String>();
map.put("rdfs", "http://www.w3.org/2000/01/rdf-schema#");
map.put("xsd", "<http://www.w3.org/2000/01/rdf-schema#>");
map.put("owl", "<http://www.w3.org/2000/01/rdf-schema#>");
map.put("rdf", "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>");
map.put("ex", "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>");
RunSingleSPARQL instance = new RunSingleSPARQL(owl, map);
boolean result = instance.addSPARQLprefix(label, prefix);
if (result) {
Map<String, String> mymap = instance.getSPARQLprefix();
assertEquals(prefix, mymap.get(label));
// TODO review the generated test code and remove the default call to fail.
} else {
fail("Some errors occur in addSPARQLprefix of KReSRunSPARQL.");
}
}
Aggregations