diff options
Diffstat (limited to 'src/main/scala/rsacomb/RDFoxAxiomConverter.scala')
| -rw-r--r-- | src/main/scala/rsacomb/RDFoxAxiomConverter.scala | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/main/scala/rsacomb/RDFoxAxiomConverter.scala b/src/main/scala/rsacomb/RDFoxAxiomConverter.scala index 675ca7d..3edc908 100644 --- a/src/main/scala/rsacomb/RDFoxAxiomConverter.scala +++ b/src/main/scala/rsacomb/RDFoxAxiomConverter.scala | |||
| @@ -4,12 +4,13 @@ import org.semanticweb.owlapi.model.{OWLAxiom, OWLSubClassOfAxiom, OWLEquivalent | |||
| 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, Literal} | 7 | import tech.oxfordsemantic.jrdfox.logic.{Atom, Term, Variable, Literal} |
| 8 | 8 | ||
| 9 | import scala.collection.JavaConverters._ | 9 | import scala.collection.JavaConverters._ |
| 10 | 10 | ||
| 11 | import rsacomb.SkolemStrategy | 11 | import rsacomb.SkolemStrategy |
| 12 | import rsacomb.RDFoxRuleShards | 12 | import rsacomb.RDFoxRuleShards |
| 13 | import org.semanticweb.owlapi.model.OWLSubObjectPropertyOfAxiom | ||
| 13 | 14 | ||
| 14 | object RDFoxAxiomConverter { | 15 | object RDFoxAxiomConverter { |
| 15 | 16 | ||
| @@ -46,11 +47,23 @@ class RDFoxAxiomConverter(term : Term, skolem : SkolemStrategy) | |||
| 46 | 47 | ||
| 47 | override | 48 | override |
| 48 | def visit(axiom : OWLEquivalentClassesAxiom) : List[Rule] = { | 49 | def visit(axiom : OWLEquivalentClassesAxiom) : List[Rule] = { |
| 49 | for { | 50 | for { |
| 50 | axiom1 <- axiom.asPairwiseAxioms.asScala.toList | 51 | axiom1 <- axiom.asPairwiseAxioms.asScala.toList |
| 51 | axiom2 <- axiom1.asOWLSubClassOfAxioms.asScala.toList | 52 | axiom2 <- axiom1.asOWLSubClassOfAxioms.asScala.toList |
| 52 | rule <- axiom2.accept(this) | 53 | rule <- axiom2.accept(this) |
| 53 | } yield rule | 54 | } yield rule |
| 55 | } | ||
| 56 | |||
| 57 | override | ||
| 58 | def visit(axiom : OWLSubObjectPropertyOfAxiom) : List[Rule] = { | ||
| 59 | // TODO: variables needs to be handled at visitor level. Hardcoding | ||
| 60 | // the name of the varibles might lead to errors for complex cases. | ||
| 61 | val term1 = Variable.create("y") | ||
| 62 | val subVisitor = new RDFoxPropertyExprConverter(term,term1,SkolemStrategy.None) | ||
| 63 | val superVisitor = new RDFoxPropertyExprConverter(term,term1,skolem) | ||
| 64 | val body: List[BodyFormula] = axiom.getSubProperty.accept(subVisitor) | ||
| 65 | val head: List[Atom] = axiom.getSuperProperty.accept(superVisitor) | ||
| 66 | List(Rule.create(head.asJava,body.asJava)) | ||
| 54 | } | 67 | } |
| 55 | 68 | ||
| 56 | def doDefault(axiom : OWLAxiom) : List[Rule] = List() | 69 | def doDefault(axiom : OWLAxiom) : List[Rule] = List() |
