aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/rsacomb
diff options
context:
space:
mode:
authorFederico Igne <federico.igne@cs.ox.ac.uk>2020-07-16 17:47:32 +0100
committerFederico Igne <federico.igne@cs.ox.ac.uk>2020-07-16 17:47:32 +0100
commit633529ca7a911646048886b7e2e0d1d98c94fdf3 (patch)
tree3137cdb01f023f5d345e32a07f1b60c165a519b5 /src/main/scala/rsacomb
parent95fa2a0090110a90d9a0f4948a4ced252d8ec111 (diff)
downloadRSAComb-633529ca7a911646048886b7e2e0d1d98c94fdf3.tar.gz
RSAComb-633529ca7a911646048886b7e2e0d1d98c94fdf3.zip
Update to JRDFox v3.1.0
Diffstat (limited to 'src/main/scala/rsacomb')
-rw-r--r--src/main/scala/rsacomb/RDFoxAxiomConverter.scala4
-rw-r--r--src/main/scala/rsacomb/RDFoxClassExprConverter.scala14
-rw-r--r--src/main/scala/rsacomb/RDFoxPropertyExprConverter.scala5
-rw-r--r--src/main/scala/rsacomb/RDFoxRuleShards.scala4
-rw-r--r--src/main/scala/rsacomb/RSAComb.scala8
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
3import org.semanticweb.owlapi.model.{OWLAxiom, OWLSubClassOfAxiom, OWLEquivalentClassesAxiom} 3import org.semanticweb.owlapi.model.{OWLAxiom, OWLSubClassOfAxiom, OWLEquivalentClassesAxiom}
4import org.semanticweb.owlapi.model.OWLAxiomVisitorEx 4import org.semanticweb.owlapi.model.OWLAxiomVisitorEx
5 5
6import tech.oxfordsemantic.jrdfox.logic.Rule 6import tech.oxfordsemantic.jrdfox.logic.{Rule, BodyFormula}
7import tech.oxfordsemantic.jrdfox.logic.{Atom, Term, Literal, Individual} 7import tech.oxfordsemantic.jrdfox.logic.{Atom, Term, Literal}
8 8
9import scala.collection.JavaConverters._ 9import 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
6import org.semanticweb.owlapi.model.{OWLClassExpression, OWLClass, OWLObjectSomeValuesFrom, OWLObjectIntersectionOf, OWLObjectOneOf, OWLObjectMaxCardinality} 6import org.semanticweb.owlapi.model.{OWLClassExpression, OWLClass, OWLObjectSomeValuesFrom, OWLObjectIntersectionOf, OWLObjectOneOf, OWLObjectMaxCardinality}
7import org.semanticweb.owlapi.model.OWLClassExpressionVisitorEx 7import org.semanticweb.owlapi.model.OWLClassExpressionVisitorEx
8import tech.oxfordsemantic.jrdfox.logic.{AtomicFormula, Bind,BuiltinFunctionCall} 8import tech.oxfordsemantic.jrdfox.logic.{BindAtom, BuiltinFunctionCall, TupleTableName}
9import tech.oxfordsemantic.jrdfox.logic.{Atom, Predicate, Term, Variable, Literal, Individual} 9import tech.oxfordsemantic.jrdfox.logic.{Atom, Term, Variable, Literal, Datatype}
10 10
11import rsacomb.SkolemStrategy 11import rsacomb.SkolemStrategy
12import rsacomb.RDFoxRuleShards 12import 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
3import org.semanticweb.owlapi.model.{OWLPropertyExpression, OWLObjectProperty} 3import org.semanticweb.owlapi.model.{OWLPropertyExpression, OWLObjectProperty}
4import org.semanticweb.owlapi.model.OWLPropertyExpressionVisitorEx 4import org.semanticweb.owlapi.model.OWLPropertyExpressionVisitorEx
5 5
6import tech.oxfordsemantic.jrdfox.logic.{Atom, Predicate, Term, Variable, Literal} 6import tech.oxfordsemantic.jrdfox.logic.{TupleTableName}
7import tech.oxfordsemantic.jrdfox.logic.{Atom, Term, Variable, Literal}
7 8
8import rsacomb.SkolemStrategy 9import 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 @@
1package rsacomb 1package rsacomb
2 2
3import tech.oxfordsemantic.jrdfox.logic.{Rule, Atom, Literal} 3import tech.oxfordsemantic.jrdfox.logic.{Atom, BodyFormula}
4 4
5case class RDFoxRuleShards(res : List[Atom], ext : List[Literal]) 5case 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
15import tech.oxfordsemantic.jrdfox.Prefixes 15import tech.oxfordsemantic.jrdfox.Prefixes
16import tech.oxfordsemantic.jrdfox.client.{ConnectionFactory, ServerConnection, DataStoreConnection} 16import tech.oxfordsemantic.jrdfox.client.{ConnectionFactory, ServerConnection, DataStoreConnection}
17import tech.oxfordsemantic.jrdfox.client.UpdateType 17import tech.oxfordsemantic.jrdfox.client.UpdateType
18import tech.oxfordsemantic.jrdfox.logic.{Rule, Atom, Literal, Predicate, Term, Variable} 18import tech.oxfordsemantic.jrdfox.logic.{Rule, Atom, Literal, Term, Variable}
19import tech.oxfordsemantic.jrdfox.logic.{Bind, BuiltinFunctionCall} 19import tech.oxfordsemantic.jrdfox.logic.{BuiltinFunctionCall, TupleTableName}
20import tech.oxfordsemantic.jrdfox.logic.{LogicFormat}
20 21
21import scala.collection.JavaConverters._ 22import 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 */