// with the OPTION(TRANSITIVE) above, Jena triggers syntax error here:
// Query sparql = QueryFactory.create(queryString);
// but passing the string directly to Virtuoso is fine:
VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create(
// sparql,
queryString,
_graph);
// and the result includes the inferred triples:
// RESULT:
// http://example.org/vocres/BBB
// http://example.org/vocres/CCC
// http://example.org/vocres/DDD
ResultSet results = vqe.execSelect();
System.out.println("RESULT:");
while (results.hasNext()) {
QuerySolution result = results.nextSolution();
RDFNode o = result.get("o");
System.out.println(" "+ o );
}
vqe.close();
_graph.close();
}