diff options
author | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-10-23 12:35:00 +0200 |
---|---|---|
committer | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-10-23 12:35:00 +0200 |
commit | 37e908b71354f76b9108aeb52182bad7f2f704e2 (patch) | |
tree | 0178f9e4b135b0c60c868abe68d751162381c519 /src/test | |
parent | 66a8613560b3e13b4dde49a93b3fdeab4224d3cf (diff) | |
download | RSAComb-37e908b71354f76b9108aeb52182bad7f2f704e2.tar.gz RSAComb-37e908b71354f76b9108aeb52182bad7f2f704e2.zip |
Add additional tests for T5 axiom rule generation
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/scala/rsacomb/CanonicalModelSpec.scala | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/src/test/scala/rsacomb/CanonicalModelSpec.scala b/src/test/scala/rsacomb/CanonicalModelSpec.scala index c5f040d..783c149 100644 --- a/src/test/scala/rsacomb/CanonicalModelSpec.scala +++ b/src/test/scala/rsacomb/CanonicalModelSpec.scala | |||
@@ -47,6 +47,15 @@ object Ontology1_CanonicalModelSpec { | |||
47 | Seq().asJava | 47 | Seq().asJava |
48 | ) | 48 | ) |
49 | 49 | ||
50 | val BsomeValuesFromSD = new OWLSubClassOfAxiomImpl( | ||
51 | new OWLClassImpl(RSA.base("B")), | ||
52 | new OWLObjectSomeValuesFromImpl( | ||
53 | roleS, | ||
54 | new OWLClassImpl(RSA.base("D")) | ||
55 | ), | ||
56 | Seq().asJava | ||
57 | ) | ||
58 | |||
50 | } // object OWLAxiomSpec | 59 | } // object OWLAxiomSpec |
51 | 60 | ||
52 | class Ontology1_CanonicalModelSpec | 61 | class Ontology1_CanonicalModelSpec |
@@ -67,6 +76,8 @@ class Ontology1_CanonicalModelSpec | |||
67 | rules.loneElement shouldBe a[Rule] | 76 | rules.loneElement shouldBe a[Rule] |
68 | } | 77 | } |
69 | 78 | ||
79 | // Role R // | ||
80 | |||
70 | renderer.render(roleR) should "be safe" in { | 81 | renderer.render(roleR) should "be safe" in { |
71 | ontology.unsafeRoles should not contain roleR | 82 | ontology.unsafeRoles should not contain roleR |
72 | } | 83 | } |
@@ -89,14 +100,32 @@ class Ontology1_CanonicalModelSpec | |||
89 | ontology.confl(roleR) should contain(roleR_inv) | 100 | ontology.confl(roleR) should contain(roleR_inv) |
90 | } | 101 | } |
91 | 102 | ||
103 | // Role S // | ||
104 | |||
92 | renderer.render(roleS) should "be safe" in { | 105 | renderer.render(roleS) should "be safe" in { |
93 | ontology.unsafeRoles should not contain roleS | 106 | ontology.unsafeRoles should not contain roleS |
94 | } | 107 | } |
95 | 108 | ||
109 | it should "have 3 elements in its conflict set" in { | ||
110 | ontology.confl(roleS) should have size 3 | ||
111 | } | ||
112 | |||
96 | it should "contain R in its conflict set" in { | 113 | it should "contain R in its conflict set" in { |
97 | ontology.confl(roleS) should contain(roleR) | 114 | ontology.confl(roleS) should contain(roleR) |
98 | } | 115 | } |
99 | 116 | ||
117 | it should ("contain " + renderer.render( | ||
118 | roleS_inv | ||
119 | ) + " in its conflict set") in { | ||
120 | ontology.confl(roleS) should contain(roleS_inv) | ||
121 | } | ||
122 | |||
123 | it should ("contain " + renderer.render( | ||
124 | roleT_inv | ||
125 | ) + " in its conflict set") in { | ||
126 | ontology.confl(roleS) should contain(roleT_inv) | ||
127 | } | ||
128 | |||
100 | renderer.render(roleS_inv) should "be unsafe" in { | 129 | renderer.render(roleS_inv) should "be unsafe" in { |
101 | ontology.unsafeRoles should contain(roleS_inv) | 130 | ontology.unsafeRoles should contain(roleS_inv) |
102 | } | 131 | } |
@@ -109,10 +138,38 @@ class Ontology1_CanonicalModelSpec | |||
109 | 138 | ||
110 | renderer.render( | 139 | renderer.render( |
111 | DsomeValuesFromRB | 140 | DsomeValuesFromRB |
112 | ) should "produce 5 rules" ignore { | 141 | ) should "have a sigleton 'cycle' set" in { |
142 | // Using `hashCode` we are assuming (B,S,D) < (D,R,B) | ||
143 | val ind = RSA.internal("v1_" ++ BsomeValuesFromSD.hashCode.toString()) | ||
144 | ontology.cycle(DsomeValuesFromRB).loneElement shouldBe ind | ||
145 | } | ||
146 | |||
147 | it should "produce 5 rules" in { | ||
148 | // Rule 1 provides 1 rule (split in 2) + 1 fact | ||
149 | // Rule 2 provides 0 rules | ||
150 | // Rule 3 provides 1 rule (split in 2) | ||
113 | val varX = Variable.create("X") | 151 | val varX = Variable.create("X") |
114 | val visitor = ProgramGenerator(ontology, varX) | 152 | val visitor = ProgramGenerator(ontology, varX) |
115 | val rules = DsomeValuesFromRB.accept(visitor) | 153 | val rules = DsomeValuesFromRB.accept(visitor) |
116 | rules should have length 5 | 154 | rules should have length 5 |
117 | } | 155 | } |
156 | |||
157 | renderer.render( | ||
158 | BsomeValuesFromSD | ||
159 | ) should "have a sigleton 'cycle' set" in { | ||
160 | // Using `hashCode` we are assuming (B,S,D) < (D,R,B) | ||
161 | val ind = RSA.internal("v0_" ++ DsomeValuesFromRB.hashCode.toString()) | ||
162 | ontology.cycle(BsomeValuesFromSD).loneElement shouldBe ind | ||
163 | } | ||
164 | |||
165 | it should "produce 5 rules" ignore { | ||
166 | // Rule 1 provides 1 rule (split in 2) + 1 fact | ||
167 | // Rule 2 provides 0 rules | ||
168 | // Rule 3 provides 1 rule (split in 2) | ||
169 | val varX = Variable.create("X") | ||
170 | val visitor = ProgramGenerator(ontology, varX) | ||
171 | val rules = BsomeValuesFromSD.accept(visitor) | ||
172 | rules should have length 5 | ||
173 | } | ||
174 | |||
118 | } // class OWLAxiomSpec | 175 | } // class OWLAxiomSpec |