diff options
| author | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-07-16 17:47:32 +0100 |
|---|---|---|
| committer | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-07-16 17:47:32 +0100 |
| commit | 633529ca7a911646048886b7e2e0d1d98c94fdf3 (patch) | |
| tree | 3137cdb01f023f5d345e32a07f1b60c165a519b5 /src/main/scala | |
| parent | 95fa2a0090110a90d9a0f4948a4ced252d8ec111 (diff) | |
| download | RSAComb-633529ca7a911646048886b7e2e0d1d98c94fdf3.tar.gz RSAComb-633529ca7a911646048886b7e2e0d1d98c94fdf3.zip | |
Update to JRDFox v3.1.0
Diffstat (limited to 'src/main/scala')
| -rw-r--r-- | src/main/scala/rsacomb/RDFoxAxiomConverter.scala | 4 | ||||
| -rw-r--r-- | src/main/scala/rsacomb/RDFoxClassExprConverter.scala | 14 | ||||
| -rw-r--r-- | src/main/scala/rsacomb/RDFoxPropertyExprConverter.scala | 5 | ||||
| -rw-r--r-- | src/main/scala/rsacomb/RDFoxRuleShards.scala | 4 | ||||
| -rw-r--r-- | src/main/scala/rsacomb/RSAComb.scala | 8 |
5 files changed, 20 insertions, 15 deletions
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 | |||
| 3 | import org.semanticweb.owlapi.model.{OWLAxiom, OWLSubClassOfAxiom, OWLEquivalentClassesAxiom} | 3 | import org.semanticweb.owlapi.model.{OWLAxiom, OWLSubClassOfAxiom, OWLEquivalentClassesAxiom} |
| 4 | import org.semanticweb.owlapi.model.OWLAxiomVisitorEx | 4 | import org.semanticweb.owlapi.model.OWLAxiomVisitorEx |
| 5 | 5 | ||
| 6 | import tech.oxfordsemantic.jrdfox.logic.Rule | 6 | import tech.oxfordsemantic.jrdfox.logic.{Rule, BodyFormula} |
| 7 | import tech.oxfordsemantic.jrdfox.logic.{Atom, Term, Literal, Individual} | 7 | import tech.oxfordsemantic.jrdfox.logic.{Atom, Term, Literal} |
| 8 | 8 | ||
| 9 | import scala.collection.JavaConverters._ | 9 | import scala.collection.JavaConverters._ |
| 10 | 10 | ||
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} | |||
| 5 | 5 | ||
| 6 | import org.semanticweb.owlapi.model.{OWLClassExpression, OWLClass, OWLObjectSomeValuesFrom, OWLObjectIntersectionOf, OWLObjectOneOf, OWLObjectMaxCardinality} | 6 | import org.semanticweb.owlapi.model.{OWLClassExpression, OWLClass, OWLObjectSomeValuesFrom, OWLObjectIntersectionOf, OWLObjectOneOf, OWLObjectMaxCardinality} |
| 7 | import org.semanticweb.owlapi.model.OWLClassExpressionVisitorEx | 7 | import org.semanticweb.owlapi.model.OWLClassExpressionVisitorEx |
| 8 | import tech.oxfordsemantic.jrdfox.logic.{AtomicFormula, Bind,BuiltinFunctionCall} | 8 | import tech.oxfordsemantic.jrdfox.logic.{BindAtom, BuiltinFunctionCall, TupleTableName} |
| 9 | import tech.oxfordsemantic.jrdfox.logic.{Atom, Predicate, Term, Variable, Literal, Individual} | 9 | import tech.oxfordsemantic.jrdfox.logic.{Atom, Term, Variable, Literal, Datatype} |
| 10 | 10 | ||
| 11 | import rsacomb.SkolemStrategy | 11 | import rsacomb.SkolemStrategy |
| 12 | import rsacomb.RDFoxRuleShards | 12 | import rsacomb.RDFoxRuleShards |
| @@ -39,7 +39,7 @@ class RDFoxClassExprConverter(term : Term, skolem : SkolemStrategy) | |||
| 39 | override | 39 | override |
| 40 | def visit(expr : OWLClass) : RDFoxRuleShards = { | 40 | def visit(expr : OWLClass) : RDFoxRuleShards = { |
| 41 | val name = expr.getIRI.getIRIString | 41 | val name = expr.getIRI.getIRIString |
| 42 | val atom = List(Atom.create(Predicate.create(name), term)) | 42 | val atom = List(Atom.create(TupleTableName.create(name), term)) |
| 43 | RDFoxRuleShards(atom,List()) | 43 | RDFoxRuleShards(atom,List()) |
| 44 | } | 44 | } |
| 45 | 45 | ||
| @@ -64,7 +64,7 @@ class RDFoxClassExprConverter(term : Term, skolem : SkolemStrategy) | |||
| 64 | .head // restricts to proper "nominals" | 64 | .head // restricts to proper "nominals" |
| 65 | .asOWLNamedIndividual.getIRI.getIRIString | 65 | .asOWLNamedIndividual.getIRI.getIRIString |
| 66 | val atom = List(Atom.create( | 66 | val atom = List(Atom.create( |
| 67 | Predicate.create("owl:sameAs"), term, Individual.create(ind) | 67 | TupleTableName.create("owl:sameAs"), term, Literal.create(ind, Datatype.IRI_REFERENCE) |
| 68 | )) | 68 | )) |
| 69 | RDFoxRuleShards(atom,List()) | 69 | RDFoxRuleShards(atom,List()) |
| 70 | } | 70 | } |
| @@ -77,12 +77,12 @@ class RDFoxClassExprConverter(term : Term, skolem : SkolemStrategy) | |||
| 77 | val y = Variable.create("y") | 77 | val y = Variable.create("y") |
| 78 | val (fun,term1) = skolem match { | 78 | val (fun,term1) = skolem match { |
| 79 | case SkolemStrategy.None => (List(),y) | 79 | case SkolemStrategy.None => (List(),y) |
| 80 | case SkolemStrategy.Constant(c) => (List(), Individual.create(c)) | 80 | case SkolemStrategy.Constant(c) => (List(), Literal.create(c, Datatype.IRI_REFERENCE)) |
| 81 | case SkolemStrategy.Standard(f) => | 81 | case SkolemStrategy.Standard(f) => |
| 82 | // At the time of writing the RDFox library does not have a | 82 | // At the time of writing the RDFox library does not have a |
| 83 | // particular class for the "SKOLEM" operator and it is instead | 83 | // particular class for the "SKOLEM" operator and it is instead |
| 84 | // a simple builtin function with a special name. | 84 | // a simple builtin function with a special name. |
| 85 | (List(Bind.create(BuiltinFunctionCall.create("SKOLEM",term),y)),y) | 85 | (List(BindAtom.create(BuiltinFunctionCall.create("SKOLEM",term),y)),y) |
| 86 | } | 86 | } |
| 87 | val classVisitor = new RDFoxClassExprConverter(term1,skolem) | 87 | val classVisitor = new RDFoxClassExprConverter(term1,skolem) |
| 88 | val classResult = expr.getFiller.accept(classVisitor) | 88 | val classResult = expr.getFiller.accept(classVisitor) |
| @@ -108,7 +108,7 @@ class RDFoxClassExprConverter(term : Term, skolem : SkolemStrategy) | |||
| 108 | .map(expr.getProperty.accept(_)) | 108 | .map(expr.getProperty.accept(_)) |
| 109 | .flatten | 109 | .flatten |
| 110 | RDFoxRuleShards( | 110 | RDFoxRuleShards( |
| 111 | List(Atom.create(Predicate.create("owl:sameAs"),vars(0),vars(1))), | 111 | List(Atom.create(TupleTableName.create("owl:sameAs"),vars(0),vars(1))), |
| 112 | classResult.res ++ propertyResult | 112 | classResult.res ++ propertyResult |
| 113 | ) | 113 | ) |
| 114 | } | 114 | } |
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 | |||
| 3 | import org.semanticweb.owlapi.model.{OWLPropertyExpression, OWLObjectProperty} | 3 | import org.semanticweb.owlapi.model.{OWLPropertyExpression, OWLObjectProperty} |
| 4 | import org.semanticweb.owlapi.model.OWLPropertyExpressionVisitorEx | 4 | import org.semanticweb.owlapi.model.OWLPropertyExpressionVisitorEx |
| 5 | 5 | ||
| 6 | import tech.oxfordsemantic.jrdfox.logic.{Atom, Predicate, Term, Variable, Literal} | 6 | import tech.oxfordsemantic.jrdfox.logic.{TupleTableName} |
| 7 | import tech.oxfordsemantic.jrdfox.logic.{Atom, Term, Variable, Literal} | ||
| 7 | 8 | ||
| 8 | import rsacomb.SkolemStrategy | 9 | import rsacomb.SkolemStrategy |
| 9 | 10 | ||
| @@ -14,7 +15,7 @@ class RDFoxPropertyExprConverter(term1 : Term, term2 : Term, skolem : SkolemStra | |||
| 14 | override | 15 | override |
| 15 | def visit(expr : OWLObjectProperty) : List[Atom] = { | 16 | def visit(expr : OWLObjectProperty) : List[Atom] = { |
| 16 | val name = expr.getIRI.getIRIString | 17 | val name = expr.getIRI.getIRIString |
| 17 | List(Atom.create(Predicate.create(name), term1, term2)) | 18 | List(Atom.create(TupleTableName.create(name), term1, term2)) |
| 18 | } | 19 | } |
| 19 | 20 | ||
| 20 | def doDefault(expr : OWLPropertyExpression) : List[Atom] = List() | 21 | 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 @@ | |||
| 1 | package rsacomb | 1 | package rsacomb |
| 2 | 2 | ||
| 3 | import tech.oxfordsemantic.jrdfox.logic.{Rule, Atom, Literal} | 3 | import tech.oxfordsemantic.jrdfox.logic.{Atom, BodyFormula} |
| 4 | 4 | ||
| 5 | case class RDFoxRuleShards(res : List[Atom], ext : List[Literal]) | 5 | case class RDFoxRuleShards(res : List[Atom], ext : List[BodyFormula]) |
| 6 | 6 | ||
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 | |||
| 15 | import tech.oxfordsemantic.jrdfox.Prefixes | 15 | import tech.oxfordsemantic.jrdfox.Prefixes |
| 16 | import tech.oxfordsemantic.jrdfox.client.{ConnectionFactory, ServerConnection, DataStoreConnection} | 16 | import tech.oxfordsemantic.jrdfox.client.{ConnectionFactory, ServerConnection, DataStoreConnection} |
| 17 | import tech.oxfordsemantic.jrdfox.client.UpdateType | 17 | import tech.oxfordsemantic.jrdfox.client.UpdateType |
| 18 | import tech.oxfordsemantic.jrdfox.logic.{Rule, Atom, Literal, Predicate, Term, Variable} | 18 | import tech.oxfordsemantic.jrdfox.logic.{Rule, Atom, Literal, Term, Variable} |
| 19 | import tech.oxfordsemantic.jrdfox.logic.{Bind, BuiltinFunctionCall} | 19 | import tech.oxfordsemantic.jrdfox.logic.{BuiltinFunctionCall, TupleTableName} |
| 20 | import tech.oxfordsemantic.jrdfox.logic.{LogicFormat} | ||
| 20 | 21 | ||
| 21 | import scala.collection.JavaConverters._ | 22 | import scala.collection.JavaConverters._ |
| 22 | 23 | ||
| @@ -46,6 +47,9 @@ object RSA { | |||
| 46 | * 2) call RDFox on the onto and compute materialization | 47 | * 2) call RDFox on the onto and compute materialization |
| 47 | * 3) build graph from E(x,y) facts | 48 | * 3) build graph from E(x,y) facts |
| 48 | * 4) check if the graph is tree-like | 49 | * 4) check if the graph is tree-like |
| 50 | * ideally this annotates the graph with info about the reasons | ||
| 51 | * why the ontology might not be RSA. This could help a second | ||
| 52 | * step of approximation of an Horn-ALCHOIQ to RSA | ||
| 49 | */ | 53 | */ |
| 50 | 54 | ||
| 51 | /* Ontology axiom convertion into LP rules */ | 55 | /* Ontology axiom convertion into LP rules */ |
