diff options
Diffstat (limited to 'src/test/scala/rsacomb/CanonicalModelSpec.scala')
-rw-r--r-- | src/test/scala/rsacomb/CanonicalModelSpec.scala | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/src/test/scala/rsacomb/CanonicalModelSpec.scala b/src/test/scala/rsacomb/CanonicalModelSpec.scala index 5d633cc..39801bf 100644 --- a/src/test/scala/rsacomb/CanonicalModelSpec.scala +++ b/src/test/scala/rsacomb/CanonicalModelSpec.scala | |||
@@ -158,38 +158,48 @@ class Ontology1_CanonicalModelSpec | |||
158 | 158 | ||
159 | renderer.render( | 159 | renderer.render( |
160 | DsomeValuesFromRB | 160 | DsomeValuesFromRB |
161 | ) should "have a sigleton 'cycle' set" in { | 161 | ) should "have a 'cycle' set of 48 elements" in { |
162 | // Using `hashCode` we are assuming (B,S,D) < (D,R,B) | 162 | // Cycle introduces a new constant for each possible triple (the |
163 | val ind = RSA.internal("v1_" ++ BsomeValuesFromSD.hashCode.toString()) | 163 | // order among triples is total). In this example there are 4 |
164 | ontology.cycle(DsomeValuesFromRB).loneElement shouldBe ind | 164 | // concept names and R has 3 safe roles in its conflict set (S, T, |
165 | // Inv(R)). Triples are | ||
166 | // (concept, role, concept) | ||
167 | // and hence we have 4*3*4=48 new constants introduced. | ||
168 | ontology.cycle(DsomeValuesFromRB) should have size 48 | ||
165 | } | 169 | } |
166 | 170 | ||
167 | it should "produce 5 rules" in { | 171 | it should "produce 5 rules" in { |
168 | // Rule 1 provides 1 rule (split in 2) + 1 fact | 172 | // Rule 1 provides 1 rule (split in 2) + 48 fact |
169 | // Rule 2 provides 0 rules | 173 | // Rule 2 provides 0 rules |
170 | // Rule 3 provides 1 rule (split in 2) | 174 | // Rule 3 provides 48 rule (split in 2) |
175 | // Then (1*2 + 48) + (0) + (48*2) = 146 | ||
171 | val varX = Variable.create("X") | 176 | val varX = Variable.create("X") |
172 | val visitor = ProgramGenerator(ontology, varX) | 177 | val visitor = ProgramGenerator(ontology, varX) |
173 | val rules = DsomeValuesFromRB.accept(visitor) | 178 | val rules = DsomeValuesFromRB.accept(visitor) |
174 | rules should have length 5 | 179 | rules should have length 146 |
175 | } | 180 | } |
176 | 181 | ||
177 | renderer.render( | 182 | renderer.render( |
178 | BsomeValuesFromSD | 183 | BsomeValuesFromSD |
179 | ) should "have a sigleton 'cycle' set" in { | 184 | ) should "have a sigleton 'cycle' set" in { |
180 | // Using `hashCode` we are assuming (B,S,D) < (D,R,B) | 185 | // Cycle introduces a new constant for each possible triple (the |
181 | val ind = RSA.internal("v0_" ++ DsomeValuesFromRB.hashCode.toString()) | 186 | // order among triples is total). In this example there are 4 |
182 | ontology.cycle(BsomeValuesFromSD).loneElement shouldBe ind | 187 | // concept names and S has 2 safe roles in its conflict set (R, |
188 | // Inv(T)). Triples are | ||
189 | // (concept, role, concept) | ||
190 | // and hence we have 4*2*4=32 new constants introduced. | ||
191 | ontology.cycle(BsomeValuesFromSD) should have size 32 | ||
183 | } | 192 | } |
184 | 193 | ||
185 | it should "produce 5 rules" in { | 194 | it should "produce 5 rules" in { |
186 | // Rule 1 provides 1 rule (split in 2) + 1 fact | 195 | // Rule 1 provides 1 rule (split in 2) + 32 fact |
187 | // Rule 2 provides 0 rules | 196 | // Rule 2 provides 0 rules |
188 | // Rule 3 provides 1 rule (split in 2) | 197 | // Rule 3 provides 32 rule (split in 2) |
198 | // Then (1*2 + 32) + (0) + (32*2) = 98 | ||
189 | val varX = Variable.create("X") | 199 | val varX = Variable.create("X") |
190 | val visitor = ProgramGenerator(ontology, varX) | 200 | val visitor = ProgramGenerator(ontology, varX) |
191 | val rules = BsomeValuesFromSD.accept(visitor) | 201 | val rules = DsomeValuesFromRB.accept(visitor) |
192 | rules should have length 5 | 202 | rules should have length 146 |
193 | } | 203 | } |
194 | 204 | ||
195 | renderer.render( | 205 | renderer.render( |