diff options
Diffstat (limited to 'src/test/scala')
4 files changed, 65 insertions, 75 deletions
diff --git a/src/test/scala/uk/ac/ox/cs/rsacomb/CanonicalModelSpec.scala b/src/test/scala/uk/ac/ox/cs/rsacomb/CanonicalModelSpec.scala index 0d07923..42ca6bd 100644 --- a/src/test/scala/uk/ac/ox/cs/rsacomb/CanonicalModelSpec.scala +++ b/src/test/scala/uk/ac/ox/cs/rsacomb/CanonicalModelSpec.scala | |||
| @@ -15,7 +15,7 @@ import tech.oxfordsemantic.jrdfox.logic.expression.Variable | |||
| 15 | import scala.collection.JavaConverters._ | 15 | import scala.collection.JavaConverters._ |
| 16 | 16 | ||
| 17 | import uk.ac.ox.cs.rsacomb.RSAOntology | 17 | import uk.ac.ox.cs.rsacomb.RSAOntology |
| 18 | import uk.ac.ox.cs.rsacomb.converter.SkolemStrategy | 18 | import uk.ac.ox.cs.rsacomb.converter.{SkolemStrategy, NoSkolem} |
| 19 | import uk.ac.ox.cs.rsacomb.suffix.Empty | 19 | import uk.ac.ox.cs.rsacomb.suffix.Empty |
| 20 | import uk.ac.ox.cs.rsacomb.util.{RDFoxUtil, RSA} | 20 | import uk.ac.ox.cs.rsacomb.util.{RDFoxUtil, RSA} |
| 21 | 21 | ||
| @@ -94,10 +94,8 @@ class Ontology1_CanonicalModelSpec | |||
| 94 | renderer.render(AsubClassOfD) should "be converted into a single Rule" in { | 94 | renderer.render(AsubClassOfD) should "be converted into a single Rule" in { |
| 95 | val term = Variable.create("X") | 95 | val term = Variable.create("X") |
| 96 | val unsafe = ontology.unsafeRoles | 96 | val unsafe = ontology.unsafeRoles |
| 97 | val skolem = SkolemStrategy.None | ||
| 98 | val suffix = Empty | ||
| 99 | val (facts, rules) = | 97 | val (facts, rules) = |
| 100 | converter.convert(AsubClassOfD, term, unsafe, skolem, suffix) | 98 | converter.convert(AsubClassOfD, term, unsafe, NoSkolem, Empty) |
| 101 | facts shouldBe empty | 99 | facts shouldBe empty |
| 102 | rules.loneElement shouldBe a[Rule] | 100 | rules.loneElement shouldBe a[Rule] |
| 103 | } | 101 | } |
| @@ -163,10 +161,8 @@ class Ontology1_CanonicalModelSpec | |||
| 163 | ) should "produce 1 rule" in { | 161 | ) should "produce 1 rule" in { |
| 164 | val term = Variable.create("X") | 162 | val term = Variable.create("X") |
| 165 | val unsafe = ontology.unsafeRoles | 163 | val unsafe = ontology.unsafeRoles |
| 166 | val skolem = SkolemStrategy.None | ||
| 167 | val suffix = Empty | ||
| 168 | val (facts, rules) = | 164 | val (facts, rules) = |
| 169 | converter.convert(AsomeValuesFromSiC, term, unsafe, skolem, suffix) | 165 | converter.convert(AsomeValuesFromSiC, term, unsafe, NoSkolem, Empty) |
| 170 | facts shouldBe empty | 166 | facts shouldBe empty |
| 171 | rules.loneElement shouldBe a[Rule] | 167 | rules.loneElement shouldBe a[Rule] |
| 172 | } | 168 | } |
| @@ -189,10 +185,8 @@ class Ontology1_CanonicalModelSpec | |||
| 189 | // Rule 3 provides 48 rule (split in 2) | 185 | // Rule 3 provides 48 rule (split in 2) |
| 190 | val term = Variable.create("X") | 186 | val term = Variable.create("X") |
| 191 | val unsafe = ontology.unsafeRoles | 187 | val unsafe = ontology.unsafeRoles |
| 192 | val skolem = SkolemStrategy.None | ||
| 193 | val suffix = Empty | ||
| 194 | val (facts, rules) = | 188 | val (facts, rules) = |
| 195 | converter.convert(DsomeValuesFromRB, term, unsafe, skolem, suffix) | 189 | converter.convert(DsomeValuesFromRB, term, unsafe, NoSkolem, Empty) |
| 196 | facts should have length 48 | 190 | facts should have length 48 |
| 197 | rules should have length 98 | 191 | rules should have length 98 |
| 198 | } | 192 | } |
| @@ -216,10 +210,8 @@ class Ontology1_CanonicalModelSpec | |||
| 216 | // Then (1*2 + 32) + (0) + (32*2) = 98 | 210 | // Then (1*2 + 32) + (0) + (32*2) = 98 |
| 217 | val term = Variable.create("X") | 211 | val term = Variable.create("X") |
| 218 | val unsafe = ontology.unsafeRoles | 212 | val unsafe = ontology.unsafeRoles |
| 219 | val skolem = SkolemStrategy.None | ||
| 220 | val suffix = Empty | ||
| 221 | val (facts, rules) = | 213 | val (facts, rules) = |
| 222 | converter.convert(BsomeValuesFromSD, term, unsafe, skolem, suffix) | 214 | converter.convert(BsomeValuesFromSD, term, unsafe, NoSkolem, Empty) |
| 223 | facts should have length 32 | 215 | facts should have length 32 |
| 224 | rules should have length 66 | 216 | rules should have length 66 |
| 225 | } | 217 | } |
| @@ -229,10 +221,8 @@ class Ontology1_CanonicalModelSpec | |||
| 229 | ) should "produce 2 rules" in { | 221 | ) should "produce 2 rules" in { |
| 230 | val term = Variable.create("X") | 222 | val term = Variable.create("X") |
| 231 | val unsafe = ontology.unsafeRoles | 223 | val unsafe = ontology.unsafeRoles |
| 232 | val skolem = SkolemStrategy.None | ||
| 233 | val suffix = Empty | ||
| 234 | val (facts, rules) = | 224 | val (facts, rules) = |
| 235 | converter.convert(SsubPropertyOfT, term, unsafe, skolem, suffix) | 225 | converter.convert(SsubPropertyOfT, term, unsafe, NoSkolem, Empty) |
| 236 | facts shouldBe empty | 226 | facts shouldBe empty |
| 237 | rules should have length 2 | 227 | rules should have length 2 |
| 238 | } | 228 | } |
| @@ -357,10 +347,8 @@ class Ontology2_CanonicalModelSpec | |||
| 357 | ) should "produce 1 rule" in { | 347 | ) should "produce 1 rule" in { |
| 358 | val term = Variable.create("X") | 348 | val term = Variable.create("X") |
| 359 | val unsafe = ontology.unsafeRoles | 349 | val unsafe = ontology.unsafeRoles |
| 360 | val skolem = SkolemStrategy.None | ||
| 361 | val suffix = Empty | ||
| 362 | val (facts, rules) = | 350 | val (facts, rules) = |
| 363 | converter.convert(AsomeValuesFromRB, term, unsafe, skolem, suffix) | 351 | converter.convert(AsomeValuesFromRB, term, unsafe, NoSkolem, Empty) |
| 364 | facts shouldBe empty | 352 | facts shouldBe empty |
| 365 | rules should have length 1 | 353 | rules should have length 1 |
| 366 | } | 354 | } |
| @@ -372,10 +360,8 @@ class Ontology2_CanonicalModelSpec | |||
| 372 | ) should "produce 1 rule" in { | 360 | ) should "produce 1 rule" in { |
| 373 | val term = Variable.create("X") | 361 | val term = Variable.create("X") |
| 374 | val unsafe = ontology.unsafeRoles | 362 | val unsafe = ontology.unsafeRoles |
| 375 | val skolem = SkolemStrategy.None | ||
| 376 | val suffix = Empty | ||
| 377 | val (facts, rules) = | 363 | val (facts, rules) = |
| 378 | converter.convert(BsomeValuesFromSC, term, unsafe, skolem, suffix) | 364 | converter.convert(BsomeValuesFromSC, term, unsafe, NoSkolem, Empty) |
| 379 | facts shouldBe empty | 365 | facts shouldBe empty |
| 380 | rules should have length 1 | 366 | rules should have length 1 |
| 381 | } | 367 | } |
| @@ -387,10 +373,8 @@ class Ontology2_CanonicalModelSpec | |||
| 387 | ) should "produce 1 rule" in { | 373 | ) should "produce 1 rule" in { |
| 388 | val term = Variable.create("X") | 374 | val term = Variable.create("X") |
| 389 | val unsafe = ontology.unsafeRoles | 375 | val unsafe = ontology.unsafeRoles |
| 390 | val skolem = SkolemStrategy.None | ||
| 391 | val suffix = Empty | ||
| 392 | val (facts, rules) = | 376 | val (facts, rules) = |
| 393 | converter.convert(CsomeValuesFromTD, term, unsafe, skolem, suffix) | 377 | converter.convert(CsomeValuesFromTD, term, unsafe, NoSkolem, Empty) |
| 394 | facts shouldBe empty | 378 | facts shouldBe empty |
| 395 | rules should have length 1 | 379 | rules should have length 1 |
| 396 | } | 380 | } |
| @@ -402,10 +386,8 @@ class Ontology2_CanonicalModelSpec | |||
| 402 | ) should "produce 1 rule" in { | 386 | ) should "produce 1 rule" in { |
| 403 | val term = Variable.create("X") | 387 | val term = Variable.create("X") |
| 404 | val unsafe = ontology.unsafeRoles | 388 | val unsafe = ontology.unsafeRoles |
| 405 | val skolem = SkolemStrategy.None | ||
| 406 | val suffix = Empty | ||
| 407 | val (facts, rules) = | 389 | val (facts, rules) = |
| 408 | converter.convert(DsomeValuesFromPA, term, unsafe, skolem, suffix) | 390 | converter.convert(DsomeValuesFromPA, term, unsafe, NoSkolem, Empty) |
| 409 | facts shouldBe empty | 391 | facts shouldBe empty |
| 410 | rules should have length 1 | 392 | rules should have length 1 |
| 411 | } | 393 | } |
diff --git a/src/test/scala/uk/ac/ox/cs/rsacomb/OWLAxiomSpec.scala b/src/test/scala/uk/ac/ox/cs/rsacomb/OWLAxiomSpec.scala index 8aee03d..d39dec7 100644 --- a/src/test/scala/uk/ac/ox/cs/rsacomb/OWLAxiomSpec.scala +++ b/src/test/scala/uk/ac/ox/cs/rsacomb/OWLAxiomSpec.scala | |||
| @@ -36,7 +36,13 @@ import tech.oxfordsemantic.jrdfox.logic.expression.{ | |||
| 36 | import org.semanticweb.owlapi.model.{IRI => OWLIRI} | 36 | import org.semanticweb.owlapi.model.{IRI => OWLIRI} |
| 37 | import tech.oxfordsemantic.jrdfox.logic.expression.{IRI => RDFIRI} | 37 | import tech.oxfordsemantic.jrdfox.logic.expression.{IRI => RDFIRI} |
| 38 | 38 | ||
| 39 | import uk.ac.ox.cs.rsacomb.converter.{RDFoxAxiomConverter, SkolemStrategy} | 39 | import uk.ac.ox.cs.rsacomb.converter.{ |
| 40 | RDFoxAxiomConverter, | ||
| 41 | SkolemStrategy, | ||
| 42 | NoSkolem, | ||
| 43 | Standard, | ||
| 44 | Constant | ||
| 45 | } | ||
| 40 | import uk.ac.ox.cs.rsacomb.util.RSA | 46 | import uk.ac.ox.cs.rsacomb.util.RSA |
| 41 | 47 | ||
| 42 | object OWLAxiomSpec { | 48 | object OWLAxiomSpec { |
| @@ -172,7 +178,7 @@ object OWLAxiomSpec { | |||
| 172 | def convertAxiom( | 178 | def convertAxiom( |
| 173 | axiom: OWLAxiom, | 179 | axiom: OWLAxiom, |
| 174 | term: Term, | 180 | term: Term, |
| 175 | skolem: SkolemStrategy = SkolemStrategy.None | 181 | skolem: SkolemStrategy = NoSkolem |
| 176 | ): List[Rule] = { | 182 | ): List[Rule] = { |
| 177 | axiom.accept(RDFoxAxiomConverter(term, List())) | 183 | axiom.accept(RDFoxAxiomConverter(term, List())) |
| 178 | } | 184 | } |
| @@ -210,13 +216,13 @@ class OWLAxiomSpec extends AnyFlatSpec with Matchers with LoneElement { | |||
| 210 | // OWLSubClassOfAxiom #2 (w/ constant skolemization) | 216 | // OWLSubClassOfAxiom #2 (w/ constant skolemization) |
| 211 | (axiom_OWLSubClassOf2.toString + "\n(w/ constant skolemization)") should | 217 | (axiom_OWLSubClassOf2.toString + "\n(w/ constant skolemization)") should |
| 212 | "be converted into a singleton List[Rule]" in { | 218 | "be converted into a singleton List[Rule]" in { |
| 213 | val skolem = SkolemStrategy.Constant(axiom_OWLSubClassOf2.toString) | 219 | val skolem = Constant(axiom_OWLSubClassOf2.toString) |
| 214 | val result = convertAxiom(axiom_OWLSubClassOf2, term_x, skolem) | 220 | val result = convertAxiom(axiom_OWLSubClassOf2, term_x, skolem) |
| 215 | result.loneElement shouldBe a[Rule] | 221 | result.loneElement shouldBe a[Rule] |
| 216 | } | 222 | } |
| 217 | 223 | ||
| 218 | it should "contain a single atom (Student[?x]) in the body of the rule" in { | 224 | it should "contain a single atom (Student[?x]) in the body of the rule" in { |
| 219 | val skolem = SkolemStrategy.Constant(axiom_OWLSubClassOf2.toString) | 225 | val skolem = Constant(axiom_OWLSubClassOf2.toString) |
| 220 | val result = convertAxiom(axiom_OWLSubClassOf2, term_x, skolem) | 226 | val result = convertAxiom(axiom_OWLSubClassOf2, term_x, skolem) |
| 221 | val body = | 227 | val body = |
| 222 | TupleTableAtom.rdf(term_x, RDFIRI.RDF_TYPE, iri_Student.getIRIString) | 228 | TupleTableAtom.rdf(term_x, RDFIRI.RDF_TYPE, iri_Student.getIRIString) |
| @@ -237,13 +243,13 @@ class OWLAxiomSpec extends AnyFlatSpec with Matchers with LoneElement { | |||
| 237 | // OWLSubClassOfAxiom #2 (w/ skolemization) | 243 | // OWLSubClassOfAxiom #2 (w/ skolemization) |
| 238 | (axiom_OWLSubClassOf2.toString + "\n(w/ skolemization)") should | 244 | (axiom_OWLSubClassOf2.toString + "\n(w/ skolemization)") should |
| 239 | "be converted into a singleton List[Rule]" in { | 245 | "be converted into a singleton List[Rule]" in { |
| 240 | val skolem = SkolemStrategy.Standard(axiom_OWLSubClassOf2.toString) | 246 | val skolem = Standard(axiom_OWLSubClassOf2.toString) |
| 241 | val result = convertAxiom(axiom_OWLSubClassOf2, term_x, skolem) | 247 | val result = convertAxiom(axiom_OWLSubClassOf2, term_x, skolem) |
| 242 | result.loneElement shouldBe a[Rule] | 248 | result.loneElement shouldBe a[Rule] |
| 243 | } | 249 | } |
| 244 | 250 | ||
| 245 | it should "contain an atom (Student[?x]) in the body of the rule" in { | 251 | it should "contain an atom (Student[?x]) in the body of the rule" in { |
| 246 | val skolem = SkolemStrategy.Standard(axiom_OWLSubClassOf2.toString) | 252 | val skolem = Standard(axiom_OWLSubClassOf2.toString) |
| 247 | val result = convertAxiom(axiom_OWLSubClassOf2, term_x, skolem) | 253 | val result = convertAxiom(axiom_OWLSubClassOf2, term_x, skolem) |
| 248 | val body = | 254 | val body = |
| 249 | TupleTableAtom.rdf(term_x, RDFIRI.RDF_TYPE, iri_Student) | 255 | TupleTableAtom.rdf(term_x, RDFIRI.RDF_TYPE, iri_Student) |
diff --git a/src/test/scala/uk/ac/ox/cs/rsacomb/OWLClassSpec.scala b/src/test/scala/uk/ac/ox/cs/rsacomb/OWLClassSpec.scala index 459fe21..bc3ac2b 100644 --- a/src/test/scala/uk/ac/ox/cs/rsacomb/OWLClassSpec.scala +++ b/src/test/scala/uk/ac/ox/cs/rsacomb/OWLClassSpec.scala | |||
| @@ -36,7 +36,9 @@ import tech.oxfordsemantic.jrdfox.logic.expression.{ | |||
| 36 | import uk.ac.ox.cs.rsacomb.converter.{ | 36 | import uk.ac.ox.cs.rsacomb.converter.{ |
| 37 | RDFoxRuleShards, | 37 | RDFoxRuleShards, |
| 38 | RDFoxClassExprConverter, | 38 | RDFoxClassExprConverter, |
| 39 | SkolemStrategy | 39 | SkolemStrategy, |
| 40 | Standard, | ||
| 41 | Constant | ||
| 40 | } | 42 | } |
| 41 | import uk.ac.ox.cs.rsacomb.util.RSA | 43 | import uk.ac.ox.cs.rsacomb.util.RSA |
| 42 | 44 | ||
| @@ -179,16 +181,16 @@ class OWLClassSpec extends AnyFlatSpec with Matchers with LoneElement { | |||
| 179 | // OWLObjectSomeValuesFrom | 181 | // OWLObjectSomeValuesFrom |
| 180 | (class_OWLObjectSomeValuesFrom.toString ++ " w/o skolemization") should | 182 | (class_OWLObjectSomeValuesFrom.toString ++ " w/o skolemization") should |
| 181 | "be converted into a RDFoxRuleShards" in { | 183 | "be converted into a RDFoxRuleShards" in { |
| 182 | val visitor = RDFoxClassExprConverter(term_x) | 184 | val visitor = RDFoxClassExprConverter(term_x) |
| 183 | val result = class_OWLObjectSomeValuesFrom.accept(visitor) | 185 | val result = class_OWLObjectSomeValuesFrom.accept(visitor) |
| 184 | result shouldBe a[RDFoxRuleShards] | 186 | result shouldBe a[RDFoxRuleShards] |
| 185 | } | 187 | } |
| 186 | 188 | ||
| 187 | it should "have two TupleTableAtoms in its result list" in { | 189 | it should "have two TupleTableAtoms in its result list" in { |
| 188 | val visitor = RDFoxClassExprConverter(term_x) | 190 | val visitor = RDFoxClassExprConverter(term_x) |
| 189 | val result = class_OWLObjectSomeValuesFrom.accept(visitor) | 191 | val result = class_OWLObjectSomeValuesFrom.accept(visitor) |
| 190 | exactly(2, result.res) should (be(an[TupleTableAtom]) | 192 | exactly(2, result.res) should (be(an[TupleTableAtom]) |
| 191 | //and have('numberOfArguments (3)) | 193 | //and have('numberOfArguments (3)) |
| 192 | ) | 194 | ) |
| 193 | } | 195 | } |
| 194 | 196 | ||
| @@ -200,23 +202,23 @@ class OWLClassSpec extends AnyFlatSpec with Matchers with LoneElement { | |||
| 200 | 202 | ||
| 201 | (class_OWLObjectSomeValuesFrom.toString ++ " w/ skolemization") should | 203 | (class_OWLObjectSomeValuesFrom.toString ++ " w/ skolemization") should |
| 202 | "be converted into a RDFoxRuleShards" in { | 204 | "be converted into a RDFoxRuleShards" in { |
| 203 | val skolem = SkolemStrategy.Standard(class_OWLObjectSomeValuesFrom.toString) | 205 | val skolem = Standard(class_OWLObjectSomeValuesFrom.toString) |
| 204 | val visitor = RDFoxClassExprConverter(term_x, List(), skolem) | 206 | val visitor = RDFoxClassExprConverter(term_x, List(), skolem) |
| 205 | val result = class_OWLObjectSomeValuesFrom.accept(visitor) | 207 | val result = class_OWLObjectSomeValuesFrom.accept(visitor) |
| 206 | result shouldBe a[RDFoxRuleShards] | 208 | result shouldBe a[RDFoxRuleShards] |
| 207 | } | 209 | } |
| 208 | 210 | ||
| 209 | it should "have exactly two TupleTableAtoms in its result list" in { | 211 | it should "have exactly two TupleTableAtoms in its result list" in { |
| 210 | val skolem = SkolemStrategy.Standard(class_OWLObjectSomeValuesFrom.toString) | 212 | val skolem = Standard(class_OWLObjectSomeValuesFrom.toString) |
| 211 | val visitor = RDFoxClassExprConverter(term_x, List(), skolem) | 213 | val visitor = RDFoxClassExprConverter(term_x, List(), skolem) |
| 212 | val result = class_OWLObjectSomeValuesFrom.accept(visitor) | 214 | val result = class_OWLObjectSomeValuesFrom.accept(visitor) |
| 213 | exactly(2, result.res) should (be(an[TupleTableAtom]) | 215 | exactly(2, result.res) should (be(an[TupleTableAtom]) |
| 214 | //and have('numberOfArguments (3)) | 216 | //and have('numberOfArguments (3)) |
| 215 | ) | 217 | ) |
| 216 | } | 218 | } |
| 217 | 219 | ||
| 218 | it should "should have a single SKOLEM call in the extension list" in { | 220 | it should "should have a single SKOLEM call in the extension list" in { |
| 219 | val skolem = SkolemStrategy.Standard(class_OWLObjectSomeValuesFrom.toString) | 221 | val skolem = Standard(class_OWLObjectSomeValuesFrom.toString) |
| 220 | val visitor = RDFoxClassExprConverter(term_x, List(), skolem) | 222 | val visitor = RDFoxClassExprConverter(term_x, List(), skolem) |
| 221 | val result = class_OWLObjectSomeValuesFrom.accept(visitor) | 223 | val result = class_OWLObjectSomeValuesFrom.accept(visitor) |
| 222 | result.ext.loneElement shouldBe a[BindAtom] | 224 | result.ext.loneElement shouldBe a[BindAtom] |
| @@ -228,23 +230,23 @@ class OWLClassSpec extends AnyFlatSpec with Matchers with LoneElement { | |||
| 228 | 230 | ||
| 229 | (class_OWLObjectSomeValuesFrom.toString ++ " w/ constant skolemization") should | 231 | (class_OWLObjectSomeValuesFrom.toString ++ " w/ constant skolemization") should |
| 230 | "be converted into a RDFoxRuleShards" in { | 232 | "be converted into a RDFoxRuleShards" in { |
| 231 | val skolem = SkolemStrategy.Constant(class_OWLObjectSomeValuesFrom.toString) | 233 | val skolem = Constant(class_OWLObjectSomeValuesFrom.toString) |
| 232 | val visitor = RDFoxClassExprConverter(term_x, List(), skolem) | 234 | val visitor = RDFoxClassExprConverter(term_x, List(), skolem) |
| 233 | val result = class_OWLObjectSomeValuesFrom.accept(visitor) | 235 | val result = class_OWLObjectSomeValuesFrom.accept(visitor) |
| 234 | result shouldBe a[RDFoxRuleShards] | 236 | result shouldBe a[RDFoxRuleShards] |
| 235 | } | 237 | } |
| 236 | 238 | ||
| 237 | it should "have exactly two TupleTableAtoms in its result list" in { | 239 | it should "have exactly two TupleTableAtoms in its result list" in { |
| 238 | val skolem = SkolemStrategy.Constant(class_OWLObjectSomeValuesFrom.toString) | 240 | val skolem = Constant(class_OWLObjectSomeValuesFrom.toString) |
| 239 | val visitor = RDFoxClassExprConverter(term_x, List(), skolem) | 241 | val visitor = RDFoxClassExprConverter(term_x, List(), skolem) |
| 240 | val result = class_OWLObjectSomeValuesFrom.accept(visitor) | 242 | val result = class_OWLObjectSomeValuesFrom.accept(visitor) |
| 241 | exactly(2, result.res) should (be(an[TupleTableAtom]) | 243 | exactly(2, result.res) should (be(an[TupleTableAtom]) |
| 242 | //and have('numberOfArguments (3)) | 244 | //and have('numberOfArguments (3)) |
| 243 | ) | 245 | ) |
| 244 | } | 246 | } |
| 245 | 247 | ||
| 246 | it should "have an empty extension list" in { | 248 | it should "have an empty extension list" in { |
| 247 | val skolem = SkolemStrategy.Constant(class_OWLObjectSomeValuesFrom.toString) | 249 | val skolem = Constant(class_OWLObjectSomeValuesFrom.toString) |
| 248 | val visitor = RDFoxClassExprConverter(term_x, List(), skolem) | 250 | val visitor = RDFoxClassExprConverter(term_x, List(), skolem) |
| 249 | val result = class_OWLObjectSomeValuesFrom.accept(visitor) | 251 | val result = class_OWLObjectSomeValuesFrom.accept(visitor) |
| 250 | result.ext shouldBe empty | 252 | result.ext shouldBe empty |
| @@ -253,10 +255,10 @@ class OWLClassSpec extends AnyFlatSpec with Matchers with LoneElement { | |||
| 253 | // OWLObjectMaxCardinalityImpl | 255 | // OWLObjectMaxCardinalityImpl |
| 254 | class_OWLObjectMaxCardinality.toString should | 256 | class_OWLObjectMaxCardinality.toString should |
| 255 | "be converted into a RDFoxRuleShards" in { | 257 | "be converted into a RDFoxRuleShards" in { |
| 256 | val visitor = RDFoxClassExprConverter(term_x) | 258 | val visitor = RDFoxClassExprConverter(term_x) |
| 257 | val result = class_OWLObjectMaxCardinality.accept(visitor) | 259 | val result = class_OWLObjectMaxCardinality.accept(visitor) |
| 258 | result shouldBe a[RDFoxRuleShards] | 260 | result shouldBe a[RDFoxRuleShards] |
| 259 | } | 261 | } |
| 260 | 262 | ||
| 261 | // it should "have a single <owl:sameAs> TupleTableAtom in the result list" in { | 263 | // it should "have a single <owl:sameAs> TupleTableAtom in the result list" in { |
| 262 | // val visitor = RDFoxClassExprConverter(term_x) | 264 | // val visitor = RDFoxClassExprConverter(term_x) |
| @@ -270,7 +272,7 @@ class OWLClassSpec extends AnyFlatSpec with Matchers with LoneElement { | |||
| 270 | val visitor = RDFoxClassExprConverter(term_x) | 272 | val visitor = RDFoxClassExprConverter(term_x) |
| 271 | val result = class_OWLObjectMaxCardinality.accept(visitor) | 273 | val result = class_OWLObjectMaxCardinality.accept(visitor) |
| 272 | exactly(4, result.ext) should (be(an[TupleTableAtom]) | 274 | exactly(4, result.ext) should (be(an[TupleTableAtom]) |
| 273 | //and have('numberOfArguments (3)) | 275 | //and have('numberOfArguments (3)) |
| 274 | ) | 276 | ) |
| 275 | } | 277 | } |
| 276 | 278 | ||
diff --git a/src/test/scala/uk/ac/ox/cs/rsacomb/RDFoxConverterSpec.scala b/src/test/scala/uk/ac/ox/cs/rsacomb/RDFoxConverterSpec.scala index e2da6e4..5c9fa96 100644 --- a/src/test/scala/uk/ac/ox/cs/rsacomb/RDFoxConverterSpec.scala +++ b/src/test/scala/uk/ac/ox/cs/rsacomb/RDFoxConverterSpec.scala | |||
| @@ -10,7 +10,7 @@ import tech.oxfordsemantic.jrdfox.logic.datalog.TupleTableAtom | |||
| 10 | import tech.oxfordsemantic.jrdfox.logic.expression.{Variable, IRI} | 10 | import tech.oxfordsemantic.jrdfox.logic.expression.{Variable, IRI} |
| 11 | import uk.ac.ox.cs.rsacomb.converter.RDFoxConverter | 11 | import uk.ac.ox.cs.rsacomb.converter.RDFoxConverter |
| 12 | import uk.ac.ox.cs.rsacomb.suffix.{Empty, Forward, Backward, Inverse} | 12 | import uk.ac.ox.cs.rsacomb.suffix.{Empty, Forward, Backward, Inverse} |
| 13 | import uk.ac.ox.cs.rsacomb.converter.SkolemStrategy | 13 | import uk.ac.ox.cs.rsacomb.converter.{SkolemStrategy, NoSkolem} |
| 14 | 14 | ||
| 15 | object RDFoxConverterSpec { | 15 | object RDFoxConverterSpec { |
| 16 | 16 | ||
| @@ -44,7 +44,7 @@ class RDFoxConverterSpec | |||
| 44 | val cls = factory.getOWLClass(iriString0) | 44 | val cls = factory.getOWLClass(iriString0) |
| 45 | val atom = TupleTableAtom.rdf(term0, IRI.RDF_TYPE, IRI.create(iriString0)) | 45 | val atom = TupleTableAtom.rdf(term0, IRI.RDF_TYPE, IRI.create(iriString0)) |
| 46 | val (res, ext) = | 46 | val (res, ext) = |
| 47 | convert(cls, term0, List(), SkolemStrategy.None, Empty) | 47 | convert(cls, term0, List(), NoSkolem, Empty) |
| 48 | res.loneElement shouldEqual atom | 48 | res.loneElement shouldEqual atom |
| 49 | ext shouldBe empty | 49 | ext shouldBe empty |
| 50 | } | 50 | } |
| @@ -55,13 +55,13 @@ class RDFoxConverterSpec | |||
| 55 | val cls2 = factory.getOWLClass(iriString2) | 55 | val cls2 = factory.getOWLClass(iriString2) |
| 56 | val conj = factory.getOWLObjectIntersectionOf(cls0, cls1, cls2) | 56 | val conj = factory.getOWLObjectIntersectionOf(cls0, cls1, cls2) |
| 57 | val (res0, ext0) = | 57 | val (res0, ext0) = |
| 58 | convert(cls0, term0, List(), SkolemStrategy.None, Empty) | 58 | convert(cls0, term0, List(), NoSkolem, Empty) |
| 59 | val (res1, ext1) = | 59 | val (res1, ext1) = |
| 60 | convert(cls1, term0, List(), SkolemStrategy.None, Empty) | 60 | convert(cls1, term0, List(), NoSkolem, Empty) |
| 61 | val (res2, ext2) = | 61 | val (res2, ext2) = |
| 62 | convert(cls2, term0, List(), SkolemStrategy.None, Empty) | 62 | convert(cls2, term0, List(), NoSkolem, Empty) |
| 63 | val (res, ext) = | 63 | val (res, ext) = |
| 64 | convert(conj, term0, List(), SkolemStrategy.None, Empty) | 64 | convert(conj, term0, List(), NoSkolem, Empty) |
| 65 | res should contain theSameElementsAs (res0 ::: res1 ::: res2) | 65 | res should contain theSameElementsAs (res0 ::: res1 ::: res2) |
| 66 | ext should contain theSameElementsAs (ext0 ::: ext1 ::: ext2) | 66 | ext should contain theSameElementsAs (ext0 ::: ext1 ::: ext2) |
| 67 | } | 67 | } |
| @@ -70,9 +70,9 @@ class RDFoxConverterSpec | |||
| 70 | val cls0 = factory.getOWLClass(iriString0) | 70 | val cls0 = factory.getOWLClass(iriString0) |
| 71 | val conj = factory.getOWLObjectIntersectionOf(cls0) | 71 | val conj = factory.getOWLObjectIntersectionOf(cls0) |
| 72 | val (res0, ext0) = | 72 | val (res0, ext0) = |
| 73 | convert(cls0, term0, List(), SkolemStrategy.None, Empty) | 73 | convert(cls0, term0, List(), NoSkolem, Empty) |
| 74 | val (res, ext) = | 74 | val (res, ext) = |
| 75 | convert(conj, term0, List(), SkolemStrategy.None, Empty) | 75 | convert(conj, term0, List(), NoSkolem, Empty) |
| 76 | res should contain theSameElementsAs res0 | 76 | res should contain theSameElementsAs res0 |
| 77 | ext should contain theSameElementsAs ext0 | 77 | ext should contain theSameElementsAs ext0 |
| 78 | } | 78 | } |
