diff options
Diffstat (limited to 'src/main/scala')
| -rw-r--r-- | src/main/scala/rsacomb/RSAOntology.scala | 30 |
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 |
