aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/uk/ac/ox
diff options
context:
space:
mode:
authorFederico Igne <federico.igne@cs.ox.ac.uk>2020-12-02 18:47:49 +0000
committerFederico Igne <federico.igne@cs.ox.ac.uk>2020-12-02 18:47:49 +0000
commit91de03f187f298004d90708c5815e86134b10eae (patch)
tree6b027414dba598859c5f27740e7a30799308b38e /src/main/scala/uk/ac/ox
parentbb2fe6440ea4f7e7aeca037c4a4351a28aac3a9f (diff)
downloadRSAComb-91de03f187f298004d90708c5815e86134b10eae.tar.gz
RSAComb-91de03f187f298004d90708c5815e86134b10eae.zip
Make filtering program generate/load facts as facts
Diffstat (limited to 'src/main/scala/uk/ac/ox')
-rw-r--r--src/main/scala/uk/ac/ox/cs/rsacomb/FilteringProgram.scala20
-rw-r--r--src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala4
2 files changed, 13 insertions, 11 deletions
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/FilteringProgram.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/FilteringProgram.scala
index 52be937..4e533c6 100644
--- a/src/main/scala/uk/ac/ox/cs/rsacomb/FilteringProgram.scala
+++ b/src/main/scala/uk/ac/ox/cs/rsacomb/FilteringProgram.scala
@@ -76,6 +76,15 @@ class FilteringProgram(query: ConjunctiveQuery, constants: List[Term]) {
76 val nis: Rule = 76 val nis: Rule =
77 Rule.create(RSA.NI(varX), RSA.Congruent(varX, varY), RSA.Named(varY)) 77 Rule.create(RSA.NI(varX), RSA.Congruent(varX, varY), RSA.Named(varY))
78 78
79 /** Initializes instances of `rsa:Named`.
80 *
81 * They represent the set of constants appearing in the original
82 * ontology.
83 *
84 * @note corresponds to rules 2 in Table 3.
85 */
86 val facts = constants map RSA.Named
87
79 /** Collection of filtering program rules. */ 88 /** Collection of filtering program rules. */
80 val rules: List[Rule] = 89 val rules: List[Rule] =
81 nis :: { 90 nis :: {
@@ -89,15 +98,6 @@ class FilteringProgram(query: ConjunctiveQuery, constants: List[Term]) {
89 */ 98 */
90 val r1 = Rule.create(RSA.QM, query.atoms: _*) 99 val r1 = Rule.create(RSA.QM, query.atoms: _*)
91 100
92 /** Initializes instances of `rsa:Named`.
93 *
94 * They represent the set of constants appearing in the original
95 * ontology.
96 *
97 * @note corresponds to rules 2 in Table 3.
98 */
99 val r2 = constants.map(c => Rule.create(RSA.Named(c)))
100
101 /** Initializes instances of `rsa:ID`. 101 /** Initializes instances of `rsa:ID`.
102 * 102 *
103 * They are initialized as a minimal congruence relation over the 103 * They are initialized as a minimal congruence relation over the
@@ -307,7 +307,7 @@ class FilteringProgram(query: ConjunctiveQuery, constants: List[Term]) {
307 */ 307 */
308 val r9 = Rule.create(RSA.Ans, RSA.QM, not(RSA.SP)) 308 val r9 = Rule.create(RSA.Ans, RSA.QM, not(RSA.SP))
309 309
310 (r1 :: r2 ::: 310 (r1 ::
311 r3a ::: r3b :: r3c :: 311 r3a ::: r3b :: r3c ::
312 r4a ::: r4b ::: r4c ::: 312 r4a ::: r4b ::: r4c :::
313 r5a ::: r5b ::: r5c ::: 313 r5a ::: r5b ::: r5c :::
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala
index f90e3c1..a965ef9 100644
--- a/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala
+++ b/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala
@@ -327,9 +327,11 @@ class RSAOntology(val ontology: OWLOntology) {
327 def ask(query: ConjunctiveQuery): ConjunctiveQueryAnswers = { 327 def ask(query: ConjunctiveQuery): ConjunctiveQueryAnswers = {
328 import implicits.JavaCollections._ 328 import implicits.JavaCollections._
329 val (server, data) = RDFoxUtil.openConnection(RSAOntology.DataStore) 329 val (server, data) = RDFoxUtil.openConnection(RSAOntology.DataStore)
330 val filter = this.filteringProgram(query)
330 RDFoxUtil.addRules(data, this.canonicalModel.rules) 331 RDFoxUtil.addRules(data, this.canonicalModel.rules)
331 RDFoxUtil.addFacts(data, this.canonicalModel.facts) 332 RDFoxUtil.addFacts(data, this.canonicalModel.facts)
332 data.addRules(this.filteringProgram(query).rules) 333 RDFoxUtil.addRules(data, filter.rules)
334 RDFoxUtil.addFacts(data, filter.facts)
333 val answers = RDFoxUtil 335 val answers = RDFoxUtil
334 .submitQuery( 336 .submitQuery(
335 data, 337 data,