diff options
Diffstat (limited to 'src/test/scala/rsacomb/OWLAxiomSpec.scala')
-rw-r--r-- | src/test/scala/rsacomb/OWLAxiomSpec.scala | 60 |
1 files changed, 30 insertions, 30 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 | ||