diff options
Diffstat (limited to 'src')
-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 | ||||
-rw-r--r-- | src/test/scala/rsacomb/OWLAxiomSpec.scala | 60 | ||||
-rw-r--r-- | src/test/scala/rsacomb/OWLClassSpec.scala | 24 |
7 files changed, 62 insertions, 57 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 */ |
diff --git a/src/test/scala/rsacomb/OWLAxiomSpec.scala b/src/test/scala/rsacomb/OWLAxiomSpec.scala index b6a44f4..8238536 100644 --- a/src/test/scala/rsacomb/OWLAxiomSpec.scala +++ b/src/test/scala/rsacomb/OWLAxiomSpec.scala | |||
@@ -8,8 +8,8 @@ import uk.ac.manchester.cs.owl.owlapi.{OWLClassImpl, OWLObjectSomeValuesFromImpl | |||
8 | import uk.ac.manchester.cs.owl.owlapi.{OWLObjectPropertyImpl} | 8 | import uk.ac.manchester.cs.owl.owlapi.{OWLObjectPropertyImpl} |
9 | import org.semanticweb.owlapi.model.{OWLAxiom,IRI} | 9 | import org.semanticweb.owlapi.model.{OWLAxiom,IRI} |
10 | 10 | ||
11 | import tech.oxfordsemantic.jrdfox.logic.{Rule,Bind,BuiltinFunctionCall} | 11 | import tech.oxfordsemantic.jrdfox.logic.{Rule,BindAtom,BuiltinFunctionCall} |
12 | import tech.oxfordsemantic.jrdfox.logic.{Atom, Predicate, Term, Variable, Individual} | 12 | import tech.oxfordsemantic.jrdfox.logic.{Atom, TupleTableName, Term, Variable, Literal, Datatype} |
13 | 13 | ||
14 | object OWLAxiomSpec { | 14 | object OWLAxiomSpec { |
15 | 15 | ||
@@ -28,14 +28,14 @@ object OWLAxiomSpec { | |||
28 | val term_x = Variable.create("x") | 28 | val term_x = Variable.create("x") |
29 | val term_y = Variable.create("y") | 29 | val term_y = Variable.create("y") |
30 | val term_z = Variable.create("z") | 30 | val term_z = Variable.create("z") |
31 | val term_c1 = Individual.create("internal:c_1") | 31 | val term_c1 = Literal.create("internal:c_1", Datatype.IRI_REFERENCE) |
32 | val term_c2 = Individual.create("internal:c_2") | 32 | val term_c2 = Literal.create("internal:c_2", Datatype.IRI_REFERENCE) |
33 | val term_alice = Individual.create("univ:alice") | 33 | val term_alice = Literal.create("univ:alice", Datatype.IRI_REFERENCE) |
34 | 34 | ||
35 | // RDFox Predicates | 35 | // RDFox Predicates |
36 | val pred_sameAs = Predicate.create("owl:sameAs") | 36 | val pred_sameAs = TupleTableName.create("owl:sameAs") |
37 | val pred_Professor = Predicate.create(iri_Professor.getIRIString) | 37 | val pred_Professor = TupleTableName.create(iri_Professor.getIRIString) |
38 | val pred_hasSupervisor = Predicate.create(iri_hasSupervisor.getIRIString) | 38 | val pred_hasSupervisor = TupleTableName.create(iri_hasSupervisor.getIRIString) |
39 | 39 | ||
40 | // OWL Classes | 40 | // OWL Classes |
41 | // Name Class corresponding to | 41 | // Name Class corresponding to |
@@ -164,15 +164,15 @@ class OWLAxiomSpec | |||
164 | it should "contain a conjuction of atoms (Student[?x],Worker[?x]) in the body of the rule" in { | 164 | it should "contain a conjuction of atoms (Student[?x],Worker[?x]) in the body of the rule" in { |
165 | val result = convertAxiom(axiom_OWLSubClassOf1,term_x) | 165 | val result = convertAxiom(axiom_OWLSubClassOf1,term_x) |
166 | val body = List( | 166 | val body = List( |
167 | Atom.create(Predicate.create(iri_Student.getIRIString),term_x), | 167 | Atom.create(TupleTableName.create(iri_Student.getIRIString),term_x), |
168 | Atom.create(Predicate.create(iri_Worker.getIRIString),term_x) | 168 | Atom.create(TupleTableName.create(iri_Worker.getIRIString),term_x) |
169 | ) | 169 | ) |
170 | result.loneElement.getBody should contain theSameElementsAs body | 170 | result.loneElement.getBody should contain theSameElementsAs body |
171 | } | 171 | } |
172 | 172 | ||
173 | it should "contain a single atom (PartTimeStudent[?x]) in the head of the rule" in { | 173 | it should "contain a single atom (PartTimeStudent[?x]) in the head of the rule" in { |
174 | val result = convertAxiom(axiom_OWLSubClassOf1,term_x) | 174 | val result = convertAxiom(axiom_OWLSubClassOf1,term_x) |
175 | val head = Atom.create(Predicate.create(iri_PartTimeStudent.getIRIString),term_x) | 175 | val head = Atom.create(TupleTableName.create(iri_PartTimeStudent.getIRIString),term_x) |
176 | result.loneElement.getHead.loneElement should be (head) | 176 | result.loneElement.getHead.loneElement should be (head) |
177 | } | 177 | } |
178 | 178 | ||
@@ -188,17 +188,17 @@ class OWLAxiomSpec | |||
188 | it should "contain a single atom (Student[?x]) in the body of the rule" in { | 188 | it should "contain a single atom (Student[?x]) in the body of the rule" in { |
189 | val skolem = SkolemStrategy.Constant(axiom_OWLSubClassOf2.toString) | 189 | val skolem = SkolemStrategy.Constant(axiom_OWLSubClassOf2.toString) |
190 | val result = convertAxiom(axiom_OWLSubClassOf2,term_x,skolem) | 190 | val result = convertAxiom(axiom_OWLSubClassOf2,term_x,skolem) |
191 | val body = Atom.create(Predicate.create(iri_Student.getIRIString),term_x) | 191 | val body = Atom.create(TupleTableName.create(iri_Student.getIRIString),term_x) |
192 | result.loneElement.getBody.loneElement should equal (body) | 192 | result.loneElement.getBody.loneElement should equal (body) |
193 | } | 193 | } |
194 | 194 | ||
195 | it should "contain a conjuction of atoms (hasSupervisor[?x,?c],Professor[?c]) in the head of the rule" in { | 195 | it should "contain a conjuction of atoms (hasSupervisor[?x,?c],Professor[?c]) in the head of the rule" in { |
196 | val skolem = SkolemStrategy.Constant(axiom_OWLSubClassOf2.toString) | 196 | val skolem = SkolemStrategy.Constant(axiom_OWLSubClassOf2.toString) |
197 | val result = convertAxiom(axiom_OWLSubClassOf2,term_x,skolem) | 197 | val result = convertAxiom(axiom_OWLSubClassOf2,term_x,skolem) |
198 | val term_c = Individual.create(skolem.const) | 198 | val term_c = Literal.create(skolem.const, Datatype.IRI_REFERENCE) |
199 | val head = List( | 199 | val head = List( |
200 | Atom.create(Predicate.create(iri_hasSupervisor.getIRIString),term_x,term_c), | 200 | Atom.create(TupleTableName.create(iri_hasSupervisor.getIRIString),term_x,term_c), |
201 | Atom.create(Predicate.create(iri_Professor.getIRIString),term_c) | 201 | Atom.create(TupleTableName.create(iri_Professor.getIRIString),term_c) |
202 | ) | 202 | ) |
203 | result.loneElement.getHead should contain theSameElementsAs (head) | 203 | result.loneElement.getHead should contain theSameElementsAs (head) |
204 | } | 204 | } |
@@ -215,14 +215,14 @@ class OWLAxiomSpec | |||
215 | it should "contain an atom (Student[?x]) in the body of the rule" in { | 215 | it should "contain an atom (Student[?x]) in the body of the rule" in { |
216 | val skolem = SkolemStrategy.Standard(axiom_OWLSubClassOf2.toString) | 216 | val skolem = SkolemStrategy.Standard(axiom_OWLSubClassOf2.toString) |
217 | val result = convertAxiom(axiom_OWLSubClassOf2, term_x, skolem) | 217 | val result = convertAxiom(axiom_OWLSubClassOf2, term_x, skolem) |
218 | val body = Atom.create(Predicate.create(iri_Student.getIRIString),term_x) | 218 | val body = Atom.create(TupleTableName.create(iri_Student.getIRIString),term_x) |
219 | result.loneElement.getBody should contain (body) | 219 | result.loneElement.getBody should contain (body) |
220 | } | 220 | } |
221 | 221 | ||
222 | it should "contain a built-in function call (BIND(?y,SKOLEM(?f,?x))) in the body of the rule" in { | 222 | it should "contain a built-in function call (BIND(?y,SKOLEM(?f,?x))) in the body of the rule" in { |
223 | val skolem = SkolemStrategy.Standard(axiom_OWLSubClassOf2.toString) | 223 | val skolem = SkolemStrategy.Standard(axiom_OWLSubClassOf2.toString) |
224 | val result = convertAxiom(axiom_OWLSubClassOf2, term_x, skolem) | 224 | val result = convertAxiom(axiom_OWLSubClassOf2, term_x, skolem) |
225 | val call = Bind.create(BuiltinFunctionCall.create("SKOLEM",term_x),term_y) | 225 | val call = BindAtom.create(BuiltinFunctionCall.create("SKOLEM",term_x),term_y) |
226 | result.loneElement.getBody should contain (call) | 226 | result.loneElement.getBody should contain (call) |
227 | } | 227 | } |
228 | 228 | ||
@@ -230,8 +230,8 @@ class OWLAxiomSpec | |||
230 | val skolem = SkolemStrategy.Standard(axiom_OWLSubClassOf2.toString) | 230 | val skolem = SkolemStrategy.Standard(axiom_OWLSubClassOf2.toString) |
231 | val result = convertAxiom(axiom_OWLSubClassOf2, term_x, skolem) | 231 | val result = convertAxiom(axiom_OWLSubClassOf2, term_x, skolem) |
232 | val head = List( | 232 | val head = List( |
233 | Atom.create(Predicate.create(iri_hasSupervisor.getIRIString),term_x,term_y), | 233 | Atom.create(TupleTableName.create(iri_hasSupervisor.getIRIString),term_x,term_y), |
234 | Atom.create(Predicate.create(iri_Professor.getIRIString),term_y) | 234 | Atom.create(TupleTableName.create(iri_Professor.getIRIString),term_y) |
235 | ) | 235 | ) |
236 | result.loneElement.getHead should contain theSameElementsAs head | 236 | result.loneElement.getHead should contain theSameElementsAs head |
237 | } | 237 | } |
@@ -245,15 +245,15 @@ class OWLAxiomSpec | |||
245 | it should "contain a conjunction of atoms (hasSupervisor[?x,?y],Professor[?y]) in the body of the rule" in { | 245 | it should "contain a conjunction of atoms (hasSupervisor[?x,?y],Professor[?y]) in the body of the rule" in { |
246 | val result = convertAxiom(axiom_OWLSubClassOf3,term_x) | 246 | val result = convertAxiom(axiom_OWLSubClassOf3,term_x) |
247 | val body = List( | 247 | val body = List( |
248 | Atom.create(Predicate.create(iri_hasSupervisor.getIRIString),term_x,term_y), | 248 | Atom.create(TupleTableName.create(iri_hasSupervisor.getIRIString),term_x,term_y), |
249 | Atom.create(Predicate.create(iri_Professor.getIRIString),term_y) | 249 | Atom.create(TupleTableName.create(iri_Professor.getIRIString),term_y) |
250 | ) | 250 | ) |
251 | result.loneElement.getBody should contain theSameElementsAs body | 251 | result.loneElement.getBody should contain theSameElementsAs body |
252 | } | 252 | } |
253 | 253 | ||
254 | it should "contain a single atom (Student[?x]) in the head of the rule" in { | 254 | it should "contain a single atom (Student[?x]) in the head of the rule" in { |
255 | val result = convertAxiom(axiom_OWLSubClassOf3, term_x) | 255 | val result = convertAxiom(axiom_OWLSubClassOf3, term_x) |
256 | val head = Atom.create(Predicate.create(iri_Student.getIRIString),term_x) | 256 | val head = Atom.create(TupleTableName.create(iri_Student.getIRIString),term_x) |
257 | result.loneElement.getHead.loneElement should be (head) | 257 | result.loneElement.getHead.loneElement should be (head) |
258 | } | 258 | } |
259 | 259 | ||
@@ -265,13 +265,13 @@ class OWLAxiomSpec | |||
265 | 265 | ||
266 | it should "contain a single atoms (Student[?x]) in the body of the rule" in { | 266 | it should "contain a single atoms (Student[?x]) in the body of the rule" in { |
267 | val result = convertAxiom(axiom_OWLSubClassOf4,term_x) | 267 | val result = convertAxiom(axiom_OWLSubClassOf4,term_x) |
268 | val body = Atom.create(Predicate.create(iri_Student.getIRIString),term_x) | 268 | val body = Atom.create(TupleTableName.create(iri_Student.getIRIString),term_x) |
269 | result.loneElement.getBody.loneElement should be (body) | 269 | result.loneElement.getBody.loneElement should be (body) |
270 | } | 270 | } |
271 | 271 | ||
272 | it should "contain a single atom (sameAs[?x,alice])) in the head of the rule" in { | 272 | it should "contain a single atom (sameAs[?x,alice])) in the head of the rule" in { |
273 | val result = convertAxiom(axiom_OWLSubClassOf4, term_x) | 273 | val result = convertAxiom(axiom_OWLSubClassOf4, term_x) |
274 | val head = Atom.create(Predicate.create(iri_sameAs.getIRIString),term_x,term_alice) | 274 | val head = Atom.create(TupleTableName.create(iri_sameAs.getIRIString),term_x,term_alice) |
275 | result.loneElement.getHead.loneElement should be (head) | 275 | result.loneElement.getHead.loneElement should be (head) |
276 | } | 276 | } |
277 | 277 | ||
@@ -284,18 +284,18 @@ class OWLAxiomSpec | |||
284 | it should "contain a conjunction of atoms (...) in the body of the rule" in { | 284 | it should "contain a conjunction of atoms (...) in the body of the rule" in { |
285 | val result = convertAxiom(axiom_OWLSubClassOf5,term_x) | 285 | val result = convertAxiom(axiom_OWLSubClassOf5,term_x) |
286 | val body = List( | 286 | val body = List( |
287 | Atom.create(Predicate.create(iri_Student.getIRIString),term_x), | 287 | Atom.create(TupleTableName.create(iri_Student.getIRIString),term_x), |
288 | Atom.create(Predicate.create(iri_hasSupervisor.getIRIString),term_x,term_y), | 288 | Atom.create(TupleTableName.create(iri_hasSupervisor.getIRIString),term_x,term_y), |
289 | Atom.create(Predicate.create(iri_Professor.getIRIString),term_y), | 289 | Atom.create(TupleTableName.create(iri_Professor.getIRIString),term_y), |
290 | Atom.create(Predicate.create(iri_hasSupervisor.getIRIString),term_x,term_z), | 290 | Atom.create(TupleTableName.create(iri_hasSupervisor.getIRIString),term_x,term_z), |
291 | Atom.create(Predicate.create(iri_Professor.getIRIString),term_z) | 291 | Atom.create(TupleTableName.create(iri_Professor.getIRIString),term_z) |
292 | ) | 292 | ) |
293 | result.loneElement.getBody should contain theSameElementsAs body | 293 | result.loneElement.getBody should contain theSameElementsAs body |
294 | } | 294 | } |
295 | 295 | ||
296 | it should "contain a single atom (sameAs[?x,?z])) in the head of the rule" in { | 296 | it should "contain a single atom (sameAs[?x,?z])) in the head of the rule" in { |
297 | val result = convertAxiom(axiom_OWLSubClassOf5, term_x) | 297 | val result = convertAxiom(axiom_OWLSubClassOf5, term_x) |
298 | val head = Atom.create(Predicate.create(iri_sameAs.getIRIString),term_y,term_z) | 298 | val head = Atom.create(TupleTableName.create(iri_sameAs.getIRIString),term_y,term_z) |
299 | result.loneElement.getHead.loneElement should be (head) | 299 | result.loneElement.getHead.loneElement should be (head) |
300 | } | 300 | } |
301 | 301 | ||
diff --git a/src/test/scala/rsacomb/OWLClassSpec.scala b/src/test/scala/rsacomb/OWLClassSpec.scala index df10e19..98e14cf 100644 --- a/src/test/scala/rsacomb/OWLClassSpec.scala +++ b/src/test/scala/rsacomb/OWLClassSpec.scala | |||
@@ -6,8 +6,8 @@ import uk.ac.manchester.cs.owl.owlapi.{OWLClassImpl, OWLObjectSomeValuesFromImpl | |||
6 | import uk.ac.manchester.cs.owl.owlapi.{OWLObjectPropertyImpl} | 6 | import uk.ac.manchester.cs.owl.owlapi.{OWLObjectPropertyImpl} |
7 | import org.semanticweb.owlapi.model.IRI | 7 | import org.semanticweb.owlapi.model.IRI |
8 | 8 | ||
9 | import tech.oxfordsemantic.jrdfox.logic.{Bind,BuiltinFunctionCall} | 9 | import tech.oxfordsemantic.jrdfox.logic.{BindAtom,BuiltinFunctionCall} |
10 | import tech.oxfordsemantic.jrdfox.logic.{Atom, Predicate, Term, Variable, Individual} | 10 | import tech.oxfordsemantic.jrdfox.logic.{Atom, TupleTableName, Term, Variable, Literal, Datatype} |
11 | 11 | ||
12 | import rsacomb.RDFoxRuleShards | 12 | import rsacomb.RDFoxRuleShards |
13 | 13 | ||
@@ -25,14 +25,14 @@ object OWLClassSpec { | |||
25 | // RDFox Terms | 25 | // RDFox Terms |
26 | val term_x = Variable.create("x") | 26 | val term_x = Variable.create("x") |
27 | val term_y = Variable.create("y") | 27 | val term_y = Variable.create("y") |
28 | val term_c1 = Individual.create("internal:c_1") | 28 | val term_c1 = Literal.create("internal:c_1", Datatype.IRI_REFERENCE) |
29 | val term_c2 = Individual.create("internal:c_2") | 29 | val term_c2 = Literal.create("internal:c_2", Datatype.IRI_REFERENCE) |
30 | val term_alice = Individual.create("univ:alice") | 30 | val term_alice = Literal.create("univ:alice", Datatype.IRI_REFERENCE) |
31 | 31 | ||
32 | // RDFox Predicates | 32 | // RDFox Predicates |
33 | val pred_sameAs = Predicate.create("owl:sameAs") | 33 | val pred_sameAs = TupleTableName.create("owl:sameAs") |
34 | val pred_Professor = Predicate.create(iri_Professor.getIRIString) | 34 | val pred_Professor = TupleTableName.create(iri_Professor.getIRIString) |
35 | val pred_hasSupervisor = Predicate.create(iri_hasSupervisor.getIRIString) | 35 | val pred_hasSupervisor = TupleTableName.create(iri_hasSupervisor.getIRIString) |
36 | 36 | ||
37 | // OWL Classes | 37 | // OWL Classes |
38 | // Name Class corresponding to | 38 | // Name Class corresponding to |
@@ -135,7 +135,7 @@ class OWLClassSpec | |||
135 | it should "be converted into a single <owl:sameAs> Atom" in { | 135 | it should "be converted into a single <owl:sameAs> Atom" in { |
136 | val visitor = RDFoxClassExprConverter(term_x) | 136 | val visitor = RDFoxClassExprConverter(term_x) |
137 | val result = class_OWLObjectOneOf.accept(visitor) | 137 | val result = class_OWLObjectOneOf.accept(visitor) |
138 | result.res.loneElement should (be (a [Atom]) and have ('predicate (pred_sameAs))) | 138 | result.res.loneElement should (be (a [Atom]) and have ('tupleTableName (pred_sameAs))) |
139 | } | 139 | } |
140 | 140 | ||
141 | it should "have an empty extension list" in { | 141 | it should "have an empty extension list" in { |
@@ -196,8 +196,8 @@ class OWLClassSpec | |||
196 | val skolem = SkolemStrategy.Standard(class_OWLObjectSomeValuesFrom.toString) | 196 | val skolem = SkolemStrategy.Standard(class_OWLObjectSomeValuesFrom.toString) |
197 | val visitor = RDFoxClassExprConverter(term_x,skolem) | 197 | val visitor = RDFoxClassExprConverter(term_x,skolem) |
198 | val result = class_OWLObjectSomeValuesFrom.accept(visitor) | 198 | val result = class_OWLObjectSomeValuesFrom.accept(visitor) |
199 | result.ext.loneElement shouldBe a [Bind] | 199 | result.ext.loneElement shouldBe a [BindAtom] |
200 | val builtin = result.ext.head.asInstanceOf[Bind].getBuiltinExpression | 200 | val builtin = result.ext.head.asInstanceOf[BindAtom].getBuiltinExpression |
201 | builtin should (be (a [BuiltinFunctionCall]) and have ('functionName ("SKOLEM"))) | 201 | builtin should (be (a [BuiltinFunctionCall]) and have ('functionName ("SKOLEM"))) |
202 | } | 202 | } |
203 | 203 | ||
@@ -241,7 +241,7 @@ class OWLClassSpec | |||
241 | it should "have a single <owl:sameAs> Atom in the result list" in { | 241 | it should "have a single <owl:sameAs> Atom in the result list" in { |
242 | val visitor = RDFoxClassExprConverter(term_x) | 242 | val visitor = RDFoxClassExprConverter(term_x) |
243 | val result = class_OWLObjectMaxCardinality.accept(visitor) | 243 | val result = class_OWLObjectMaxCardinality.accept(visitor) |
244 | result.res.loneElement should (be (an [Atom]) and have ('predicate (pred_sameAs))) | 244 | result.res.loneElement should (be (an [Atom]) and have ('tupleTableName (pred_sameAs))) |
245 | } | 245 | } |
246 | 246 | ||
247 | it should "have two unary Atoms in its extension list" in { | 247 | it should "have two unary Atoms in its extension list" in { |