diff options
Diffstat (limited to 'src/main/scala/rsacomb/RDFoxUtil.scala')
| -rw-r--r-- | src/main/scala/rsacomb/RDFoxUtil.scala | 22 |
1 files changed, 22 insertions, 0 deletions
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 | |||
| 2 | 2 | ||
| 3 | /* Java imports */ | 3 | /* Java imports */ |
| 4 | import java.util.HashMap | 4 | import java.util.HashMap |
| 5 | import tech.oxfordsemantic.jrdfox.Prefixes | ||
| 5 | import tech.oxfordsemantic.jrdfox.client.{ | 6 | import tech.oxfordsemantic.jrdfox.client.{ |
| 6 | ConnectionFactory, | 7 | ConnectionFactory, |
| 7 | ServerConnection, | 8 | ServerConnection, |
| @@ -31,6 +32,27 @@ object RDFoxUtil { | |||
| 31 | (server, data) | 32 | (server, data) |
| 32 | } | 33 | } |
| 33 | 34 | ||
| 35 | def query( | ||
| 36 | data: DataStoreConnection, | ||
| 37 | prefixes: Prefixes, | ||
| 38 | query: String | ||
| 39 | ): Unit = { | ||
| 40 | println(s"\n{ $query }") | ||
| 41 | val cursor = data.createCursor( | ||
| 42 | prefixes, | ||
| 43 | query, | ||
| 44 | new HashMap[String, String]() | ||
| 45 | ); | ||
| 46 | var mul = cursor.open() | ||
| 47 | while (mul > 0) { | ||
| 48 | val res0 = cursor.getResource(0) | ||
| 49 | val res1 = cursor.getResource(1) | ||
| 50 | println(s"Answer: $res0 $res1") | ||
| 51 | mul = cursor.advance() | ||
| 52 | } | ||
| 53 | cursor.close(); | ||
| 54 | } | ||
| 55 | |||
| 34 | def closeConnection( | 56 | def closeConnection( |
| 35 | server: ServerConnection, | 57 | server: ServerConnection, |
| 36 | data: DataStoreConnection | 58 | data: DataStoreConnection |
