From c782cacac113f3f0b7fe39add68382d82d2eca2c Mon Sep 17 00:00:00 2001 From: Federico Igne Date: Mon, 17 Aug 2020 11:29:51 +0100 Subject: Automate query evaluation in RDFoxUtil --- src/main/scala/rsacomb/RDFoxUtil.scala | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/main/scala/rsacomb/RDFoxUtil.scala') diff --git a/src/main/scala/rsacomb/RDFoxUtil.scala b/src/main/scala/rsacomb/RDFoxUtil.scala index 96710c4..9be7a2d 100644 --- a/src/main/scala/rsacomb/RDFoxUtil.scala +++ b/src/main/scala/rsacomb/RDFoxUtil.scala @@ -2,6 +2,7 @@ package rsacomb /* Java imports */ import java.util.HashMap +import tech.oxfordsemantic.jrdfox.Prefixes import tech.oxfordsemantic.jrdfox.client.{ ConnectionFactory, ServerConnection, @@ -31,6 +32,27 @@ object RDFoxUtil { (server, data) } + def query( + data: DataStoreConnection, + prefixes: Prefixes, + query: String + ): Unit = { + println(s"\n{ $query }") + val cursor = data.createCursor( + prefixes, + query, + 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(); + } + def closeConnection( server: ServerConnection, data: DataStoreConnection -- cgit v1.2.3