From 633529ca7a911646048886b7e2e0d1d98c94fdf3 Mon Sep 17 00:00:00 2001 From: Federico Igne Date: Thu, 16 Jul 2020 17:47:32 +0100 Subject: Update to JRDFox v3.1.0 --- src/main/scala/rsacomb/RDFoxAxiomConverter.scala | 4 ++-- src/main/scala/rsacomb/RDFoxClassExprConverter.scala | 14 +++++++------- src/main/scala/rsacomb/RDFoxPropertyExprConverter.scala | 5 +++-- src/main/scala/rsacomb/RDFoxRuleShards.scala | 4 ++-- src/main/scala/rsacomb/RSAComb.scala | 8 ++++++-- 5 files changed, 20 insertions(+), 15 deletions(-) (limited to 'src/main/scala/rsacomb') diff --git a/src/main/scala/rsacomb/RDFoxAxiomConverter.scala b/src/main/scala/rsacomb/RDFoxAxiomConverter.scala index 0a6272f..675ca7d 100644 --- a/src/main/scala/rsacomb/RDFoxAxiomConverter.scala +++ b/src/main/scala/rsacomb/RDFoxAxiomConverter.scala @@ -3,8 +3,8 @@ package rsacomb import org.semanticweb.owlapi.model.{OWLAxiom, OWLSubClassOfAxiom, OWLEquivalentClassesAxiom} import org.semanticweb.owlapi.model.OWLAxiomVisitorEx -import tech.oxfordsemantic.jrdfox.logic.Rule -import tech.oxfordsemantic.jrdfox.logic.{Atom, Term, Literal, Individual} +import tech.oxfordsemantic.jrdfox.logic.{Rule, BodyFormula} +import tech.oxfordsemantic.jrdfox.logic.{Atom, Term, Literal} import scala.collection.JavaConverters._ diff --git a/src/main/scala/rsacomb/RDFoxClassExprConverter.scala b/src/main/scala/rsacomb/RDFoxClassExprConverter.scala index 3e60461..bf026c3 100644 --- a/src/main/scala/rsacomb/RDFoxClassExprConverter.scala +++ b/src/main/scala/rsacomb/RDFoxClassExprConverter.scala @@ -5,8 +5,8 @@ import java.util.stream.{Stream,Collectors} import org.semanticweb.owlapi.model.{OWLClassExpression, OWLClass, OWLObjectSomeValuesFrom, OWLObjectIntersectionOf, OWLObjectOneOf, OWLObjectMaxCardinality} import org.semanticweb.owlapi.model.OWLClassExpressionVisitorEx -import tech.oxfordsemantic.jrdfox.logic.{AtomicFormula, Bind,BuiltinFunctionCall} -import tech.oxfordsemantic.jrdfox.logic.{Atom, Predicate, Term, Variable, Literal, Individual} +import tech.oxfordsemantic.jrdfox.logic.{BindAtom, BuiltinFunctionCall, TupleTableName} +import tech.oxfordsemantic.jrdfox.logic.{Atom, Term, Variable, Literal, Datatype} import rsacomb.SkolemStrategy import rsacomb.RDFoxRuleShards @@ -39,7 +39,7 @@ class RDFoxClassExprConverter(term : Term, skolem : SkolemStrategy) override def visit(expr : OWLClass) : RDFoxRuleShards = { val name = expr.getIRI.getIRIString - val atom = List(Atom.create(Predicate.create(name), term)) + val atom = List(Atom.create(TupleTableName.create(name), term)) RDFoxRuleShards(atom,List()) } @@ -64,7 +64,7 @@ class RDFoxClassExprConverter(term : Term, skolem : SkolemStrategy) .head // restricts to proper "nominals" .asOWLNamedIndividual.getIRI.getIRIString val atom = List(Atom.create( - Predicate.create("owl:sameAs"), term, Individual.create(ind) + TupleTableName.create("owl:sameAs"), term, Literal.create(ind, Datatype.IRI_REFERENCE) )) RDFoxRuleShards(atom,List()) } @@ -77,12 +77,12 @@ class RDFoxClassExprConverter(term : Term, skolem : SkolemStrategy) val y = Variable.create("y") val (fun,term1) = skolem match { case SkolemStrategy.None => (List(),y) - case SkolemStrategy.Constant(c) => (List(), Individual.create(c)) + case SkolemStrategy.Constant(c) => (List(), Literal.create(c, Datatype.IRI_REFERENCE)) case SkolemStrategy.Standard(f) => // At the time of writing the RDFox library does not have a // particular class for the "SKOLEM" operator and it is instead // a simple builtin function with a special name. - (List(Bind.create(BuiltinFunctionCall.create("SKOLEM",term),y)),y) + (List(BindAtom.create(BuiltinFunctionCall.create("SKOLEM",term),y)),y) } val classVisitor = new RDFoxClassExprConverter(term1,skolem) val classResult = expr.getFiller.accept(classVisitor) @@ -108,7 +108,7 @@ class RDFoxClassExprConverter(term : Term, skolem : SkolemStrategy) .map(expr.getProperty.accept(_)) .flatten RDFoxRuleShards( - List(Atom.create(Predicate.create("owl:sameAs"),vars(0),vars(1))), + List(Atom.create(TupleTableName.create("owl:sameAs"),vars(0),vars(1))), classResult.res ++ propertyResult ) } diff --git a/src/main/scala/rsacomb/RDFoxPropertyExprConverter.scala b/src/main/scala/rsacomb/RDFoxPropertyExprConverter.scala index 2885ed9..8d472bf 100644 --- a/src/main/scala/rsacomb/RDFoxPropertyExprConverter.scala +++ b/src/main/scala/rsacomb/RDFoxPropertyExprConverter.scala @@ -3,7 +3,8 @@ package rsacomb import org.semanticweb.owlapi.model.{OWLPropertyExpression, OWLObjectProperty} import org.semanticweb.owlapi.model.OWLPropertyExpressionVisitorEx -import tech.oxfordsemantic.jrdfox.logic.{Atom, Predicate, Term, Variable, Literal} +import tech.oxfordsemantic.jrdfox.logic.{TupleTableName} +import tech.oxfordsemantic.jrdfox.logic.{Atom, Term, Variable, Literal} import rsacomb.SkolemStrategy @@ -14,7 +15,7 @@ class RDFoxPropertyExprConverter(term1 : Term, term2 : Term, skolem : SkolemStra override def visit(expr : OWLObjectProperty) : List[Atom] = { val name = expr.getIRI.getIRIString - List(Atom.create(Predicate.create(name), term1, term2)) + List(Atom.create(TupleTableName.create(name), term1, term2)) } def doDefault(expr : OWLPropertyExpression) : List[Atom] = List() diff --git a/src/main/scala/rsacomb/RDFoxRuleShards.scala b/src/main/scala/rsacomb/RDFoxRuleShards.scala index bce31d2..8f72983 100644 --- a/src/main/scala/rsacomb/RDFoxRuleShards.scala +++ b/src/main/scala/rsacomb/RDFoxRuleShards.scala @@ -1,6 +1,6 @@ package rsacomb -import tech.oxfordsemantic.jrdfox.logic.{Rule, Atom, Literal} +import tech.oxfordsemantic.jrdfox.logic.{Atom, BodyFormula} -case class RDFoxRuleShards(res : List[Atom], ext : List[Literal]) +case class RDFoxRuleShards(res : List[Atom], ext : List[BodyFormula]) diff --git a/src/main/scala/rsacomb/RSAComb.scala b/src/main/scala/rsacomb/RSAComb.scala index bc94a8d..16d7a04 100644 --- a/src/main/scala/rsacomb/RSAComb.scala +++ b/src/main/scala/rsacomb/RSAComb.scala @@ -15,8 +15,9 @@ import org.semanticweb.owlapi.model.parameters.Imports import tech.oxfordsemantic.jrdfox.Prefixes import tech.oxfordsemantic.jrdfox.client.{ConnectionFactory, ServerConnection, DataStoreConnection} import tech.oxfordsemantic.jrdfox.client.UpdateType -import tech.oxfordsemantic.jrdfox.logic.{Rule, Atom, Literal, Predicate, Term, Variable} -import tech.oxfordsemantic.jrdfox.logic.{Bind, BuiltinFunctionCall} +import tech.oxfordsemantic.jrdfox.logic.{Rule, Atom, Literal, Term, Variable} +import tech.oxfordsemantic.jrdfox.logic.{BuiltinFunctionCall, TupleTableName} +import tech.oxfordsemantic.jrdfox.logic.{LogicFormat} import scala.collection.JavaConverters._ @@ -46,6 +47,9 @@ object RSA { * 2) call RDFox on the onto and compute materialization * 3) build graph from E(x,y) facts * 4) check if the graph is tree-like + * ideally this annotates the graph with info about the reasons + * why the ontology might not be RSA. This could help a second + * step of approximation of an Horn-ALCHOIQ to RSA */ /* Ontology axiom convertion into LP rules */ -- cgit v1.2.3