diff options
| author | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-11-05 20:33:13 +0000 |
|---|---|---|
| committer | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-11-05 20:33:13 +0000 |
| commit | afe0128a89a1d92fac8056bc356ba1dea8122925 (patch) | |
| tree | 5bb1e83b6268ee2abdc79aeced88676b7ab3d2f3 /src/test/scala/rsacomb/OWLAxiomSpec.scala | |
| parent | 360675d5b659ba8e9e5fe83dfa038d27f962b4de (diff) | |
| download | RSAComb-afe0128a89a1d92fac8056bc356ba1dea8122925.tar.gz RSAComb-afe0128a89a1d92fac8056bc356ba1dea8122925.zip | |
Update tests to RDFox v4.0
Diffstat (limited to 'src/test/scala/rsacomb/OWLAxiomSpec.scala')
| -rw-r--r-- | src/test/scala/rsacomb/OWLAxiomSpec.scala | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/src/test/scala/rsacomb/OWLAxiomSpec.scala b/src/test/scala/rsacomb/OWLAxiomSpec.scala index c685987..75803d8 100644 --- a/src/test/scala/rsacomb/OWLAxiomSpec.scala +++ b/src/test/scala/rsacomb/OWLAxiomSpec.scala | |||
| @@ -19,18 +19,22 @@ import uk.ac.manchester.cs.owl.owlapi.{ | |||
| 19 | import uk.ac.manchester.cs.owl.owlapi.{OWLObjectPropertyImpl} | 19 | import uk.ac.manchester.cs.owl.owlapi.{OWLObjectPropertyImpl} |
| 20 | import org.semanticweb.owlapi.model.{OWLAxiom} | 20 | import org.semanticweb.owlapi.model.{OWLAxiom} |
| 21 | 21 | ||
| 22 | import tech.oxfordsemantic.jrdfox.logic.{Rule, BindAtom, BuiltinFunctionCall} | 22 | import tech.oxfordsemantic.jrdfox.logic.Datatype |
| 23 | import tech.oxfordsemantic.jrdfox.logic.{ | 23 | import tech.oxfordsemantic.jrdfox.logic.datalog.{ |
| 24 | Atom, | 24 | Rule, |
| 25 | TupleTableName, | 25 | BindAtom, |
| 26 | TupleTableAtom, | ||
| 27 | TupleTableName | ||
| 28 | } | ||
| 29 | import tech.oxfordsemantic.jrdfox.logic.expression.{ | ||
| 30 | FunctionCall, | ||
| 26 | Term, | 31 | Term, |
| 27 | Variable, | 32 | Variable, |
| 28 | Literal, | 33 | Literal |
| 29 | Datatype | ||
| 30 | } | 34 | } |
| 31 | 35 | ||
| 32 | import org.semanticweb.owlapi.model.{IRI => OWLIRI} | 36 | import org.semanticweb.owlapi.model.{IRI => OWLIRI} |
| 33 | import tech.oxfordsemantic.jrdfox.logic.{IRI => RDFIRI} | 37 | import tech.oxfordsemantic.jrdfox.logic.expression.{IRI => RDFIRI} |
| 34 | 38 | ||
| 35 | object OWLAxiomSpec { | 39 | object OWLAxiomSpec { |
| 36 | 40 | ||
| @@ -188,15 +192,15 @@ class OWLAxiomSpec extends AnyFlatSpec with Matchers with LoneElement { | |||
| 188 | it should "contain a conjuction of atoms (Student[?x],Worker[?x]) in the body of the rule" in { | 192 | it should "contain a conjuction of atoms (Student[?x],Worker[?x]) in the body of the rule" in { |
| 189 | val result = convertAxiom(axiom_OWLSubClassOf1, term_x) | 193 | val result = convertAxiom(axiom_OWLSubClassOf1, term_x) |
| 190 | val body = List( | 194 | val body = List( |
| 191 | Atom.rdf(term_x, RDFIRI.RDF_TYPE, iri_Student), | 195 | TupleTableAtom.rdf(term_x, RDFIRI.RDF_TYPE, iri_Student), |
| 192 | Atom.rdf(term_x, RDFIRI.RDF_TYPE, iri_Worker) | 196 | TupleTableAtom.rdf(term_x, RDFIRI.RDF_TYPE, iri_Worker) |
| 193 | ) | 197 | ) |
| 194 | result.loneElement.getBody should contain theSameElementsAs body | 198 | result.loneElement.getBody should contain theSameElementsAs body |
| 195 | } | 199 | } |
| 196 | 200 | ||
| 197 | it should "contain a single atom (PartTimeStudent[?x]) in the head of the rule" in { | 201 | it should "contain a single atom (PartTimeStudent[?x]) in the head of the rule" in { |
| 198 | val result = convertAxiom(axiom_OWLSubClassOf1, term_x) | 202 | val result = convertAxiom(axiom_OWLSubClassOf1, term_x) |
| 199 | val head = Atom.rdf(term_x, RDFIRI.RDF_TYPE, iri_PartTimeStudent) | 203 | val head = TupleTableAtom.rdf(term_x, RDFIRI.RDF_TYPE, iri_PartTimeStudent) |
| 200 | result.loneElement.getHead.loneElement should be(head) | 204 | result.loneElement.getHead.loneElement should be(head) |
| 201 | } | 205 | } |
| 202 | 206 | ||
| @@ -212,7 +216,7 @@ class OWLAxiomSpec extends AnyFlatSpec with Matchers with LoneElement { | |||
| 212 | val skolem = SkolemStrategy.Constant(axiom_OWLSubClassOf2.toString) | 216 | val skolem = SkolemStrategy.Constant(axiom_OWLSubClassOf2.toString) |
| 213 | val result = convertAxiom(axiom_OWLSubClassOf2, term_x, skolem) | 217 | val result = convertAxiom(axiom_OWLSubClassOf2, term_x, skolem) |
| 214 | val body = | 218 | val body = |
| 215 | Atom.rdf(term_x, RDFIRI.RDF_TYPE, iri_Student.getIRIString) | 219 | TupleTableAtom.rdf(term_x, RDFIRI.RDF_TYPE, iri_Student.getIRIString) |
| 216 | result.loneElement.getBody.loneElement should equal(body) | 220 | result.loneElement.getBody.loneElement should equal(body) |
| 217 | } | 221 | } |
| 218 | 222 | ||
| @@ -221,8 +225,8 @@ class OWLAxiomSpec extends AnyFlatSpec with Matchers with LoneElement { | |||
| 221 | // val result = convertAxiom(axiom_OWLSubClassOf2, term_x, skolem) | 225 | // val result = convertAxiom(axiom_OWLSubClassOf2, term_x, skolem) |
| 222 | // val term_c = RSA.internal(skolem.const.getIRI) | 226 | // val term_c = RSA.internal(skolem.const.getIRI) |
| 223 | // val head = List( | 227 | // val head = List( |
| 224 | // Atom.rdf(term_x, iri_hasSupervisor, term_c), | 228 | // TupleTableAtom.rdf(term_x, iri_hasSupervisor, term_c), |
| 225 | // Atom.rdf(term_c, RDFIRI.RDF_TYPE, iri_Professor) | 229 | // TupleTableAtom.rdf(term_c, RDFIRI.RDF_TYPE, iri_Professor) |
| 226 | // ) | 230 | // ) |
| 227 | // result.loneElement.getHead should contain theSameElementsAs (head) | 231 | // result.loneElement.getHead should contain theSameElementsAs (head) |
| 228 | // } | 232 | // } |
| @@ -239,7 +243,7 @@ class OWLAxiomSpec extends AnyFlatSpec with Matchers with LoneElement { | |||
| 239 | val skolem = SkolemStrategy.Standard(axiom_OWLSubClassOf2.toString) | 243 | val skolem = SkolemStrategy.Standard(axiom_OWLSubClassOf2.toString) |
| 240 | val result = convertAxiom(axiom_OWLSubClassOf2, term_x, skolem) | 244 | val result = convertAxiom(axiom_OWLSubClassOf2, term_x, skolem) |
| 241 | val body = | 245 | val body = |
| 242 | Atom.rdf(term_x, RDFIRI.RDF_TYPE, iri_Student) | 246 | TupleTableAtom.rdf(term_x, RDFIRI.RDF_TYPE, iri_Student) |
| 243 | result.loneElement.getBody should contain(body) | 247 | result.loneElement.getBody should contain(body) |
| 244 | } | 248 | } |
| 245 | 249 | ||
| @@ -255,8 +259,8 @@ class OWLAxiomSpec extends AnyFlatSpec with Matchers with LoneElement { | |||
| 255 | // val skolem = SkolemStrategy.Standard(axiom_OWLSubClassOf2.toString) | 259 | // val skolem = SkolemStrategy.Standard(axiom_OWLSubClassOf2.toString) |
| 256 | // val result = convertAxiom(axiom_OWLSubClassOf2, term_x, skolem) | 260 | // val result = convertAxiom(axiom_OWLSubClassOf2, term_x, skolem) |
| 257 | // val head = List( | 261 | // val head = List( |
| 258 | // Atom.rdf(term_x, iri_hasSupervisor, term_y), | 262 | // TupleTableAtom.rdf(term_x, iri_hasSupervisor, term_y), |
| 259 | // Atom.rdf(term_y, RDFIRI.RDF_TYPE, iri_Professor) | 263 | // TupleTableAtom.rdf(term_y, RDFIRI.RDF_TYPE, iri_Professor) |
| 260 | // ) | 264 | // ) |
| 261 | // result.loneElement.getHead should contain theSameElementsAs head | 265 | // result.loneElement.getHead should contain theSameElementsAs head |
| 262 | // } | 266 | // } |
| @@ -270,8 +274,8 @@ class OWLAxiomSpec extends AnyFlatSpec with Matchers with LoneElement { | |||
| 270 | // it should "contain a conjunction of atoms (hasSupervisor[?x,?y],Professor[?y]) in the body of the rule" in { | 274 | // it should "contain a conjunction of atoms (hasSupervisor[?x,?y],Professor[?y]) in the body of the rule" in { |
| 271 | // val result = convertAxiom(axiom_OWLSubClassOf3, term_x) | 275 | // val result = convertAxiom(axiom_OWLSubClassOf3, term_x) |
| 272 | // val body = List( | 276 | // val body = List( |
| 273 | // Atom.rdf(term_x, iri_hasSupervisor, term_y), | 277 | // TupleTableAtom.rdf(term_x, iri_hasSupervisor, term_y), |
| 274 | // Atom.rdf(term_y, RDFIRI.RDF_TYPE, iri_Professor) | 278 | // TupleTableAtom.rdf(term_y, RDFIRI.RDF_TYPE, iri_Professor) |
| 275 | // ) | 279 | // ) |
| 276 | // result.loneElement.getBody should contain theSameElementsAs body | 280 | // result.loneElement.getBody should contain theSameElementsAs body |
| 277 | // } | 281 | // } |
| @@ -279,7 +283,7 @@ class OWLAxiomSpec extends AnyFlatSpec with Matchers with LoneElement { | |||
| 279 | it should "contain a single atom (Student[?x]) in the head of the rule" in { | 283 | it should "contain a single atom (Student[?x]) in the head of the rule" in { |
| 280 | val result = convertAxiom(axiom_OWLSubClassOf3, term_x) | 284 | val result = convertAxiom(axiom_OWLSubClassOf3, term_x) |
| 281 | val head = | 285 | val head = |
| 282 | Atom.rdf(term_x, RDFIRI.RDF_TYPE, iri_Student) | 286 | TupleTableAtom.rdf(term_x, RDFIRI.RDF_TYPE, iri_Student) |
| 283 | result.loneElement.getHead.loneElement should be(head) | 287 | result.loneElement.getHead.loneElement should be(head) |
| 284 | } | 288 | } |
| 285 | 289 | ||
| @@ -292,13 +296,13 @@ class OWLAxiomSpec extends AnyFlatSpec with Matchers with LoneElement { | |||
| 292 | it should "contain a single atoms (Student[?x]) in the body of the rule" in { | 296 | it should "contain a single atoms (Student[?x]) in the body of the rule" in { |
| 293 | val result = convertAxiom(axiom_OWLSubClassOf4, term_x) | 297 | val result = convertAxiom(axiom_OWLSubClassOf4, term_x) |
| 294 | val body = | 298 | val body = |
| 295 | Atom.rdf(term_x, RDFIRI.RDF_TYPE, iri_Student) | 299 | TupleTableAtom.rdf(term_x, RDFIRI.RDF_TYPE, iri_Student) |
| 296 | result.loneElement.getBody.loneElement should be(body) | 300 | result.loneElement.getBody.loneElement should be(body) |
| 297 | } | 301 | } |
| 298 | 302 | ||
| 299 | it should "contain a single atom (sameAs[?x,alice])) in the head of the rule" in { | 303 | it should "contain a single atom (sameAs[?x,alice])) in the head of the rule" in { |
| 300 | val result = convertAxiom(axiom_OWLSubClassOf4, term_x) | 304 | val result = convertAxiom(axiom_OWLSubClassOf4, term_x) |
| 301 | val head = Atom.rdf(term_x, RDFIRI.SAME_AS, term_alice) | 305 | val head = TupleTableAtom.rdf(term_x, RDFIRI.SAME_AS, term_alice) |
| 302 | result.loneElement.getHead.loneElement should be(head) | 306 | result.loneElement.getHead.loneElement should be(head) |
| 303 | } | 307 | } |
| 304 | 308 | ||
| @@ -311,18 +315,18 @@ class OWLAxiomSpec extends AnyFlatSpec with Matchers with LoneElement { | |||
| 311 | // it should "contain a conjunction of atoms (...) in the body of the rule" in { | 315 | // it should "contain a conjunction of atoms (...) in the body of the rule" in { |
| 312 | // val result = convertAxiom(axiom_OWLSubClassOf5, term_x) | 316 | // val result = convertAxiom(axiom_OWLSubClassOf5, term_x) |
| 313 | // val body = List( | 317 | // val body = List( |
| 314 | // Atom.rdf(term_x, RDFIRI.RDF_TYPE, iri_Student), | 318 | // TupleTableAtom.rdf(term_x, RDFIRI.RDF_TYPE, iri_Student), |
| 315 | // Atom.rdf(term_x, iri_hasSupervisor, term_y), | 319 | // TupleTableAtom.rdf(term_x, iri_hasSupervisor, term_y), |
| 316 | // Atom.rdf(term_y, RDFIRI.RDF_TYPE, iri_Professor), | 320 | // TupleTableAtom.rdf(term_y, RDFIRI.RDF_TYPE, iri_Professor), |
| 317 | // Atom.rdf(term_x, iri_hasSupervisor, term_z), | 321 | // TupleTableAtom.rdf(term_x, iri_hasSupervisor, term_z), |
| 318 | // Atom.rdf(term_z, RDFIRI.RDF_TYPE, iri_Professor) | 322 | // TupleTableAtom.rdf(term_z, RDFIRI.RDF_TYPE, iri_Professor) |
| 319 | // ) | 323 | // ) |
| 320 | // result.loneElement.getBody should contain theSameElementsAs body | 324 | // result.loneElement.getBody should contain theSameElementsAs body |
| 321 | // } | 325 | // } |
| 322 | 326 | ||
| 323 | // it should "contain a single atom (sameAs[?x,?z])) in the head of the rule" in { | 327 | // it should "contain a single atom (sameAs[?x,?z])) in the head of the rule" in { |
| 324 | // val result = convertAxiom(axiom_OWLSubClassOf5, term_x) | 328 | // val result = convertAxiom(axiom_OWLSubClassOf5, term_x) |
| 325 | // val head = Atom.rdf(term_y, RDFIRI.SAME_AS, term_z) | 329 | // val head = TupleTableAtom.rdf(term_y, RDFIRI.SAME_AS, term_z) |
| 326 | // result.loneElement.getHead.loneElement should be(head) | 330 | // result.loneElement.getHead.loneElement should be(head) |
| 327 | // } | 331 | // } |
| 328 | 332 | ||
