diff options
Diffstat (limited to 'src/main/scala/rsacomb/RSAOntology.scala')
-rw-r--r-- | src/main/scala/rsacomb/RSAOntology.scala | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/main/scala/rsacomb/RSAOntology.scala b/src/main/scala/rsacomb/RSAOntology.scala index e273dc5..5681843 100644 --- a/src/main/scala/rsacomb/RSAOntology.scala +++ b/src/main/scala/rsacomb/RSAOntology.scala | |||
@@ -38,6 +38,7 @@ import scalax.collection.GraphEdge.UnDiEdge | |||
38 | import org.semanticweb.owlapi.dlsyntax.renderer.DLSyntaxObjectRenderer | 38 | import org.semanticweb.owlapi.dlsyntax.renderer.DLSyntaxObjectRenderer |
39 | import tech.oxfordsemantic.jrdfox.logic._ | 39 | import tech.oxfordsemantic.jrdfox.logic._ |
40 | 40 | ||
41 | object RSAOntology {} | ||
41 | /* Wrapper trait for the implicit class `RSAOntology`. | 42 | /* Wrapper trait for the implicit class `RSAOntology`. |
42 | */ | 43 | */ |
43 | trait RSAOntology { | 44 | trait RSAOntology { |
@@ -267,8 +268,8 @@ trait RSAOntology { | |||
267 | val role = axiom.objectPropertyExpressionsInSignature(0) | 268 | val role = axiom.objectPropertyExpressionsInSignature(0) |
268 | if (this.confl(role).contains(role)) { | 269 | if (this.confl(role).contains(role)) { |
269 | Set( | 270 | Set( |
270 | RSA.internal("v0_" ++ axiom.hashCode.toString()), | 271 | RSA.internal("v0_" ++ RSA.hashed(axiom)), |
271 | RSA.internal("v1_" ++ axiom.hashCode.toString()) | 272 | RSA.internal("v1_" ++ RSA.hashed(axiom)) |
272 | ) | 273 | ) |
273 | } else { | 274 | } else { |
274 | Set() | 275 | Set() |
@@ -329,15 +330,15 @@ trait RSAOntology { | |||
329 | classC <- classes | 330 | classC <- classes |
330 | // Keeping this check for now | 331 | // Keeping this check for now |
331 | if !unsafeRoles.contains(roleS) | 332 | if !unsafeRoles.contains(roleS) |
332 | tripleARB = Seq(classA, roleR, classB).hashCode | 333 | tripleARB = RSA.hashed(classA, roleR, classB) |
333 | tripleDSC = Seq(classD, roleS, classC).hashCode | 334 | tripleDSC = RSA.hashed(classD, roleS, classC) |
334 | individual = | 335 | individual = |
335 | if (tripleARB > tripleDSC) { | 336 | if (tripleARB > tripleDSC) { |
336 | RSA.internal("v1_" ++ tripleDSC.hashCode.toString()) | 337 | RSA.internal("v1_" ++ tripleDSC) |
337 | } else { | 338 | } else { |
338 | // Note that this is also the case for | 339 | // Note that this is also the case for |
339 | // `tripleARB == tripleDSC` | 340 | // `tripleARB == tripleDSC` |
340 | RSA.internal("v0_" ++ tripleDSC.hashCode.toString()) | 341 | RSA.internal("v0_" ++ tripleDSC) |
341 | } | 342 | } |
342 | } yield individual | 343 | } yield individual |
343 | } | 344 | } |
@@ -433,7 +434,7 @@ trait RSAOntology { | |||
433 | private def rules1(axiom: OWLSubClassOfAxiom): List[Rule] = { | 434 | private def rules1(axiom: OWLSubClassOfAxiom): List[Rule] = { |
434 | val unfold = ontology.unfold(axiom).toList | 435 | val unfold = ontology.unfold(axiom).toList |
435 | // Fresh Variables | 436 | // Fresh Variables |
436 | val v0 = RSA.internal("v0_" ++ axiom.hashCode.toString) | 437 | val v0 = RSA.internal("v0_" ++ RSA.hashed(axiom)) |
437 | val varX = Variable.create("X") | 438 | val varX = Variable.create("X") |
438 | // Predicates | 439 | // Predicates |
439 | val atomA: TupleTableAtom = { | 440 | val atomA: TupleTableAtom = { |
@@ -484,9 +485,9 @@ trait RSAOntology { | |||
484 | .getProperty | 485 | .getProperty |
485 | if (ontology.confl(roleR) contains roleR) { | 486 | if (ontology.confl(roleR) contains roleR) { |
486 | // Fresh Variables | 487 | // Fresh Variables |
487 | val v0 = RSA.internal("v0_" ++ axiom.hashCode.toString) | 488 | val v0 = RSA.internal("v0_" ++ RSA.hashed(axiom)) |
488 | val v1 = RSA.internal("v1_" ++ axiom.hashCode.toString) | 489 | val v1 = RSA.internal("v1_" ++ RSA.hashed(axiom)) |
489 | val v2 = RSA.internal("v2_" ++ axiom.hashCode.toString) | 490 | val v2 = RSA.internal("v2_" ++ RSA.hashed(axiom)) |
490 | // Predicates | 491 | // Predicates |
491 | def atomA(t: Term): TupleTableAtom = { | 492 | def atomA(t: Term): TupleTableAtom = { |
492 | val cls = axiom.getSubClass.asInstanceOf[OWLClass].getIRI | 493 | val cls = axiom.getSubClass.asInstanceOf[OWLClass].getIRI |
@@ -524,7 +525,7 @@ trait RSAOntology { | |||
524 | .asInstanceOf[OWLObjectSomeValuesFrom] | 525 | .asInstanceOf[OWLObjectSomeValuesFrom] |
525 | .getProperty | 526 | .getProperty |
526 | // Fresh Variables | 527 | // Fresh Variables |
527 | val v1 = RSA.internal("v1_" ++ axiom.hashCode.toString) | 528 | val v1 = RSA.internal("v1_" ++ RSA.hashed(axiom)) |
528 | // Predicates | 529 | // Predicates |
529 | def atomA(t: Term): TupleTableAtom = { | 530 | def atomA(t: Term): TupleTableAtom = { |
530 | val cls = axiom.getSubClass.asInstanceOf[OWLClass].getIRI | 531 | val cls = axiom.getSubClass.asInstanceOf[OWLClass].getIRI |