From 015e0a233eb3a10e9d291c0bdb871394354177b0 Mon Sep 17 00:00:00 2001 From: Federico Igne Date: Fri, 2 Oct 2020 11:51:56 +0200 Subject: Implement `self()` method for the computation of canonical models --- src/main/scala/rsacomb/RSAOntology.scala | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src') 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} import org.semanticweb.owlapi.model.OWLOntology import org.semanticweb.owlapi.model.{ OWLObjectProperty, - OWLObjectPropertyExpression + OWLObjectPropertyExpression, + OWLSubClassOfAxiom } import org.semanticweb.owlapi.model.parameters.Imports import org.semanticweb.owlapi.reasoner.structural.StructuralReasonerFactory @@ -216,7 +217,7 @@ trait RSAOntology { def filteringProgram(query: Query): List[Rule] = FilteringProgram(query, individuals).rules - // TODO: needs testing + // TODO: the following functions needs testing def confl( role: OWLObjectPropertyExpression ): Set[OWLObjectPropertyExpression] = { @@ -238,6 +239,19 @@ trait RSAOntology { ) } + def self(axiom: OWLSubClassOfAxiom): Set[Term] = { + // Assuming just one role in the signature of a T5 axiom + val role = axiom.objectPropertyExpressionsInSignature(0) + if (this.confl(role).contains(role)) { + Set( + RSA.internal("v0_" ++ axiom.hashCode.toString()), + RSA.internal("v1_" ++ axiom.hashCode.toString()) + ) + } else { + Set() + } + } + } // implicit class RSAOntology } // trait RSAOntology -- cgit v1.2.3