aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/rsacomb
diff options
context:
space:
mode:
authorFederico Igne <federico.igne@cs.ox.ac.uk>2020-09-22 19:07:52 +0200
committerFederico Igne <federico.igne@cs.ox.ac.uk>2020-09-22 19:46:48 +0200
commit76287688a368174790e320ce4150f28939233216 (patch)
treebeda748ff1019324ab17c25aa94bd84dc99d9242 /src/main/scala/rsacomb
parent10a9d14545abcabae28eb344df4d28f17cceea7b (diff)
downloadRSAComb-76287688a368174790e320ce4150f28939233216.tar.gz
RSAComb-76287688a368174790e320ce4150f28939233216.zip
Fix RDFox query execution helper
Diffstat (limited to 'src/main/scala/rsacomb')
-rw-r--r--src/main/scala/rsacomb/RDFoxUtil.scala17
-rw-r--r--src/main/scala/rsacomb/RSAOntology.scala8
2 files changed, 19 insertions, 6 deletions
diff --git a/src/main/scala/rsacomb/RDFoxUtil.scala b/src/main/scala/rsacomb/RDFoxUtil.scala
index 9699fb4..d5a4dbb 100644
--- a/src/main/scala/rsacomb/RDFoxUtil.scala
+++ b/src/main/scala/rsacomb/RDFoxUtil.scala
@@ -44,9 +44,10 @@ object RDFoxUtil {
44 def submitQuery( 44 def submitQuery(
45 data: DataStoreConnection, 45 data: DataStoreConnection,
46 prefixes: Prefixes, 46 prefixes: Prefixes,
47 query: String 47 query: String,
48 answers: Int
48 ): Unit = { 49 ): Unit = {
49 println(s"\n{ $query }") 50 println(s"\nQUERY { $query }")
50 val cursor = data.createCursor( 51 val cursor = data.createCursor(
51 prefixes, 52 prefixes,
52 query, 53 query,
@@ -54,12 +55,16 @@ object RDFoxUtil {
54 ); 55 );
55 var mul = cursor.open() 56 var mul = cursor.open()
56 while (mul > 0) { 57 while (mul > 0) {
57 val res0 = cursor.getResource(0) 58 print("Answer: ")
58 val res1 = cursor.getResource(1) 59 for (i <- 0 until answers) {
59 println(s"Answer: $res0 $res1") 60 val res = cursor.getResource(i)
61 print(s"$res ")
62 }
63 println()
60 mul = cursor.advance() 64 mul = cursor.advance()
61 } 65 }
62 cursor.close(); 66 cursor.close();
67 println(s"QUERY END")
63 } 68 }
64 69
65 def closeConnection( 70 def closeConnection(
@@ -70,4 +75,4 @@ object RDFoxUtil {
70 data.close(); 75 data.close();
71 } 76 }
72 77
73} // object RDFox 78} // object RDFoxUtil
diff --git a/src/main/scala/rsacomb/RSAOntology.scala b/src/main/scala/rsacomb/RSAOntology.scala
index 30ebd3a..309106a 100644
--- a/src/main/scala/rsacomb/RSAOntology.scala
+++ b/src/main/scala/rsacomb/RSAOntology.scala
@@ -92,6 +92,14 @@ trait RSAOntology {
92 "<http://127.0.0.1/E>[?X,?Y] :- <http://127.0.0.1/PE>[?X,?Y], <http://127.0.0.1/U>[?X], <http://127.0.0.1/U>[?Y] ." 92 "<http://127.0.0.1/E>[?X,?Y] :- <http://127.0.0.1/PE>[?X,?Y], <http://127.0.0.1/U>[?X], <http://127.0.0.1/U>[?Y] ."
93 ) 93 )
94 94
95 /* Add built-in rules
96 */
97 // data.importData(
98 // UpdateType.ADDITION,
99 // RSA.Prefixes,
100 // "[?entity, a, ?superClass] :- [?entity, a, ?class], [?class, rdfs:subClassOf, ?superClass] ."
101 // )
102
95 /* Add ontology rules 103 /* Add ontology rules
96 */ 104 */
97 data.addRules(datalog.asJava) 105 data.addRules(datalog.asJava)