aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/rsacomb/RSAOntology.scala
diff options
context:
space:
mode:
authorFederico Igne <federico.igne@cs.ox.ac.uk>2020-11-14 14:00:55 +0000
committerFederico Igne <federico.igne@cs.ox.ac.uk>2020-11-14 14:00:55 +0000
commit313d3f835977f4d7f59e32e1b6cf4a508e1a3431 (patch)
tree79c9985bf826ae3557539bd1cffe49f1bfa9320a /src/main/scala/rsacomb/RSAOntology.scala
parent77900dc5a9439336eed37e7b8d6c587d1f9288fc (diff)
downloadRSAComb-313d3f835977f4d7f59e32e1b6cf4a508e1a3431.tar.gz
RSAComb-313d3f835977f4d7f59e32e1b6cf4a508e1a3431.zip
Fix NI predicate computation
Now NAMED is introduced during the canonical model computation, while NI instances are computed and introduced in the filtering program generation phase.
Diffstat (limited to 'src/main/scala/rsacomb/RSAOntology.scala')
-rw-r--r--src/main/scala/rsacomb/RSAOntology.scala27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/main/scala/rsacomb/RSAOntology.scala b/src/main/scala/rsacomb/RSAOntology.scala
index dcd9c63..9220434 100644
--- a/src/main/scala/rsacomb/RSAOntology.scala
+++ b/src/main/scala/rsacomb/RSAOntology.scala
@@ -245,8 +245,11 @@ trait RSAOntology {
245 Graph(edges: _*) 245 Graph(edges: _*)
246 } 246 }
247 247
248 def filteringProgram(query: SelectQuery): FilteringProgram = 248 def filteringProgram(
249 FilteringProgram(query, individuals) 249 query: SelectQuery,
250 nis: List[Term]
251 ): FilteringProgram =
252 new FilteringProgram(query, nis)
250 253
251 // TODO: the following functions needs testing 254 // TODO: the following functions needs testing
252 def confl( 255 def confl(
@@ -359,9 +362,11 @@ trait RSAOntology {
359 362
360 import RDFoxUtil._ 363 import RDFoxUtil._
361 364
362 val NIs: List[Rule] = 365 val named: List[Rule] =
363 individuals.map(a => 366 individuals.map(a =>
364 Rule.create(TupleTableAtom.rdf(a, IRI.RDF_TYPE, RSA.internal("NI"))) 367 Rule.create(
368 TupleTableAtom.rdf(a, IRI.RDF_TYPE, RSA.internal("NAMED"))
369 )
365 ) 370 )
366 371
367 val rolesAdditionalRules: List[Rule] = { 372 val rolesAdditionalRules: List[Rule] = {
@@ -500,17 +505,17 @@ trait RSAOntology {
500 val z = Variable.create("Z") 505 val z = Variable.create("Z")
501 List( 506 List(
502 Rule.create( 507 Rule.create(
503 TupleTableAtom.rdf(x, IRI.SAME_AS, x), 508 TupleTableAtom.rdf(x, RSA.EquivTo, x),
504 TupleTableAtom.rdf(x, IRI.RDF_TYPE, IRI.THING) 509 TupleTableAtom.rdf(x, IRI.RDF_TYPE, IRI.THING)
505 ), 510 ),
506 Rule.create( 511 Rule.create(
507 TupleTableAtom.rdf(y, IRI.SAME_AS, x), 512 TupleTableAtom.rdf(y, RSA.EquivTo, x),
508 TupleTableAtom.rdf(x, IRI.SAME_AS, y) 513 TupleTableAtom.rdf(x, RSA.EquivTo, y)
509 ), 514 ),
510 Rule.create( 515 Rule.create(
511 TupleTableAtom.rdf(x, IRI.SAME_AS, z), 516 TupleTableAtom.rdf(x, RSA.EquivTo, z),
512 TupleTableAtom.rdf(x, IRI.SAME_AS, y), 517 TupleTableAtom.rdf(x, RSA.EquivTo, y),
513 TupleTableAtom.rdf(y, IRI.SAME_AS, z) 518 TupleTableAtom.rdf(y, RSA.EquivTo, z)
514 ) 519 )
515 ) 520 )
516 } 521 }
@@ -519,7 +524,7 @@ trait RSAOntology {
519 // Compute rules from ontology axioms 524 // Compute rules from ontology axioms
520 val rules = axioms.flatMap(_.accept(this.ProgramGenerator)) 525 val rules = axioms.flatMap(_.accept(this.ProgramGenerator))
521 // Return full set of rules 526 // Return full set of rules
522 rules ++ rolesAdditionalRules ++ topAxioms ++ equalityAxioms ++ NIs 527 rules ++ rolesAdditionalRules ++ topAxioms ++ equalityAxioms ++ named
523 } 528 }
524 529
525 object ProgramGenerator 530 object ProgramGenerator