diff options
Diffstat (limited to 'subprojects/language-to-store/src/test/java/tools/refinery/language/mapping/tests/PartialModelMapperTest.xtend')
-rw-r--r-- | subprojects/language-to-store/src/test/java/tools/refinery/language/mapping/tests/PartialModelMapperTest.xtend | 438 |
1 files changed, 438 insertions, 0 deletions
diff --git a/subprojects/language-to-store/src/test/java/tools/refinery/language/mapping/tests/PartialModelMapperTest.xtend b/subprojects/language-to-store/src/test/java/tools/refinery/language/mapping/tests/PartialModelMapperTest.xtend new file mode 100644 index 00000000..b2fcbaa9 --- /dev/null +++ b/subprojects/language-to-store/src/test/java/tools/refinery/language/mapping/tests/PartialModelMapperTest.xtend | |||
@@ -0,0 +1,438 @@ | |||
1 | package tools.refinery.language.mapping.tests | ||
2 | |||
3 | import com.google.inject.Inject | ||
4 | import org.eclipse.emf.ecore.util.EcoreUtil | ||
5 | import org.eclipse.xtext.testing.InjectWith | ||
6 | import org.eclipse.xtext.testing.extensions.InjectionExtension | ||
7 | import org.eclipse.xtext.testing.util.ParseHelper | ||
8 | import org.junit.jupiter.api.BeforeEach | ||
9 | import org.junit.jupiter.api.Test | ||
10 | import org.junit.jupiter.api.^extension.ExtendWith | ||
11 | import tools.refinery.language.mapping.PartialModelMapper | ||
12 | import tools.refinery.language.model.problem.Problem | ||
13 | import tools.refinery.language.model.tests.ProblemTestUtil | ||
14 | import tools.refinery.language.tests.ProblemInjectorProvider | ||
15 | import tools.refinery.store.model.Tuple | ||
16 | import tools.refinery.store.model.representation.TruthValue | ||
17 | |||
18 | import static org.hamcrest.MatcherAssert.assertThat | ||
19 | import static org.hamcrest.Matchers.* | ||
20 | import static org.junit.jupiter.api.Assertions.assertTrue | ||
21 | |||
22 | @ExtendWith(InjectionExtension) | ||
23 | @InjectWith(ProblemInjectorProvider) | ||
24 | class PartialModelMapperTest { | ||
25 | @Inject | ||
26 | ParseHelper<Problem> parseHelper | ||
27 | |||
28 | @Inject | ||
29 | extension ProblemTestUtil | ||
30 | |||
31 | PartialModelMapper mapper | ||
32 | |||
33 | @BeforeEach | ||
34 | def void beforeEach() { | ||
35 | mapper = new PartialModelMapper | ||
36 | } | ||
37 | |||
38 | //Testing the relation | ||
39 | @Test | ||
40 | def void relationTest() { | ||
41 | val problem = parseHelper.parse(''' | ||
42 | class Person { | ||
43 | Person[0..*] friend | ||
44 | } | ||
45 | |||
46 | friend(a, b). | ||
47 | ''') | ||
48 | EcoreUtil.resolveAll(problem) | ||
49 | |||
50 | val modelAndMaps = mapper.transformProblem(problem) | ||
51 | assertThat(modelAndMaps, notNullValue()) | ||
52 | |||
53 | val model = modelAndMaps.model | ||
54 | val relationMap = modelAndMaps.relationMap | ||
55 | val nodeMap = modelAndMaps.nodeMap | ||
56 | |||
57 | val person = problem.findClass("Person") | ||
58 | val friend = problem.findClass("Person").reference("friend") | ||
59 | val a = problem.node("a") | ||
60 | val b = problem.node("b") | ||
61 | |||
62 | assertTrue(model.getDataRepresentations().contains(relationMap.get(person))) | ||
63 | assertTrue(model.getDataRepresentations().contains(relationMap.get(friend))) | ||
64 | assertTrue(model.get(relationMap.get(friend), Tuple.of(nodeMap.get(a),nodeMap.get(b))).equals(TruthValue.TRUE)) | ||
65 | } | ||
66 | |||
67 | //Testing the class | ||
68 | @Test | ||
69 | def void classTest() { | ||
70 | val problem = parseHelper.parse(''' | ||
71 | class Person { | ||
72 | Person[0..*] friend | ||
73 | } | ||
74 | |||
75 | Person(a). | ||
76 | ''') | ||
77 | EcoreUtil.resolveAll(problem) | ||
78 | |||
79 | val modelAndMaps = mapper.transformProblem(problem) | ||
80 | assertThat(modelAndMaps, notNullValue()) | ||
81 | |||
82 | val model = modelAndMaps.model | ||
83 | val relationMap = modelAndMaps.relationMap | ||
84 | val nodeMap = modelAndMaps.nodeMap | ||
85 | |||
86 | val person = problem.findClass("Person") | ||
87 | val friend = problem.findClass("Person").reference("friend") | ||
88 | val a = problem.node("a") | ||
89 | |||
90 | assertTrue(model.getDataRepresentations().contains(relationMap.get(person))) | ||
91 | assertTrue(model.getDataRepresentations().contains(relationMap.get(friend))) | ||
92 | |||
93 | assertTrue(model.get(relationMap.get(person), Tuple.of(nodeMap.get(a))).equals(TruthValue.TRUE)) | ||
94 | } | ||
95 | |||
96 | //Testing the equals and exists from the built in problem | ||
97 | @Test | ||
98 | def void equalsAndExistTest() { | ||
99 | val problem = parseHelper.parse(''' | ||
100 | node(a). | ||
101 | node(b). | ||
102 | |||
103 | class Person. | ||
104 | ''') | ||
105 | EcoreUtil.resolveAll(problem) | ||
106 | val builtin = problem.builtin | ||
107 | |||
108 | val modelAndMaps = mapper.transformProblem(problem) | ||
109 | assertThat(modelAndMaps, notNullValue()) | ||
110 | |||
111 | val model = modelAndMaps.model | ||
112 | val relationMap = modelAndMaps.relationMap | ||
113 | val nodeMap = modelAndMaps.nodeMap | ||
114 | val newNodeMap = modelAndMaps.newNodeMap | ||
115 | |||
116 | val a = problem.node("a") | ||
117 | val b = problem.node("b") | ||
118 | val Person = problem.findClass("Person") | ||
119 | val PersonNew = problem.findClass("Person").newNode | ||
120 | val exists = builtin.pred("exists") | ||
121 | val equals = builtin.findClass("node").reference("equals") | ||
122 | |||
123 | assertTrue(model.getDataRepresentations().contains(relationMap.get(Person))) | ||
124 | assertTrue(model.getDataRepresentations().contains(relationMap.get(exists))) | ||
125 | assertTrue(model.getDataRepresentations().contains(relationMap.get(equals))) | ||
126 | |||
127 | assertTrue(model.get(relationMap.get(exists), Tuple.of(nodeMap.get(a))).equals(TruthValue.TRUE)) | ||
128 | assertTrue(model.get(relationMap.get(exists), Tuple.of(nodeMap.get(b))).equals(TruthValue.TRUE)) | ||
129 | assertTrue(model.get(relationMap.get(equals), Tuple.of(nodeMap.get(a), nodeMap.get(a))).equals(TruthValue.TRUE)) | ||
130 | assertTrue(model.get(relationMap.get(equals), Tuple.of(nodeMap.get(b), nodeMap.get(b))).equals(TruthValue.TRUE)) | ||
131 | assertTrue(model.get(relationMap.get(equals), Tuple.of(nodeMap.get(a), nodeMap.get(b))).equals(TruthValue.FALSE)) | ||
132 | assertTrue(model.get(relationMap.get(equals), Tuple.of(nodeMap.get(b), nodeMap.get(a))).equals(TruthValue.FALSE)) | ||
133 | |||
134 | assertTrue(model.get(relationMap.get(exists), Tuple.of(newNodeMap.get(PersonNew))).equals(TruthValue.UNKNOWN)) | ||
135 | assertTrue(model.get(relationMap.get(equals), Tuple.of(newNodeMap.get(PersonNew), newNodeMap.get(PersonNew))).equals(TruthValue.UNKNOWN)) | ||
136 | assertTrue(model.get(relationMap.get(equals), Tuple.of(newNodeMap.get(PersonNew), nodeMap.get(a))).equals(TruthValue.FALSE)) | ||
137 | assertTrue(model.get(relationMap.get(equals), Tuple.of(newNodeMap.get(PersonNew), nodeMap.get(b))).equals(TruthValue.FALSE)) | ||
138 | assertTrue(model.get(relationMap.get(equals), Tuple.of(nodeMap.get(a), newNodeMap.get(PersonNew))).equals(TruthValue.FALSE)) | ||
139 | assertTrue(model.get(relationMap.get(equals), Tuple.of(nodeMap.get(b), newNodeMap.get(PersonNew))).equals(TruthValue.FALSE)) | ||
140 | } | ||
141 | |||
142 | //Testing the equals and exists from the built in problem with a different example | ||
143 | @Test | ||
144 | def void equalsAndExistTest2() { | ||
145 | val problem = parseHelper.parse(''' | ||
146 | class Person. | ||
147 | |||
148 | Person(a). | ||
149 | Person(b). | ||
150 | ''') | ||
151 | val builtin = problem.builtin | ||
152 | EcoreUtil.resolveAll(problem) | ||
153 | |||
154 | val modelAndMaps = mapper.transformProblem(problem) | ||
155 | assertThat(modelAndMaps, notNullValue()) | ||
156 | |||
157 | val model = modelAndMaps.model | ||
158 | val relationMap = modelAndMaps.relationMap | ||
159 | val nodeMap = modelAndMaps.nodeMap | ||
160 | val newNodeMap = modelAndMaps.newNodeMap | ||
161 | |||
162 | val a = problem.node("a") | ||
163 | val b = problem.node("b") | ||
164 | val Person = problem.findClass("Person") | ||
165 | val PersonNew = problem.findClass("Person").newNode | ||
166 | val exists = builtin.pred("exists") | ||
167 | val equals = builtin.findClass("node").reference("equals") | ||
168 | |||
169 | assertTrue(model.getDataRepresentations().contains(relationMap.get(Person))) | ||
170 | assertTrue(model.getDataRepresentations().contains(relationMap.get(exists))) | ||
171 | assertTrue(model.getDataRepresentations().contains(relationMap.get(equals))) | ||
172 | |||
173 | assertTrue(model.get(relationMap.get(exists), Tuple.of(nodeMap.get(a))).equals(TruthValue.TRUE)) | ||
174 | assertTrue(model.get(relationMap.get(exists), Tuple.of(nodeMap.get(b))).equals(TruthValue.TRUE)) | ||
175 | assertTrue(model.get(relationMap.get(equals), Tuple.of(nodeMap.get(a), nodeMap.get(a))).equals(TruthValue.TRUE)) | ||
176 | assertTrue(model.get(relationMap.get(equals), Tuple.of(nodeMap.get(b), nodeMap.get(b))).equals(TruthValue.TRUE)) | ||
177 | assertTrue(model.get(relationMap.get(equals), Tuple.of(nodeMap.get(a), nodeMap.get(b))).equals(TruthValue.FALSE)) | ||
178 | assertTrue(model.get(relationMap.get(equals), Tuple.of(nodeMap.get(b), nodeMap.get(a))).equals(TruthValue.FALSE)) | ||
179 | |||
180 | assertTrue(model.get(relationMap.get(exists), Tuple.of(newNodeMap.get(PersonNew))).equals(TruthValue.UNKNOWN)) | ||
181 | assertTrue(model.get(relationMap.get(equals), Tuple.of(newNodeMap.get(PersonNew), newNodeMap.get(PersonNew))).equals(TruthValue.UNKNOWN)) | ||
182 | assertTrue(model.get(relationMap.get(equals), Tuple.of(newNodeMap.get(PersonNew), nodeMap.get(a))).equals(TruthValue.FALSE)) | ||
183 | assertTrue(model.get(relationMap.get(equals), Tuple.of(newNodeMap.get(PersonNew), nodeMap.get(b))).equals(TruthValue.FALSE)) | ||
184 | assertTrue(model.get(relationMap.get(equals), Tuple.of(nodeMap.get(a), newNodeMap.get(PersonNew))).equals(TruthValue.FALSE)) | ||
185 | assertTrue(model.get(relationMap.get(equals), Tuple.of(nodeMap.get(b), newNodeMap.get(PersonNew))).equals(TruthValue.FALSE)) | ||
186 | } | ||
187 | |||
188 | //Testing the behavior of the newNodes | ||
189 | @Test | ||
190 | def void newNodeTest(){ | ||
191 | val problem = parseHelper.parse(''' | ||
192 | class Person. | ||
193 | abstract class Family. | ||
194 | ''') | ||
195 | EcoreUtil.resolveAll(problem) | ||
196 | |||
197 | val modelAndMaps = mapper.transformProblem(problem) | ||
198 | assertThat(modelAndMaps, notNullValue()) | ||
199 | |||
200 | val model = modelAndMaps.model | ||
201 | val relationMap = modelAndMaps.relationMap | ||
202 | val newNodeMap = modelAndMaps.newNodeMap | ||
203 | |||
204 | val Person = problem.findClass("Person") | ||
205 | val Family = problem.findClass("Family") | ||
206 | val PersonNew = problem.findClass("Person").newNode | ||
207 | |||
208 | |||
209 | assertTrue(model.getDataRepresentations().contains(relationMap.get(Person))) | ||
210 | assertTrue(model.getDataRepresentations().contains(relationMap.get(Family))) | ||
211 | |||
212 | assertTrue(newNodeMap.size.equals(4)) //3 from builtin.problem, 1 from Person | ||
213 | assertTrue(model.get(relationMap.get(Person), Tuple.of(newNodeMap.get(PersonNew))).equals(TruthValue.TRUE)) | ||
214 | } | ||
215 | |||
216 | //Testing the behavior of enumerations | ||
217 | @Test | ||
218 | def void enumTest(){ | ||
219 | val problem = parseHelper.parse(''' | ||
220 | enum TaxStatus { | ||
221 | child, student, adult, retired | ||
222 | } | ||
223 | ''') | ||
224 | EcoreUtil.resolveAll(problem) | ||
225 | |||
226 | val modelAndMaps = mapper.transformProblem(problem) | ||
227 | assertThat(modelAndMaps, notNullValue()) | ||
228 | |||
229 | val model = modelAndMaps.model | ||
230 | val relationMap = modelAndMaps.relationMap | ||
231 | val enumNodeMap = modelAndMaps.enumNodeMap | ||
232 | |||
233 | val TaxStatus = problem.findEnum("TaxStatus") | ||
234 | val child = problem.findEnum("TaxStatus").literal("child") | ||
235 | val student = problem.findEnum("TaxStatus").literal("student") | ||
236 | val adult = problem.findEnum("TaxStatus").literal("adult") | ||
237 | val retired = problem.findEnum("TaxStatus").literal("retired") | ||
238 | |||
239 | assertTrue(model.getDataRepresentations().contains(relationMap.get(TaxStatus))) | ||
240 | assertTrue(model.get(relationMap.get(TaxStatus), Tuple.of(enumNodeMap.get(child))).equals(TruthValue.TRUE)) | ||
241 | assertTrue(model.get(relationMap.get(TaxStatus), Tuple.of(enumNodeMap.get(student))).equals(TruthValue.TRUE)) | ||
242 | assertTrue(model.get(relationMap.get(TaxStatus), Tuple.of(enumNodeMap.get(adult))).equals(TruthValue.TRUE)) | ||
243 | assertTrue(model.get(relationMap.get(TaxStatus), Tuple.of(enumNodeMap.get(retired))).equals(TruthValue.TRUE)) | ||
244 | } | ||
245 | |||
246 | //Testing the bool from the built in problem | ||
247 | @Test | ||
248 | def void builtinBoolTest(){ | ||
249 | val problem = parseHelper.parse(''' | ||
250 | class Person. | ||
251 | ''') | ||
252 | EcoreUtil.resolveAll(problem) | ||
253 | val builtin = problem.builtin | ||
254 | |||
255 | val modelAndMaps = mapper.transformProblem(problem) | ||
256 | assertThat(modelAndMaps, notNullValue()) | ||
257 | |||
258 | val model = modelAndMaps.model | ||
259 | val relationMap = modelAndMaps.relationMap | ||
260 | val enumNodeMap = modelAndMaps.enumNodeMap | ||
261 | |||
262 | val bool = builtin.findEnum("bool") | ||
263 | val trueEnum = builtin.findEnum("bool").literal("true") //Emiatt nem sikerül a teszt | ||
264 | val falseEnum = builtin.findEnum("bool").literal("false") | ||
265 | |||
266 | assertTrue(model.getDataRepresentations().contains(relationMap.get(bool))) | ||
267 | assertTrue(model.get(relationMap.get(bool), Tuple.of(enumNodeMap.get(trueEnum))).equals(TruthValue.TRUE)) | ||
268 | assertTrue(model.get(relationMap.get(bool), Tuple.of(enumNodeMap.get(falseEnum))).equals(TruthValue.TRUE)) | ||
269 | } | ||
270 | |||
271 | //Testing different aspects of the behavior | ||
272 | @Test | ||
273 | def void compositeTest() { | ||
274 | val problem = parseHelper.parse(''' | ||
275 | class Family { | ||
276 | contains Person[] members | ||
277 | } | ||
278 | |||
279 | class Person { | ||
280 | Person[0..*] children | ||
281 | Person[0..1] parent | ||
282 | TaxStatus taxStatus | ||
283 | } | ||
284 | |||
285 | enum TaxStatus { | ||
286 | child, student, adult, retired | ||
287 | } | ||
288 | |||
289 | % A child cannot have any dependents. | ||
290 | error invalidTaxStatus(Person p) <-> | ||
291 | taxStatus(p, child), children(p, _q). | ||
292 | |||
293 | indiv family. | ||
294 | Family(family). | ||
295 | members(family, anne): true. | ||
296 | members(family, bob). | ||
297 | members(family, ciri). | ||
298 | children(anne, ciri). | ||
299 | ?children(bob, ciri). | ||
300 | taxStatus(anne, adult). | ||
301 | ''') | ||
302 | EcoreUtil.resolveAll(problem) | ||
303 | |||
304 | val modelAndMaps = mapper.transformProblem(problem) | ||
305 | assertThat(modelAndMaps, notNullValue()) | ||
306 | |||
307 | val model = modelAndMaps.model | ||
308 | val relationMap = modelAndMaps.relationMap | ||
309 | val nodeMap = modelAndMaps.nodeMap | ||
310 | val uniqueNodeMap = modelAndMaps.uniqueNodeMap | ||
311 | val enumNodeMap = modelAndMaps.enumNodeMap | ||
312 | |||
313 | val Family = problem.findClass("Family") | ||
314 | val members = problem.findClass("Family").reference("members") | ||
315 | val Person = problem.findClass("Person") | ||
316 | val children = problem.findClass("Person").reference("children") | ||
317 | val parent = problem.findClass("Person").reference("parent") | ||
318 | val taxStatus = problem.findClass("Person").reference("taxStatus") | ||
319 | val TaxStatus = problem.findEnum("TaxStatus") | ||
320 | val invalidTaxStatus = problem.pred("invalidTaxStatus") | ||
321 | |||
322 | val anne = problem.node("anne") | ||
323 | val bob = problem.node("bob") | ||
324 | val ciri = problem.node("ciri") | ||
325 | val family = problem.individualNode("family") | ||
326 | val adult = problem.findEnum("TaxStatus").literal("adult") | ||
327 | |||
328 | assertTrue(model.getDataRepresentations().contains(relationMap.get(Family))) | ||
329 | assertTrue(model.getDataRepresentations().contains(relationMap.get(members))) | ||
330 | assertTrue(model.getDataRepresentations().contains(relationMap.get(Person))) | ||
331 | assertTrue(model.getDataRepresentations().contains(relationMap.get(children))) | ||
332 | assertTrue(model.getDataRepresentations().contains(relationMap.get(parent))) | ||
333 | assertTrue(model.getDataRepresentations().contains(relationMap.get(taxStatus))) | ||
334 | assertTrue(model.getDataRepresentations().contains(relationMap.get(TaxStatus))) | ||
335 | assertTrue(model.getDataRepresentations().contains(relationMap.get(invalidTaxStatus))) | ||
336 | |||
337 | assertTrue(model.get(relationMap.get(Family), Tuple.of(uniqueNodeMap.get(family))).equals(TruthValue.TRUE)) | ||
338 | assertTrue(model.get(relationMap.get(members), Tuple.of(uniqueNodeMap.get(family),nodeMap.get(anne))).equals(TruthValue.TRUE)) | ||
339 | assertTrue(model.get(relationMap.get(members), Tuple.of(uniqueNodeMap.get(family),nodeMap.get(bob))).equals(TruthValue.TRUE)) | ||
340 | assertTrue(model.get(relationMap.get(members), Tuple.of(uniqueNodeMap.get(family),nodeMap.get(ciri))).equals(TruthValue.TRUE)) | ||
341 | assertTrue(model.get(relationMap.get(children), Tuple.of(nodeMap.get(anne),nodeMap.get(ciri))).equals(TruthValue.TRUE)) | ||
342 | assertTrue(model.get(relationMap.get(children), Tuple.of(nodeMap.get(bob),nodeMap.get(ciri))).equals(TruthValue.UNKNOWN)) | ||
343 | assertTrue(model.get(relationMap.get(taxStatus), Tuple.of(nodeMap.get(anne),enumNodeMap.get(adult))).equals(TruthValue.TRUE)) | ||
344 | } | ||
345 | |||
346 | @Test | ||
347 | def void carCaseStudyTest(){ | ||
348 | val problem = parseHelper.parse(''' | ||
349 | abstract class DynamicComponent { | ||
350 | contains StaticComponent[1..1] placedOn | ||
351 | } | ||
352 | abstract class StaticComponent. | ||
353 | class Car extends DynamicComponent. | ||
354 | class Pedestrian extends DynamicComponent. | ||
355 | class Road extends StaticComponent { | ||
356 | contains LaneSegment[0..*] lanes | ||
357 | } | ||
358 | class LaneSegment extends StaticComponent { | ||
359 | Lane[0..*] adjacentLanes | ||
360 | Lane[0..*] sameDirLanes | ||
361 | } | ||
362 | |||
363 | Car(c1). | ||
364 | Car(c2). | ||
365 | Pedestrian(p1). | ||
366 | Road(r1). | ||
367 | LaneSegment(l1). | ||
368 | LaneSegment(l2). | ||
369 | LaneSegment(l3). | ||
370 | placedOn(c1,l1). | ||
371 | placedOn(c2,l2). | ||
372 | placedOn(p1,l3). | ||
373 | lanes(r1,l1). | ||
374 | lanes(r1,l2). | ||
375 | lanes(r1,l3). | ||
376 | adjacentLanes(l1,l2). | ||
377 | adjacentLanes(l2,l1). | ||
378 | sameDirLanes(l1,l3). | ||
379 | sameDirLanes(l3,l1). | ||
380 | ''') | ||
381 | EcoreUtil.resolveAll(problem) | ||
382 | |||
383 | val modelAndMaps = mapper.transformProblem(problem) | ||
384 | assertThat(modelAndMaps, notNullValue()) | ||
385 | |||
386 | val model = modelAndMaps.model | ||
387 | val relationMap = modelAndMaps.relationMap | ||
388 | val nodeMap = modelAndMaps.nodeMap | ||
389 | |||
390 | val DynamicComponent = problem.findClass("DynamicComponent") | ||
391 | val placedOn = problem.findClass("DynamicComponent").reference("placedOn") | ||
392 | val StaticComponent = problem.findClass("StaticComponent") | ||
393 | val Car = problem.findClass("Car") | ||
394 | val Pedestrian = problem.findClass("Pedestrian") | ||
395 | val Road = problem.findClass("Road") | ||
396 | val lanes = problem.findClass("Road").reference("lanes") | ||
397 | val LaneSegment = problem.findClass("LaneSegment") | ||
398 | val adjacentLanes = problem.findClass("LaneSegment").reference("adjacentLanes") | ||
399 | val sameDirLanes = problem.findClass("LaneSegment").reference("sameDirLanes") | ||
400 | |||
401 | val c1 = problem.node("c1") | ||
402 | val c2 = problem.node("c2") | ||
403 | val p1 = problem.node("p1") | ||
404 | val r1 = problem.node("r1") | ||
405 | val l1 = problem.node("l1") | ||
406 | val l2 = problem.node("l2") | ||
407 | val l3 = problem.node("l3") | ||
408 | |||
409 | assertTrue(model.getDataRepresentations().contains(relationMap.get(DynamicComponent))) | ||
410 | assertTrue(model.getDataRepresentations().contains(relationMap.get(placedOn))) | ||
411 | assertTrue(model.getDataRepresentations().contains(relationMap.get(StaticComponent))) | ||
412 | assertTrue(model.getDataRepresentations().contains(relationMap.get(Car))) | ||
413 | assertTrue(model.getDataRepresentations().contains(relationMap.get(Pedestrian))) | ||
414 | assertTrue(model.getDataRepresentations().contains(relationMap.get(Road))) | ||
415 | assertTrue(model.getDataRepresentations().contains(relationMap.get(lanes))) | ||
416 | assertTrue(model.getDataRepresentations().contains(relationMap.get(LaneSegment))) | ||
417 | assertTrue(model.getDataRepresentations().contains(relationMap.get(adjacentLanes))) | ||
418 | assertTrue(model.getDataRepresentations().contains(relationMap.get(sameDirLanes))) | ||
419 | |||
420 | assertTrue(model.get(relationMap.get(Car), Tuple.of(nodeMap.get(c1))).equals(TruthValue.TRUE)) | ||
421 | assertTrue(model.get(relationMap.get(Car), Tuple.of(nodeMap.get(c2))).equals(TruthValue.TRUE)) | ||
422 | assertTrue(model.get(relationMap.get(Pedestrian), Tuple.of(nodeMap.get(p1))).equals(TruthValue.TRUE)) | ||
423 | assertTrue(model.get(relationMap.get(Road), Tuple.of(nodeMap.get(r1))).equals(TruthValue.TRUE)) | ||
424 | assertTrue(model.get(relationMap.get(LaneSegment), Tuple.of(nodeMap.get(l1))).equals(TruthValue.TRUE)) | ||
425 | assertTrue(model.get(relationMap.get(LaneSegment), Tuple.of(nodeMap.get(l2))).equals(TruthValue.TRUE)) | ||
426 | assertTrue(model.get(relationMap.get(LaneSegment), Tuple.of(nodeMap.get(l3))).equals(TruthValue.TRUE)) | ||
427 | assertTrue(model.get(relationMap.get(placedOn), Tuple.of(nodeMap.get(c1),nodeMap.get(l1))).equals(TruthValue.TRUE)) | ||
428 | assertTrue(model.get(relationMap.get(placedOn), Tuple.of(nodeMap.get(c2),nodeMap.get(l2))).equals(TruthValue.TRUE)) | ||
429 | assertTrue(model.get(relationMap.get(placedOn), Tuple.of(nodeMap.get(p1),nodeMap.get(l3))).equals(TruthValue.TRUE)) | ||
430 | assertTrue(model.get(relationMap.get(lanes), Tuple.of(nodeMap.get(r1),nodeMap.get(l1))).equals(TruthValue.TRUE)) | ||
431 | assertTrue(model.get(relationMap.get(lanes), Tuple.of(nodeMap.get(r1),nodeMap.get(l2))).equals(TruthValue.TRUE)) | ||
432 | assertTrue(model.get(relationMap.get(lanes), Tuple.of(nodeMap.get(r1),nodeMap.get(l3))).equals(TruthValue.TRUE)) | ||
433 | assertTrue(model.get(relationMap.get(adjacentLanes), Tuple.of(nodeMap.get(l1),nodeMap.get(l2))).equals(TruthValue.TRUE)) | ||
434 | assertTrue(model.get(relationMap.get(adjacentLanes), Tuple.of(nodeMap.get(l2),nodeMap.get(l1))).equals(TruthValue.TRUE)) | ||
435 | assertTrue(model.get(relationMap.get(sameDirLanes), Tuple.of(nodeMap.get(l1),nodeMap.get(l3))).equals(TruthValue.TRUE)) | ||
436 | assertTrue(model.get(relationMap.get(sameDirLanes), Tuple.of(nodeMap.get(l3),nodeMap.get(l1))).equals(TruthValue.TRUE)) | ||
437 | } | ||
438 | } | ||