From 5a7c5b14a825d940956040541e127bc62f22fe6f Mon Sep 17 00:00:00 2001 From: Federico Igne Date: Thu, 21 Jan 2021 11:01:02 +0000 Subject: Fix support for a few axiom types. Namely: + OWLEquivalentClassesAxiom + OWLFunctionalObjectPropertyAxiom + OWLInverseFunctionalObjectPropertyAxiom --- .../ox/cs/rsacomb/converter/RDFoxConverter.scala | 41 ++++++---------------- .../uk/ac/ox/cs/rsacomb/implicits/RSAAxiom.scala | 17 ++++++--- 2 files changed, 22 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/converter/RDFoxConverter.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/converter/RDFoxConverter.scala index 845ec1f..e3c44c6 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/converter/RDFoxConverter.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/converter/RDFoxConverter.scala @@ -1,35 +1,7 @@ package uk.ac.ox.cs.rsacomb.converter import java.util.stream.Collectors -import org.semanticweb.owlapi.model.{ - OWLAnnotationProperty, - OWLLogicalAxiom, - OWLClass, - OWLClassAssertionAxiom, - OWLClassExpression, - OWLDataProperty, - OWLDataPropertyAssertionAxiom, - OWLDataPropertyDomainAxiom, - OWLDataPropertyExpression, - OWLDataSomeValuesFrom, - OWLEquivalentClassesAxiom, - OWLEquivalentObjectPropertiesAxiom, - OWLInverseObjectPropertiesAxiom, - OWLNamedIndividual, - OWLObjectIntersectionOf, - OWLObjectInverseOf, - OWLObjectMaxCardinality, - OWLObjectOneOf, - OWLObjectProperty, - OWLObjectPropertyAssertionAxiom, - OWLObjectPropertyDomainAxiom, - OWLObjectPropertyExpression, - OWLObjectPropertyRangeAxiom, - OWLObjectSomeValuesFrom, - OWLPropertyExpression, - OWLSubClassOfAxiom, - OWLSubObjectPropertyOfAxiom -} +import org.semanticweb.owlapi.model._ import scala.collection.JavaConverters._ import tech.oxfordsemantic.jrdfox.logic.datalog.{ BindAtom, @@ -120,9 +92,7 @@ trait RDFoxConverter { * - [[org.semanticweb.owlapi.model.OWLDisjointUnionAxiom OWLDisjointUnionAxiom]] * - [[org.semanticweb.owlapi.model.OWLEquivalentDataPropertiesAxiom OWLEquivalentDataPropertiesAxiom]] * - [[org.semanticweb.owlapi.model.OWLFunctionalDataPropertyAxiom OWLFunctionalDataPropertyAxiom]] - * - [[org.semanticweb.owlapi.model.OWLFunctionalObjectPropertyAxiom OWLFunctionalObjectPropertyAxiom]] * - [[org.semanticweb.owlapi.model.OWLHasKeyAxiom OWLHasKeyAxiom]] - * - [[org.semanticweb.owlapi.model.OWLInverseFunctionalObjectPropertyAxiom OWLInverseFunctionalObjectPropertyAxiom]] * - [[org.semanticweb.owlapi.model.OWLIrreflexiveObjectPropertyAxiom OWLIrreflexiveObjectPropertyAxiom]] * - [[org.semanticweb.owlapi.model.OWLNegativeDataPropertyAssertionAxiom OWLNegativeDataPropertyAssertionAxiom]] * - [[org.semanticweb.owlapi.model.OWLNegativeObjectPropertyAssertionAxiom OWLNegativeObjectPropertyAssertionAxiom]] @@ -190,6 +160,9 @@ trait RDFoxConverter { case a: OWLDataPropertyDomainAxiom => convert(a.asOWLSubClassOfAxiom, term, unsafe, skolem, suffix) + case a: OWLDataPropertyRangeAxiom => + Result() // ignored + case a: OWLInverseObjectPropertiesAxiom => { val (atoms, rules) = a.asSubObjectPropertyOfAxioms .map(a => convert(a, term, unsafe, skolem dup a, suffix)) @@ -197,6 +170,12 @@ trait RDFoxConverter { (atoms.flatten, rules.flatten) } + case a: OWLFunctionalObjectPropertyAxiom => + convert(a.asOWLSubClassOfAxiom, term, unsafe, skolem, suffix) + + case a: OWLInverseFunctionalObjectPropertyAxiom => + convert(a.asOWLSubClassOfAxiom, term, unsafe, skolem, suffix) + case a: OWLClassAssertionAxiom => { val ind = a.getIndividual ind match { diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/implicits/RSAAxiom.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/implicits/RSAAxiom.scala index 39d9d66..36db391 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/implicits/RSAAxiom.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/implicits/RSAAxiom.scala @@ -7,12 +7,13 @@ import org.semanticweb.owlapi.model.{ OWLEquivalentClassesAxiom } import org.semanticweb.owlapi.model.{ - OWLObjectPropertyExpression, - OWLSubObjectPropertyOfAxiom, OWLClass, OWLClassExpression, + OWLFunctionalObjectPropertyAxiom, + OWLObjectMaxCardinality, + OWLObjectPropertyExpression, OWLObjectSomeValuesFrom, - OWLObjectMaxCardinality + OWLSubObjectPropertyOfAxiom } import org.semanticweb.owlapi.model.ClassExpressionType import org.semanticweb.owlapi.model.{ @@ -85,10 +86,16 @@ object RSAAxiom { } override def visit(axiom: OWLEquivalentClassesAxiom): Boolean = { - // TODO - false + axiom + .asOWLSubClassOfAxioms() + .asScala + .map(_.accept(this)) + .exists(identity) } + override def visit(axiom: OWLFunctionalObjectPropertyAxiom): Boolean = + t == RSAAxiomType.T4 + def doDefault(axiom: OWLAxiom): Boolean = false } -- cgit v1.2.3