I am using Virtuoso Jena Provider to query my graph which is uploaded on Virtuoso but I also want to add reasoning in my queries.
I have tried this code but I get an error on the .execSelect();
line
Exception in thread "main" java.lang.NullPointerException
at mypackage.Main.main(Main.java:49)
Here is the code I have tried so far.
VirtGraph vg = new VirtGraph(graph, url, username, password);
VirtModel model = new VirtModel(vg);
InfModel ont = ModelFactory.createInfModel(ReasonerRegistry.getOWLReasoner(), model);
Query sparql = QueryFactory.create("PREFIX sosa: <http://www.w3.org/ns/sosa/>\r\n" +
"PREFIX ex: <http://example.org/data/>\r\n" +
"SELECT ?s ?o FROM <http://147.27.60.65/sensorOntology> WHERE {?s sosa:isHostedBy ?o}");
QueryExecution vqe = VirtuosoQueryExecutionFactory.create(sparql, ont);
ResultSet results = vqe.execSelect();
What is the correct way to add a reasoner to my graph and how can I query the resulting set?
These are the versions I am using: Jena: 3.1 JDBC: 4 Virtuoso: 6
EDIT I installed Pellet reasoner from https://github.com/stardog-union/pellet but I can correctly infer only the .owl file stored on my pc and loaded on Jena but I still cannot infer the same file uploaded as a virtuoso graph.