diff options
| author | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-08-11 13:07:55 +0100 |
|---|---|---|
| committer | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-08-11 13:07:55 +0100 |
| commit | 09cd0c4b916fb111d586f622ebe57801db5fc36a (patch) | |
| tree | 3df27964ebb6761fe40335f8d6b46995bb78b70b | |
| parent | e1e0bf5c2d634c4b2e5350614625996e843e2e9a (diff) | |
| download | RSAComb-09cd0c4b916fb111d586f622ebe57801db5fc36a.tar.gz RSAComb-09cd0c4b916fb111d586f622ebe57801db5fc36a.zip | |
Fix role unsafety check
We now check that the existential expression in the axiom of type T3 is
not top.
| -rw-r--r-- | src/main/scala/rsacomb/RSAAxiom.scala | 10 | ||||
| -rw-r--r-- | src/main/scala/rsacomb/RSAOntology.scala | 5 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/main/scala/rsacomb/RSAAxiom.scala b/src/main/scala/rsacomb/RSAAxiom.scala index 588c72a..9e9a016 100644 --- a/src/main/scala/rsacomb/RSAAxiom.scala +++ b/src/main/scala/rsacomb/RSAAxiom.scala | |||
| @@ -16,9 +16,10 @@ trait RSAAxiom { | |||
| 16 | */ | 16 | */ |
| 17 | private sealed trait RSAAxiomType | 17 | private sealed trait RSAAxiomType |
| 18 | private object RSAAxiomType { | 18 | private object RSAAxiomType { |
| 19 | case object T3 extends RSAAxiomType // ∃R.A ⊑ B | 19 | case object T3 extends RSAAxiomType // ∃R.A ⊑ B |
| 20 | case object T4 extends RSAAxiomType // A ⊑ ≤1R.B | 20 | case object T3top extends RSAAxiomType // ∃R.⊤ ⊑ B |
| 21 | case object T5 extends RSAAxiomType // A ⊑ ∃R.B | 21 | case object T4 extends RSAAxiomType // A ⊑ ≤1R.B |
| 22 | case object T5 extends RSAAxiomType // A ⊑ ∃R.B | ||
| 22 | } | 23 | } |
| 23 | 24 | ||
| 24 | /* Implements additional features on top of `OWLAxiom` from | 25 | /* Implements additional features on top of `OWLAxiom` from |
| @@ -43,6 +44,8 @@ trait RSAAxiom { | |||
| 43 | val sub = axiom.getSubClass().getClassExpressionType() | 44 | val sub = axiom.getSubClass().getClassExpressionType() |
| 44 | val sup = axiom.getSuperClass().getClassExpressionType() | 45 | val sup = axiom.getSuperClass().getClassExpressionType() |
| 45 | t match { | 46 | t match { |
| 47 | case RSAAxiomType.T3top => // ∃R.⊤ ⊑ B | ||
| 48 | axiom.isT5 && axiom.getSubClass().asInstanceOf[OWLObjectSomeValuesFrom].getFiller.isOWLThing | ||
| 46 | case RSAAxiomType.T3 => // ∃R.A ⊑ B | 49 | case RSAAxiomType.T3 => // ∃R.A ⊑ B |
| 47 | sub == ClassExpressionType.OBJECT_SOME_VALUES_FROM && sup == ClassExpressionType.OWL_CLASS | 50 | sub == ClassExpressionType.OBJECT_SOME_VALUES_FROM && sup == ClassExpressionType.OWL_CLASS |
| 48 | case RSAAxiomType.T4 => // A ⊑ ≤1R.B | 51 | case RSAAxiomType.T4 => // A ⊑ ≤1R.B |
| @@ -67,6 +70,7 @@ trait RSAAxiom { | |||
| 67 | } | 70 | } |
| 68 | 71 | ||
| 69 | /* Exposed methods */ | 72 | /* Exposed methods */ |
| 73 | def isT3top: Boolean = isOfType(RSAAxiomType.T3top) | ||
| 70 | def isT3: Boolean = isOfType(RSAAxiomType.T3) | 74 | def isT3: Boolean = isOfType(RSAAxiomType.T3) |
| 71 | def isT4: Boolean = isOfType(RSAAxiomType.T4) | 75 | def isT4: Boolean = isOfType(RSAAxiomType.T4) |
| 72 | def isT5: Boolean = isOfType(RSAAxiomType.T5) | 76 | def isT5: Boolean = isOfType(RSAAxiomType.T5) |
diff --git a/src/main/scala/rsacomb/RSAOntology.scala b/src/main/scala/rsacomb/RSAOntology.scala index 92be118..3b08e61 100644 --- a/src/main/scala/rsacomb/RSAOntology.scala +++ b/src/main/scala/rsacomb/RSAOntology.scala | |||
| @@ -108,9 +108,6 @@ trait RSAOntology { | |||
| 108 | * For all roles r1 appearing in an axiom of type T5, r1 is unsafe | 108 | * For all roles r1 appearing in an axiom of type T5, r1 is unsafe |
| 109 | * if there exists a role r2 (different from top) appearing in an axiom | 109 | * if there exists a role r2 (different from top) appearing in an axiom |
| 110 | * of type T3 and r1 is a subproperty of the inverse of r2. | 110 | * of type T3 and r1 is a subproperty of the inverse of r2. |
| 111 | * | ||
| 112 | * TODO: We are not checking whether the class expression on the right in T3 | ||
| 113 | * is top. For now we can assume it is always the case. | ||
| 114 | */ | 111 | */ |
| 115 | val unsafe1 = for { | 112 | val unsafe1 = for { |
| 116 | axiom <- tbox | 113 | axiom <- tbox |
| @@ -119,7 +116,7 @@ trait RSAOntology { | |||
| 119 | roleSuper = role1 +: reasoner.superObjectProperties(role1).collect(Collectors.toList()).asScala | 116 | roleSuper = role1 +: reasoner.superObjectProperties(role1).collect(Collectors.toList()).asScala |
| 120 | roleSuperInv = roleSuper.map(_.getInverseProperty) | 117 | roleSuperInv = roleSuper.map(_.getInverseProperty) |
| 121 | axiom <- tbox | 118 | axiom <- tbox |
| 122 | if axiom.isT3 | 119 | if axiom.isT3 && !axiom.isT3top |
| 123 | role2 <- axiom.objectPropertyExpressionsInSignature | 120 | role2 <- axiom.objectPropertyExpressionsInSignature |
| 124 | if roleSuperInv.contains(role2) | 121 | if roleSuperInv.contains(role2) |
| 125 | } yield role1 | 122 | } yield role1 |
