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/test/scala/rsacomb | |
parent | 95fa2a0090110a90d9a0f4948a4ced252d8ec111 (diff) | |
download | RSAComb-633529ca7a911646048886b7e2e0d1d98c94fdf3.tar.gz RSAComb-633529ca7a911646048886b7e2e0d1d98c94fdf3.zip |
Update to JRDFox v3.1.0
Diffstat (limited to 'src/test/scala/rsacomb')
-rw-r--r-- | src/test/scala/rsacomb/OWLAxiomSpec.scala | 60 | ||||
-rw-r--r-- | src/test/scala/rsacomb/OWLClassSpec.scala | 24 |
2 files changed, 42 insertions, 42 deletions
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 { |