diff options
author | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-12-04 14:00:21 +0000 |
---|---|---|
committer | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-12-04 16:51:38 +0000 |
commit | ec76d6cfbf5410fc90060667612461c1e8f3c111 (patch) | |
tree | 6d3268ba7116c2aad3c7238500e87bb990d31a27 /src/test/scala/uk/ac/ox/cs/rsacomb/CanonicalModelSpec.scala | |
parent | d7fa665c289923c362c17ce16cda03588911a817 (diff) | |
download | RSAComb-ec76d6cfbf5410fc90060667612461c1e8f3c111.tar.gz RSAComb-ec76d6cfbf5410fc90060667612461c1e8f3c111.zip |
Rework skolemization strategies
In particular `ConstantRSA` has been removed, since it was *not* a
skolemization strategy. The case for extra atoms generation previously
handled by `ConstantRSA` is not dealt with inside the RSA check.
Diffstat (limited to 'src/test/scala/uk/ac/ox/cs/rsacomb/CanonicalModelSpec.scala')
-rw-r--r-- | src/test/scala/uk/ac/ox/cs/rsacomb/CanonicalModelSpec.scala | 38 |
1 files changed, 10 insertions, 28 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 | } |