aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/rsacomb/RDFoxAxiomConverter.scala
diff options
context:
space:
mode:
authorFederico Igne <federico.igne@cs.ox.ac.uk>2020-08-04 11:11:57 +0100
committerFederico Igne <federico.igne@cs.ox.ac.uk>2020-08-04 11:11:57 +0100
commite8518528a77edf6a28449a57bd96048a6232a5db (patch)
tree1dca0e5f8cb1b465e85096f4e5699dd75e77b0f0 /src/main/scala/rsacomb/RDFoxAxiomConverter.scala
parent88597503975804e3cb83d116f3cc9a3f12c57461 (diff)
downloadRSAComb-e8518528a77edf6a28449a57bd96048a6232a5db.tar.gz
RSAComb-e8518528a77edf6a28449a57bd96048a6232a5db.zip
Adapt LP conversion to RSA check
Part of the process involves the search of unsafe roles in the input ontology. This is still to be implemented and for now the set of unsafe roles for the testing example is hardcoded.
Diffstat (limited to 'src/main/scala/rsacomb/RDFoxAxiomConverter.scala')
-rw-r--r--src/main/scala/rsacomb/RDFoxAxiomConverter.scala21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/main/scala/rsacomb/RDFoxAxiomConverter.scala b/src/main/scala/rsacomb/RDFoxAxiomConverter.scala
index 3edc908..0a79823 100644
--- a/src/main/scala/rsacomb/RDFoxAxiomConverter.scala
+++ b/src/main/scala/rsacomb/RDFoxAxiomConverter.scala
@@ -1,36 +1,39 @@
1package rsacomb 1package rsacomb
2 2
3import org.semanticweb.owlapi.model.{OWLAxiom, OWLSubClassOfAxiom, OWLEquivalentClassesAxiom} 3import org.semanticweb.owlapi.model.{OWLAxiom, OWLSubClassOfAxiom, OWLEquivalentClassesAxiom, OWLObjectPropertyExpression}
4import org.semanticweb.owlapi.model.OWLAxiomVisitorEx 4import org.semanticweb.owlapi.model.OWLAxiomVisitorEx
5 5
6import tech.oxfordsemantic.jrdfox.logic.{Rule, BodyFormula} 6import tech.oxfordsemantic.jrdfox.logic.{Rule, BodyFormula}
7import tech.oxfordsemantic.jrdfox.logic.{Atom, Term, Variable, Literal} 7import tech.oxfordsemantic.jrdfox.logic.{Atom, Term, Variable, Literal}
8import tech.oxfordsemantic.jrdfox.logic.{TupleTableName}
8 9
9import scala.collection.JavaConverters._ 10import scala.collection.JavaConverters._
10 11
11import rsacomb.SkolemStrategy 12import rsacomb.SkolemStrategy
12import rsacomb.RDFoxRuleShards 13import rsacomb.RDFoxRuleShards
13import org.semanticweb.owlapi.model.OWLSubObjectPropertyOfAxiom 14import org.semanticweb.owlapi.model.OWLSubObjectPropertyOfAxiom
15import org.semanticweb.owlapi.model.OWLObjectProperty
14 16
15object RDFoxAxiomConverter { 17object RDFoxAxiomConverter {
16 18
17 def apply(term : Term, skolem : SkolemStrategy) : RDFoxAxiomConverter = 19 def apply(
18 new RDFoxAxiomConverter(term, skolem) 20 term : Term = Variable.create("x"),
19 21 skolem : SkolemStrategy = SkolemStrategy.None,
20 def apply(term : Term) : RDFoxAxiomConverter = 22 unsafe : List[OWLObjectPropertyExpression] = List()
21 new RDFoxAxiomConverter(term, SkolemStrategy.None) 23 ) : RDFoxAxiomConverter =
24 new RDFoxAxiomConverter(term, skolem, unsafe)
22 25
23} // object RDFoxAxiomConverter 26} // object RDFoxAxiomConverter
24 27
25class RDFoxAxiomConverter(term : Term, skolem : SkolemStrategy) 28class RDFoxAxiomConverter(term : Term, skolem : SkolemStrategy, unsafe : List[OWLObjectPropertyExpression])
26 extends OWLAxiomVisitorEx[List[Rule]] 29 extends OWLAxiomVisitorEx[List[Rule]]
27{ 30{
28 31
29 override 32 override
30 def visit(axiom : OWLSubClassOfAxiom) : List[Rule] = { 33 def visit(axiom : OWLSubClassOfAxiom) : List[Rule] = {
31 // Skolemization is needed only for the head of an axiom 34 // Skolemization is needed only for the head of an axiom
32 val subVisitor = new RDFoxClassExprConverter(term,SkolemStrategy.None) 35 val subVisitor = new RDFoxClassExprConverter(term,SkolemStrategy.None, unsafe)
33 val superVisitor = new RDFoxClassExprConverter(term, skolem) 36 val superVisitor = new RDFoxClassExprConverter(term, skolem, unsafe)
34 // Each visitor returns a `RDFoxRuleShards`, a tuple (res,ext): 37 // Each visitor returns a `RDFoxRuleShards`, a tuple (res,ext):
35 // - the `res` List is a list of atoms resulting from the conversion 38 // - the `res` List is a list of atoms resulting from the conversion
36 // of the axiom. 39 // of the axiom.