diff options
Diffstat (limited to 'subprojects/store-query-viatra/src/test')
2 files changed, 83 insertions, 80 deletions
diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTest.java b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTest.java index 6a37b54a..471fdfc9 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTest.java +++ b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTest.java | |||
@@ -2,10 +2,13 @@ package tools.refinery.store.query.viatra; | |||
2 | 2 | ||
3 | import org.junit.jupiter.api.Test; | 3 | import org.junit.jupiter.api.Test; |
4 | import tools.refinery.store.model.ModelStore; | 4 | import tools.refinery.store.model.ModelStore; |
5 | import tools.refinery.store.query.DNF; | 5 | import tools.refinery.store.query.Dnf; |
6 | import tools.refinery.store.query.ModelQuery; | 6 | import tools.refinery.store.query.ModelQuery; |
7 | import tools.refinery.store.query.Variable; | 7 | import tools.refinery.store.query.Variable; |
8 | import tools.refinery.store.query.atom.*; | 8 | import tools.refinery.store.query.literal.CallPolarity; |
9 | import tools.refinery.store.query.literal.DnfCallLiteral; | ||
10 | import tools.refinery.store.query.literal.EquivalenceLiteral; | ||
11 | import tools.refinery.store.query.literal.RelationViewLiteral; | ||
9 | import tools.refinery.store.query.view.FilteredRelationView; | 12 | import tools.refinery.store.query.view.FilteredRelationView; |
10 | import tools.refinery.store.query.view.KeyOnlyRelationView; | 13 | import tools.refinery.store.query.view.KeyOnlyRelationView; |
11 | import tools.refinery.store.representation.Symbol; | 14 | import tools.refinery.store.representation.Symbol; |
@@ -27,9 +30,9 @@ class QueryTest { | |||
27 | var personView = new KeyOnlyRelationView<>(person); | 30 | var personView = new KeyOnlyRelationView<>(person); |
28 | 31 | ||
29 | var p1 = new Variable("p1"); | 32 | var p1 = new Variable("p1"); |
30 | var predicate = DNF.builder("TypeConstraint") | 33 | var predicate = Dnf.builder("TypeConstraint") |
31 | .parameters(p1) | 34 | .parameters(p1) |
32 | .clause(new RelationViewAtom(personView, p1)) | 35 | .clause(new RelationViewLiteral(personView, p1)) |
33 | .build(); | 36 | .build(); |
34 | 37 | ||
35 | var store = ModelStore.builder() | 38 | var store = ModelStore.builder() |
@@ -64,12 +67,12 @@ class QueryTest { | |||
64 | 67 | ||
65 | var p1 = new Variable("p1"); | 68 | var p1 = new Variable("p1"); |
66 | var p2 = new Variable("p2"); | 69 | var p2 = new Variable("p2"); |
67 | var predicate = DNF.builder("RelationConstraint") | 70 | var predicate = Dnf.builder("RelationConstraint") |
68 | .parameters(p1, p2) | 71 | .parameters(p1, p2) |
69 | .clause( | 72 | .clause( |
70 | new RelationViewAtom(personView, p1), | 73 | new RelationViewLiteral(personView, p1), |
71 | new RelationViewAtom(personView, p2), | 74 | new RelationViewLiteral(personView, p2), |
72 | new RelationViewAtom(friendMustView, p1, p2) | 75 | new RelationViewLiteral(friendMustView, p1, p2) |
73 | ) | 76 | ) |
74 | .build(); | 77 | .build(); |
75 | 78 | ||
@@ -111,13 +114,13 @@ class QueryTest { | |||
111 | 114 | ||
112 | var p1 = new Variable("p1"); | 115 | var p1 = new Variable("p1"); |
113 | var p2 = new Variable("p2"); | 116 | var p2 = new Variable("p2"); |
114 | var predicate = DNF.builder("RelationConstraint") | 117 | var predicate = Dnf.builder("RelationConstraint") |
115 | .parameters(p1, p2) | 118 | .parameters(p1, p2) |
116 | .clause( | 119 | .clause( |
117 | new RelationViewAtom(personView, p1), | 120 | new RelationViewLiteral(personView, p1), |
118 | new RelationViewAtom(personView, p2), | 121 | new RelationViewLiteral(personView, p2), |
119 | new RelationViewAtom(friendMustView, p1, p2), | 122 | new RelationViewLiteral(friendMustView, p1, p2), |
120 | new RelationViewAtom(friendMustView, p2, p1) | 123 | new RelationViewLiteral(friendMustView, p2, p1) |
121 | ) | 124 | ) |
122 | .build(); | 125 | .build(); |
123 | 126 | ||
@@ -166,12 +169,12 @@ class QueryTest { | |||
166 | 169 | ||
167 | var p1 = new Variable("p1"); | 170 | var p1 = new Variable("p1"); |
168 | var p2 = new Variable("p2"); | 171 | var p2 = new Variable("p2"); |
169 | var predicate = DNF.builder("RelationConstraint") | 172 | var predicate = Dnf.builder("RelationConstraint") |
170 | .parameters(p1) | 173 | .parameters(p1) |
171 | .clause( | 174 | .clause( |
172 | new RelationViewAtom(personView, p1), | 175 | new RelationViewLiteral(personView, p1), |
173 | new RelationViewAtom(personView, p2), | 176 | new RelationViewLiteral(personView, p2), |
174 | new RelationViewAtom(friendMustView, p1, p2) | 177 | new RelationViewLiteral(friendMustView, p1, p2) |
175 | ) | 178 | ) |
176 | .build(); | 179 | .build(); |
177 | 180 | ||
@@ -213,17 +216,17 @@ class QueryTest { | |||
213 | 216 | ||
214 | var p1 = new Variable("p1"); | 217 | var p1 = new Variable("p1"); |
215 | var p2 = new Variable("p2"); | 218 | var p2 = new Variable("p2"); |
216 | var predicate = DNF.builder("Or") | 219 | var predicate = Dnf.builder("Or") |
217 | .parameters(p1, p2) | 220 | .parameters(p1, p2) |
218 | .clause( | 221 | .clause( |
219 | new RelationViewAtom(personView, p1), | 222 | new RelationViewLiteral(personView, p1), |
220 | new RelationViewAtom(personView, p2), | 223 | new RelationViewLiteral(personView, p2), |
221 | new RelationViewAtom(friendMustView, p1, p2) | 224 | new RelationViewLiteral(friendMustView, p1, p2) |
222 | ) | 225 | ) |
223 | .clause( | 226 | .clause( |
224 | new RelationViewAtom(animalView, p1), | 227 | new RelationViewLiteral(animalView, p1), |
225 | new RelationViewAtom(animalView, p2), | 228 | new RelationViewLiteral(animalView, p2), |
226 | new RelationViewAtom(friendMustView, p1, p2) | 229 | new RelationViewLiteral(friendMustView, p1, p2) |
227 | ) | 230 | ) |
228 | .build(); | 231 | .build(); |
229 | 232 | ||
@@ -263,12 +266,12 @@ class QueryTest { | |||
263 | 266 | ||
264 | var p1 = new Variable("p1"); | 267 | var p1 = new Variable("p1"); |
265 | var p2 = new Variable("p2"); | 268 | var p2 = new Variable("p2"); |
266 | var predicate = DNF.builder("Equality") | 269 | var predicate = Dnf.builder("Equality") |
267 | .parameters(p1, p2) | 270 | .parameters(p1, p2) |
268 | .clause( | 271 | .clause( |
269 | new RelationViewAtom(personView, p1), | 272 | new RelationViewLiteral(personView, p1), |
270 | new RelationViewAtom(personView, p2), | 273 | new RelationViewLiteral(personView, p2), |
271 | new EquivalenceAtom(p1, p2) | 274 | new EquivalenceLiteral(p1, p2) |
272 | ) | 275 | ) |
273 | .build(); | 276 | .build(); |
274 | 277 | ||
@@ -302,14 +305,14 @@ class QueryTest { | |||
302 | var p1 = new Variable("p1"); | 305 | var p1 = new Variable("p1"); |
303 | var p2 = new Variable("p2"); | 306 | var p2 = new Variable("p2"); |
304 | var p3 = new Variable("p3"); | 307 | var p3 = new Variable("p3"); |
305 | var predicate = DNF.builder("Inequality") | 308 | var predicate = Dnf.builder("Inequality") |
306 | .parameters(p1, p2, p3) | 309 | .parameters(p1, p2, p3) |
307 | .clause( | 310 | .clause( |
308 | new RelationViewAtom(personView, p1), | 311 | new RelationViewLiteral(personView, p1), |
309 | new RelationViewAtom(personView, p2), | 312 | new RelationViewLiteral(personView, p2), |
310 | new RelationViewAtom(friendMustView, p1, p3), | 313 | new RelationViewLiteral(friendMustView, p1, p3), |
311 | new RelationViewAtom(friendMustView, p2, p3), | 314 | new RelationViewLiteral(friendMustView, p2, p3), |
312 | new EquivalenceAtom(false, p1, p2) | 315 | new EquivalenceLiteral(false, p1, p2) |
313 | ) | 316 | ) |
314 | .build(); | 317 | .build(); |
315 | 318 | ||
@@ -346,23 +349,23 @@ class QueryTest { | |||
346 | 349 | ||
347 | var p1 = new Variable("p1"); | 350 | var p1 = new Variable("p1"); |
348 | var p2 = new Variable("p2"); | 351 | var p2 = new Variable("p2"); |
349 | var friendPredicate = DNF.builder("RelationConstraint") | 352 | var friendPredicate = Dnf.builder("RelationConstraint") |
350 | .parameters(p1, p2) | 353 | .parameters(p1, p2) |
351 | .clause( | 354 | .clause( |
352 | new RelationViewAtom(personView, p1), | 355 | new RelationViewLiteral(personView, p1), |
353 | new RelationViewAtom(personView, p2), | 356 | new RelationViewLiteral(personView, p2), |
354 | new RelationViewAtom(friendMustView, p1, p2) | 357 | new RelationViewLiteral(friendMustView, p1, p2) |
355 | ) | 358 | ) |
356 | .build(); | 359 | .build(); |
357 | 360 | ||
358 | var p3 = new Variable("p3"); | 361 | var p3 = new Variable("p3"); |
359 | var p4 = new Variable("p4"); | 362 | var p4 = new Variable("p4"); |
360 | var predicate = DNF.builder("PositivePatternCall") | 363 | var predicate = Dnf.builder("PositivePatternCall") |
361 | .parameters(p3, p4) | 364 | .parameters(p3, p4) |
362 | .clause( | 365 | .clause( |
363 | new RelationViewAtom(personView, p3), | 366 | new RelationViewLiteral(personView, p3), |
364 | new RelationViewAtom(personView, p4), | 367 | new RelationViewLiteral(personView, p4), |
365 | new DNFCallAtom(friendPredicate, p3, p4) | 368 | new DnfCallLiteral(friendPredicate, p3, p4) |
366 | ) | 369 | ) |
367 | .build(); | 370 | .build(); |
368 | 371 | ||
@@ -399,12 +402,12 @@ class QueryTest { | |||
399 | 402 | ||
400 | var p1 = new Variable("p1"); | 403 | var p1 = new Variable("p1"); |
401 | var p2 = new Variable("p2"); | 404 | var p2 = new Variable("p2"); |
402 | var predicate = DNF.builder("NegativePatternCall") | 405 | var predicate = Dnf.builder("NegativePatternCall") |
403 | .parameters(p1, p2) | 406 | .parameters(p1, p2) |
404 | .clause( | 407 | .clause( |
405 | new RelationViewAtom(personView, p1), | 408 | new RelationViewLiteral(personView, p1), |
406 | new RelationViewAtom(personView, p2), | 409 | new RelationViewLiteral(personView, p2), |
407 | new RelationViewAtom(false, friendMustView, p1, p2) | 410 | new RelationViewLiteral(false, friendMustView, p1, p2) |
408 | ) | 411 | ) |
409 | .build(); | 412 | .build(); |
410 | 413 | ||
@@ -441,23 +444,23 @@ class QueryTest { | |||
441 | 444 | ||
442 | var p1 = new Variable("p1"); | 445 | var p1 = new Variable("p1"); |
443 | var p2 = new Variable("p2"); | 446 | var p2 = new Variable("p2"); |
444 | var friendPredicate = DNF.builder("RelationConstraint") | 447 | var friendPredicate = Dnf.builder("RelationConstraint") |
445 | .parameters(p1, p2) | 448 | .parameters(p1, p2) |
446 | .clause( | 449 | .clause( |
447 | new RelationViewAtom(personView, p1), | 450 | new RelationViewLiteral(personView, p1), |
448 | new RelationViewAtom(personView, p2), | 451 | new RelationViewLiteral(personView, p2), |
449 | new RelationViewAtom(friendMustView, p1, p2) | 452 | new RelationViewLiteral(friendMustView, p1, p2) |
450 | ) | 453 | ) |
451 | .build(); | 454 | .build(); |
452 | 455 | ||
453 | var p3 = new Variable("p3"); | 456 | var p3 = new Variable("p3"); |
454 | var p4 = new Variable("p4"); | 457 | var p4 = new Variable("p4"); |
455 | var predicate = DNF.builder("NegativePatternCall") | 458 | var predicate = Dnf.builder("NegativePatternCall") |
456 | .parameters(p3, p4) | 459 | .parameters(p3, p4) |
457 | .clause( | 460 | .clause( |
458 | new RelationViewAtom(personView, p3), | 461 | new RelationViewLiteral(personView, p3), |
459 | new RelationViewAtom(personView, p4), | 462 | new RelationViewLiteral(personView, p4), |
460 | new DNFCallAtom(false, friendPredicate, p3, p4) | 463 | new DnfCallLiteral(false, friendPredicate, p3, p4) |
461 | ) | 464 | ) |
462 | .build(); | 465 | .build(); |
463 | 466 | ||
@@ -495,11 +498,11 @@ class QueryTest { | |||
495 | var p1 = new Variable("p1"); | 498 | var p1 = new Variable("p1"); |
496 | var p2 = new Variable("p2"); | 499 | var p2 = new Variable("p2"); |
497 | 500 | ||
498 | var predicate = DNF.builder("Count") | 501 | var predicate = Dnf.builder("Count") |
499 | .parameters(p1) | 502 | .parameters(p1) |
500 | .clause( | 503 | .clause( |
501 | new RelationViewAtom(personView, p1), | 504 | new RelationViewLiteral(personView, p1), |
502 | new RelationViewAtom(false, friendMustView, p1, p2) | 505 | new RelationViewLiteral(false, friendMustView, p1, p2) |
503 | ) | 506 | ) |
504 | .build(); | 507 | .build(); |
505 | 508 | ||
@@ -536,20 +539,20 @@ class QueryTest { | |||
536 | var p1 = new Variable("p1"); | 539 | var p1 = new Variable("p1"); |
537 | var p2 = new Variable("p2"); | 540 | var p2 = new Variable("p2"); |
538 | 541 | ||
539 | var called = DNF.builder("Called") | 542 | var called = Dnf.builder("Called") |
540 | .parameters(p1, p2) | 543 | .parameters(p1, p2) |
541 | .clause( | 544 | .clause( |
542 | new RelationViewAtom(personView, p1), | 545 | new RelationViewLiteral(personView, p1), |
543 | new RelationViewAtom(personView, p2), | 546 | new RelationViewLiteral(personView, p2), |
544 | new RelationViewAtom(friendMustView, p1, p2) | 547 | new RelationViewLiteral(friendMustView, p1, p2) |
545 | ) | 548 | ) |
546 | .build(); | 549 | .build(); |
547 | 550 | ||
548 | var predicate = DNF.builder("Count") | 551 | var predicate = Dnf.builder("Count") |
549 | .parameters(p1) | 552 | .parameters(p1) |
550 | .clause( | 553 | .clause( |
551 | new RelationViewAtom(personView, p1), | 554 | new RelationViewLiteral(personView, p1), |
552 | new DNFCallAtom(false, called, p1, p2) | 555 | new DnfCallLiteral(false, called, p1, p2) |
553 | ) | 556 | ) |
554 | .build(); | 557 | .build(); |
555 | 558 | ||
@@ -585,12 +588,12 @@ class QueryTest { | |||
585 | 588 | ||
586 | var p1 = new Variable("p1"); | 589 | var p1 = new Variable("p1"); |
587 | var p2 = new Variable("p2"); | 590 | var p2 = new Variable("p2"); |
588 | var predicate = DNF.builder("TransitivePatternCall") | 591 | var predicate = Dnf.builder("TransitivePatternCall") |
589 | .parameters(p1, p2) | 592 | .parameters(p1, p2) |
590 | .clause( | 593 | .clause( |
591 | new RelationViewAtom(personView, p1), | 594 | new RelationViewLiteral(personView, p1), |
592 | new RelationViewAtom(personView, p2), | 595 | new RelationViewLiteral(personView, p2), |
593 | new RelationViewAtom(CallPolarity.TRANSITIVE, friendMustView, p1, p2) | 596 | new RelationViewLiteral(CallPolarity.TRANSITIVE, friendMustView, p1, p2) |
594 | ) | 597 | ) |
595 | .build(); | 598 | .build(); |
596 | 599 | ||
@@ -626,23 +629,23 @@ class QueryTest { | |||
626 | 629 | ||
627 | var p1 = new Variable("p1"); | 630 | var p1 = new Variable("p1"); |
628 | var p2 = new Variable("p2"); | 631 | var p2 = new Variable("p2"); |
629 | var friendPredicate = DNF.builder("RelationConstraint") | 632 | var friendPredicate = Dnf.builder("RelationConstraint") |
630 | .parameters(p1, p2) | 633 | .parameters(p1, p2) |
631 | .clause( | 634 | .clause( |
632 | new RelationViewAtom(personView, p1), | 635 | new RelationViewLiteral(personView, p1), |
633 | new RelationViewAtom(personView, p2), | 636 | new RelationViewLiteral(personView, p2), |
634 | new RelationViewAtom(friendMustView, p1, p2) | 637 | new RelationViewLiteral(friendMustView, p1, p2) |
635 | ) | 638 | ) |
636 | .build(); | 639 | .build(); |
637 | 640 | ||
638 | var p3 = new Variable("p3"); | 641 | var p3 = new Variable("p3"); |
639 | var p4 = new Variable("p4"); | 642 | var p4 = new Variable("p4"); |
640 | var predicate = DNF.builder("TransitivePatternCall") | 643 | var predicate = Dnf.builder("TransitivePatternCall") |
641 | .parameters(p3, p4) | 644 | .parameters(p3, p4) |
642 | .clause( | 645 | .clause( |
643 | new RelationViewAtom(personView, p3), | 646 | new RelationViewLiteral(personView, p3), |
644 | new RelationViewAtom(personView, p4), | 647 | new RelationViewLiteral(personView, p4), |
645 | new DNFCallAtom(CallPolarity.TRANSITIVE, friendPredicate, p3, p4) | 648 | new DnfCallLiteral(CallPolarity.TRANSITIVE, friendPredicate, p3, p4) |
646 | ) | 649 | ) |
647 | .build(); | 650 | .build(); |
648 | 651 | ||
diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTransactionTest.java b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTransactionTest.java index 98995339..99b942d2 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTransactionTest.java +++ b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTransactionTest.java | |||
@@ -2,10 +2,10 @@ package tools.refinery.store.query.viatra; | |||
2 | 2 | ||
3 | import org.junit.jupiter.api.Test; | 3 | import org.junit.jupiter.api.Test; |
4 | import tools.refinery.store.model.ModelStore; | 4 | import tools.refinery.store.model.ModelStore; |
5 | import tools.refinery.store.query.DNF; | 5 | import tools.refinery.store.query.Dnf; |
6 | import tools.refinery.store.query.ModelQuery; | 6 | import tools.refinery.store.query.ModelQuery; |
7 | import tools.refinery.store.query.Variable; | 7 | import tools.refinery.store.query.Variable; |
8 | import tools.refinery.store.query.atom.RelationViewAtom; | 8 | import tools.refinery.store.query.literal.RelationViewLiteral; |
9 | import tools.refinery.store.query.view.KeyOnlyRelationView; | 9 | import tools.refinery.store.query.view.KeyOnlyRelationView; |
10 | import tools.refinery.store.representation.Symbol; | 10 | import tools.refinery.store.representation.Symbol; |
11 | import tools.refinery.store.tuple.Tuple; | 11 | import tools.refinery.store.tuple.Tuple; |
@@ -20,9 +20,9 @@ class QueryTransactionTest { | |||
20 | var personView = new KeyOnlyRelationView<>(person); | 20 | var personView = new KeyOnlyRelationView<>(person); |
21 | 21 | ||
22 | var p1 = new Variable("p1"); | 22 | var p1 = new Variable("p1"); |
23 | var predicate = DNF.builder("TypeConstraint") | 23 | var predicate = Dnf.builder("TypeConstraint") |
24 | .parameters(p1) | 24 | .parameters(p1) |
25 | .clause(new RelationViewAtom(personView, p1)) | 25 | .clause(new RelationViewLiteral(personView, p1)) |
26 | .build(); | 26 | .build(); |
27 | 27 | ||
28 | var store = ModelStore.builder() | 28 | var store = ModelStore.builder() |