aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/rsacomb
diff options
context:
space:
mode:
authorFederico Igne <federico.igne@cs.ox.ac.uk>2020-10-02 12:18:45 +0200
committerFederico Igne <federico.igne@cs.ox.ac.uk>2020-10-02 12:18:45 +0200
commit78966faa10b2ca4f93724e062ba6984a4a4ba956 (patch)
tree8a92caf2ab75e59b5b55ecf3492b4b2b9ff26737 /src/main/scala/rsacomb
parent015e0a233eb3a10e9d291c0bdb871394354177b0 (diff)
downloadRSAComb-78966faa10b2ca4f93724e062ba6984a4a4ba956.tar.gz
RSAComb-78966faa10b2ca4f93724e062ba6984a4a4ba956.zip
Implement `cycle()` and `unfold()` methods
Diffstat (limited to 'src/main/scala/rsacomb')
-rw-r--r--src/main/scala/rsacomb/RSAOntology.scala30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/main/scala/rsacomb/RSAOntology.scala b/src/main/scala/rsacomb/RSAOntology.scala
index fbb5f8a..0acf2a6 100644
--- a/src/main/scala/rsacomb/RSAOntology.scala
+++ b/src/main/scala/rsacomb/RSAOntology.scala
@@ -239,7 +239,7 @@ trait RSAOntology {
239 ) 239 )
240 } 240 }
241 241
242 def self(axiom: OWLSubClassOfAxiom): Set[Term] = { 242 private def self(axiom: OWLSubClassOfAxiom): Set[Term] = {
243 // Assuming just one role in the signature of a T5 axiom 243 // Assuming just one role in the signature of a T5 axiom
244 val role = axiom.objectPropertyExpressionsInSignature(0) 244 val role = axiom.objectPropertyExpressionsInSignature(0)
245 if (this.confl(role).contains(role)) { 245 if (this.confl(role).contains(role)) {
@@ -252,6 +252,34 @@ trait RSAOntology {
252 } 252 }
253 } 253 }
254 254
255 // TODO: this implementation is not correct when taking into
256 // account equality.
257 def cycle(axiom: OWLSubClassOfAxiom): Set[Term] = {
258 // Assuming just one role in the signature of a T5 axiom
259 val roleR = axiom.objectPropertyExpressionsInSignature(0)
260 val conflR = this.confl(roleR)
261 // We just need the TBox to find
262 val tbox = ontology
263 .tboxAxioms(Imports.INCLUDED)
264 .collect(Collectors.toSet())
265 .asScala
266 for {
267 axiom1 <- tbox
268 if axiom1.isT5
269 roleS <- axiom1.objectPropertyExpressionsInSignature // Just 1
270 if conflR.contains(roleS)
271 individual =
272 if (axiom.hashCode < axiom1.hashCode) {
273 RSA.internal("v0_" ++ axiom1.hashCode.toString())
274 } else {
275 RSA.internal("v1_" ++ axiom1.hashCode.toString())
276 }
277 } yield individual
278 }
279
280 def unfold(axiom: OWLSubClassOfAxiom): Set[Term] =
281 this.self(axiom) | this.cycle(axiom)
282
255 } // implicit class RSAOntology 283 } // implicit class RSAOntology
256 284
257} // trait RSAOntology 285} // trait RSAOntology