aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFederico Igne <federico.igne@cs.ox.ac.uk>2020-08-08 09:35:48 +0100
committerFederico Igne <federico.igne@cs.ox.ac.uk>2020-08-08 09:35:48 +0100
commitf3b29090e6139b90b4bda0e46b5d3bb2daad65a8 (patch)
tree4aad1fe673cdc9ad3098c5076d492e667b14c0f7 /src
parent378e56852d8b5875ce5b34e91799dd6e704f2d48 (diff)
downloadRSAComb-f3b29090e6139b90b4bda0e46b5d3bb2daad65a8.tar.gz
RSAComb-f3b29090e6139b90b4bda0e46b5d3bb2daad65a8.zip
Add condition 2 for role unsafety detection
Diffstat (limited to 'src')
-rw-r--r--src/main/scala/rsacomb/RSAOntology.scala45
1 files changed, 30 insertions, 15 deletions
diff --git a/src/main/scala/rsacomb/RSAOntology.scala b/src/main/scala/rsacomb/RSAOntology.scala
index 474d316..ebe1591 100644
--- a/src/main/scala/rsacomb/RSAOntology.scala
+++ b/src/main/scala/rsacomb/RSAOntology.scala
@@ -71,34 +71,49 @@ trait RSAOntology {
71 71
72 /* Checking for (1) unsafety condition: 72 /* Checking for (1) unsafety condition:
73 * 73 *
74 * For all roles p1 appearing in an axiom of type T5, p1 is unsafe 74 * For all roles r1 appearing in an axiom of type T5, r1 is unsafe
75 * if there exists a role p2 (different from top) appearing in an axiom 75 * if there exists a role r2 (different from top) appearing in an axiom
76 * of type T3 and p1 is a subproperty of the inverse of p2. 76 * of type T3 and r1 is a subproperty of the inverse of r2.
77 * 77 *
78 * TODO: We are not checking whether the class expression on the right in T3 78 * TODO: We are not checking whether the class expression on the right in T3
79 * is top. For now we can assume it is always the case. 79 * is top. For now we can assume it is always the case.
80 */ 80 */
81 val unsafe = for { 81 val unsafe1 = for {
82 ax1 <- tbox 82 axiom <- tbox
83 if ax1.isT5 83 if axiom.isT5
84 p1 <- ax1.objectPropertyExpressionsInSignature 84 role1 <- axiom.objectPropertyExpressionsInSignature
85 sup = p1.getInverseProperty +: reasoner.superObjectProperties(p1).map(_.getInverseProperty).collect(Collectors.toList()).asScala 85 roleSuper = role1 +: reasoner.superObjectProperties(role1).collect(Collectors.toList()).asScala
86 ax2 <- tbox 86 roleSuperInv = roleSuper.map(_.getInverseProperty)
87 if ax2.isT3 87 axiom <- tbox
88 p2 <- ax2.objectPropertyExpressionsInSignature 88 if axiom.isT3
89 if sup.contains(p2) 89 role2 <- axiom.objectPropertyExpressionsInSignature
90 } yield p1 90 if roleSuperInv.contains(role2)
91 } yield role1
91 92
92 /* Checking for (2) unsafety condition: 93 /* Checking for (2) unsafety condition:
93 * 94 *
94 * TODO 95 * For all roles p1 appearing in an axiom of type T5, p1 is unsafe if
96 * there exists a role p2 appearing in an axiom of type T4 and p1 is a
97 * subproperty of either p2 or the inverse of p2.
98 *
95 */ 99 */
100 val unsafe2 = for {
101 axiom <- tbox
102 if axiom.isT5
103 role1 <- axiom.objectPropertyExpressionsInSignature
104 roleSuper = role1 +: reasoner.superObjectProperties(role1).collect(Collectors.toList()).asScala
105 roleSuperInv = roleSuper.map(_.getInverseProperty)
106 axiom <- tbox
107 if axiom.isT4
108 role2 <- axiom.objectPropertyExpressionsInSignature
109 if roleSuper.contains(role2) || roleSuperInv.contains(role2)
110 } yield role1
96 111
97 /* TODO: We should be able to avoid this last conversion to List. 112 /* TODO: We should be able to avoid this last conversion to List.
98 * Maybe we should just move everything to Sets instead of Lists, since 113 * Maybe we should just move everything to Sets instead of Lists, since
99 * they have a more straightforward conversion from Java collections. 114 * they have a more straightforward conversion from Java collections.
100 */ 115 */
101 unsafe.toList 116 (unsafe1 ++ unsafe2).toList
102 } 117 }
103 118
104 } // implicit class RSAOntology 119 } // implicit class RSAOntology