diff options
Diffstat (limited to 'src/main/scala/rsacomb/RDFoxAxiomConverter.scala')
| -rw-r--r-- | src/main/scala/rsacomb/RDFoxAxiomConverter.scala | 21 |
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 @@ | |||
| 1 | package rsacomb | 1 | package rsacomb |
| 2 | 2 | ||
| 3 | import org.semanticweb.owlapi.model.{OWLAxiom, OWLSubClassOfAxiom, OWLEquivalentClassesAxiom} | 3 | import org.semanticweb.owlapi.model.{OWLAxiom, OWLSubClassOfAxiom, OWLEquivalentClassesAxiom, OWLObjectPropertyExpression} |
| 4 | import org.semanticweb.owlapi.model.OWLAxiomVisitorEx | 4 | import org.semanticweb.owlapi.model.OWLAxiomVisitorEx |
| 5 | 5 | ||
| 6 | import tech.oxfordsemantic.jrdfox.logic.{Rule, BodyFormula} | 6 | import tech.oxfordsemantic.jrdfox.logic.{Rule, BodyFormula} |
| 7 | import tech.oxfordsemantic.jrdfox.logic.{Atom, Term, Variable, Literal} | 7 | import tech.oxfordsemantic.jrdfox.logic.{Atom, Term, Variable, Literal} |
| 8 | import tech.oxfordsemantic.jrdfox.logic.{TupleTableName} | ||
| 8 | 9 | ||
| 9 | import scala.collection.JavaConverters._ | 10 | import scala.collection.JavaConverters._ |
| 10 | 11 | ||
| 11 | import rsacomb.SkolemStrategy | 12 | import rsacomb.SkolemStrategy |
| 12 | import rsacomb.RDFoxRuleShards | 13 | import rsacomb.RDFoxRuleShards |
| 13 | import org.semanticweb.owlapi.model.OWLSubObjectPropertyOfAxiom | 14 | import org.semanticweb.owlapi.model.OWLSubObjectPropertyOfAxiom |
| 15 | import org.semanticweb.owlapi.model.OWLObjectProperty | ||
| 14 | 16 | ||
| 15 | object RDFoxAxiomConverter { | 17 | object 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 | ||
| 25 | class RDFoxAxiomConverter(term : Term, skolem : SkolemStrategy) | 28 | class 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. |
