diff options
Diffstat (limited to 'src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala')
-rw-r--r-- | src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala | 35 |
1 files changed, 28 insertions, 7 deletions
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 2b165c4..a0d567e 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala | |||
@@ -214,7 +214,7 @@ class RSAOntology( | |||
214 | /** Retrieve individuals/literals in the ontology */ | 214 | /** Retrieve individuals/literals in the ontology */ |
215 | private val individuals: List[IRI] = | 215 | private val individuals: List[IRI] = |
216 | ontology | 216 | ontology |
217 | .getIndividualsInSignature() | 217 | .getIndividualsInSignature(Imports.INCLUDED) |
218 | .asScala | 218 | .asScala |
219 | .map(_.getIRI) | 219 | .map(_.getIRI) |
220 | .map(implicits.RDFox.owlapiToRdfoxIri) | 220 | .map(implicits.RDFox.owlapiToRdfoxIri) |
@@ -588,23 +588,44 @@ class RSAOntology( | |||
588 | RDFoxUtil.addData(data, RSAOntology.CanonGraph, datafiles: _*) | 588 | RDFoxUtil.addData(data, RSAOntology.CanonGraph, datafiles: _*) |
589 | 589 | ||
590 | /* Top/equality axiomatization */ | 590 | /* Top/equality axiomatization */ |
591 | RDFoxUtil.updateData(data, | ||
592 | s""" | ||
593 | INSERT { | ||
594 | GRAPH ${RSAOntology.CanonGraph} { ?X a ${IRI.THING} } | ||
595 | } WHERE { | ||
596 | GRAPH ${RSAOntology.CanonGraph} { ?X ?Y ?Z } | ||
597 | } | ||
598 | """ | ||
599 | ) | ||
600 | RDFoxUtil.updateData(data, | ||
601 | s""" | ||
602 | INSERT { | ||
603 | GRAPH ${RSAOntology.CanonGraph} { ?Z a ${RSA.NAMED} } | ||
604 | } WHERE { | ||
605 | GRAPH ${RSAOntology.CanonGraph} { ?X ?Y ?Z }. | ||
606 | FILTER( ?Y != a ) | ||
607 | } | ||
608 | """ | ||
609 | ) | ||
591 | RDFoxUtil.addRules(data, topAxioms ++ equalityAxioms) | 610 | RDFoxUtil.addRules(data, topAxioms ++ equalityAxioms) |
592 | Logger.write(topAxioms.mkString("\n"), "axiomatisation.dlog") | 611 | Logger.write(topAxioms.mkString("\n"), "axiomatisation.dlog") |
593 | Logger.write(equalityAxioms.mkString("\n"), "axiomatisation.dlog") | 612 | Logger.write(equalityAxioms.mkString("\n"), "axiomatisation.dlog") |
594 | 613 | ||
595 | /* Introduce `rsacomb:Named` concept */ | 614 | /* Introduce `rsacomb:Named` concept */ |
596 | data.evaluateUpdate( | 615 | /* From data */ |
597 | null, // the base IRI for the query (if null, a default is used) | 616 | RDFoxUtil.updateData(data, |
598 | RSA.Prefixes, | ||
599 | s""" | 617 | s""" |
600 | INSERT { | 618 | INSERT { |
601 | GRAPH ${RSAOntology.CanonGraph} { ?X a ${RSA.NAMED} } | 619 | GRAPH ${RSAOntology.CanonGraph} { ?X a ${RSA.NAMED} } |
602 | } WHERE { | 620 | } WHERE { |
603 | GRAPH ${RSAOntology.CanonGraph} { ?X a ${IRI.THING} } | 621 | GRAPH ${RSAOntology.CanonGraph} { ?X a ${IRI.THING} } |
604 | } | 622 | } |
605 | """, | 623 | """ |
606 | new java.util.HashMap[String, String] | ||
607 | ) | 624 | ) |
625 | /* From ontology */ | ||
626 | val named = individuals.map(RSA.Named(RSAOntology.CanonGraph)(_)) | ||
627 | RDFoxUtil.addFacts(data, RSAOntology.CanonGraph, named) | ||
628 | Logger.write(named.mkString("", ".\n", ".\n"), "canonical_model.dlog") | ||
608 | 629 | ||
609 | /* Add canonical model */ | 630 | /* Add canonical model */ |
610 | Logger print s"Canonical model facts: ${this.canonicalModel.facts.length}" | 631 | Logger print s"Canonical model facts: ${this.canonicalModel.facts.length}" |
@@ -630,7 +651,7 @@ class RSAOntology( | |||
630 | RDFoxUtil.addRules(data, filter.rules) | 651 | RDFoxUtil.addRules(data, filter.rules) |
631 | 652 | ||
632 | // TODO: We remove the rules, should we drop the tuple table as well? | 653 | // TODO: We remove the rules, should we drop the tuple table as well? |
633 | data.clearRulesAxiomsExplicateFacts() | 654 | //data.clearRulesAxiomsExplicateFacts() |
634 | 655 | ||
635 | /* Gather answers to the query */ | 656 | /* Gather answers to the query */ |
636 | val answers = RDFoxUtil | 657 | val answers = RDFoxUtil |