diff options
| author | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-10-02 11:51:56 +0200 |
|---|---|---|
| committer | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-10-02 11:51:56 +0200 |
| commit | 015e0a233eb3a10e9d291c0bdb871394354177b0 (patch) | |
| tree | 49fb86ccdb19a39aadc22eab8ed5375ac2100c55 /src/main/scala/rsacomb/RSAOntology.scala | |
| parent | 9ad95a1a08fb441a5594292c20ff2ac38bb8fb4f (diff) | |
| download | RSAComb-015e0a233eb3a10e9d291c0bdb871394354177b0.tar.gz RSAComb-015e0a233eb3a10e9d291c0bdb871394354177b0.zip | |
Implement `self()` method for the computation of canonical models
Diffstat (limited to 'src/main/scala/rsacomb/RSAOntology.scala')
| -rw-r--r-- | src/main/scala/rsacomb/RSAOntology.scala | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/main/scala/rsacomb/RSAOntology.scala b/src/main/scala/rsacomb/RSAOntology.scala index 26b56d7..fbb5f8a 100644 --- a/src/main/scala/rsacomb/RSAOntology.scala +++ b/src/main/scala/rsacomb/RSAOntology.scala | |||
| @@ -7,7 +7,8 @@ import java.util.stream.{Collectors, Stream} | |||
| 7 | import org.semanticweb.owlapi.model.OWLOntology | 7 | import org.semanticweb.owlapi.model.OWLOntology |
| 8 | import org.semanticweb.owlapi.model.{ | 8 | import org.semanticweb.owlapi.model.{ |
| 9 | OWLObjectProperty, | 9 | OWLObjectProperty, |
| 10 | OWLObjectPropertyExpression | 10 | OWLObjectPropertyExpression, |
| 11 | OWLSubClassOfAxiom | ||
| 11 | } | 12 | } |
| 12 | import org.semanticweb.owlapi.model.parameters.Imports | 13 | import org.semanticweb.owlapi.model.parameters.Imports |
| 13 | import org.semanticweb.owlapi.reasoner.structural.StructuralReasonerFactory | 14 | import org.semanticweb.owlapi.reasoner.structural.StructuralReasonerFactory |
| @@ -216,7 +217,7 @@ trait RSAOntology { | |||
| 216 | def filteringProgram(query: Query): List[Rule] = | 217 | def filteringProgram(query: Query): List[Rule] = |
| 217 | FilteringProgram(query, individuals).rules | 218 | FilteringProgram(query, individuals).rules |
| 218 | 219 | ||
| 219 | // TODO: needs testing | 220 | // TODO: the following functions needs testing |
| 220 | def confl( | 221 | def confl( |
| 221 | role: OWLObjectPropertyExpression | 222 | role: OWLObjectPropertyExpression |
| 222 | ): Set[OWLObjectPropertyExpression] = { | 223 | ): Set[OWLObjectPropertyExpression] = { |
| @@ -238,6 +239,19 @@ trait RSAOntology { | |||
| 238 | ) | 239 | ) |
| 239 | } | 240 | } |
| 240 | 241 | ||
| 242 | def self(axiom: OWLSubClassOfAxiom): Set[Term] = { | ||
| 243 | // Assuming just one role in the signature of a T5 axiom | ||
| 244 | val role = axiom.objectPropertyExpressionsInSignature(0) | ||
| 245 | if (this.confl(role).contains(role)) { | ||
| 246 | Set( | ||
| 247 | RSA.internal("v0_" ++ axiom.hashCode.toString()), | ||
| 248 | RSA.internal("v1_" ++ axiom.hashCode.toString()) | ||
| 249 | ) | ||
| 250 | } else { | ||
| 251 | Set() | ||
| 252 | } | ||
| 253 | } | ||
| 254 | |||
| 241 | } // implicit class RSAOntology | 255 | } // implicit class RSAOntology |
| 242 | 256 | ||
| 243 | } // trait RSAOntology | 257 | } // trait RSAOntology |
