From 4df0005e2b56a8d37ce449774aea2ab8c2808bcb Mon Sep 17 00:00:00 2001 From: Federico Igne Date: Sun, 16 Aug 2020 17:09:24 +0100 Subject: Add code to access query answers programmatically --- src/main/scala/rsacomb/RSAOntology.scala | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/main/scala/rsacomb/RSAOntology.scala b/src/main/scala/rsacomb/RSAOntology.scala index 06752ef..8303dd4 100644 --- a/src/main/scala/rsacomb/RSAOntology.scala +++ b/src/main/scala/rsacomb/RSAOntology.scala @@ -112,21 +112,19 @@ trait RSAOntology { // Retrieve all instances of PE println("\nQuery results:") - data.evaluateQuery( + val cursor = data.createCursor( prefixes, "SELECT ?X ?Y WHERE { ?X ?Y }", - new HashMap[String, String](), - System.out, - "text/csv" - ); - - data.evaluateQuery( - prefixes, - "SELECT ?X ?Y WHERE { ?X ?Y }", - new HashMap[String, String](), - System.out, - "text/csv" + new HashMap[String, String]() ); + var mul = cursor.open() + while (mul > 0) { + val res0 = cursor.getResource(0) + val res1 = cursor.getResource(1) + println(s"Answer: $res0 $res1") + mul = cursor.advance() + } + cursor.close(); // Close connection to RDFox RDFoxUtil.closeConnection(server, data) -- cgit v1.2.3