diff options
-rw-r--r-- | store/src/test/java/tools/refinery/store/query/test/QueryTest.java | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/store/src/test/java/tools/refinery/store/query/test/QueryTest.java b/store/src/test/java/tools/refinery/store/query/test/QueryTest.java index 6df0a7c3..02381bcd 100644 --- a/store/src/test/java/tools/refinery/store/query/test/QueryTest.java +++ b/store/src/test/java/tools/refinery/store/query/test/QueryTest.java | |||
@@ -65,7 +65,6 @@ class QueryTest { | |||
65 | model.put(asset, Tuple.of(1), true); | 65 | model.put(asset, Tuple.of(1), true); |
66 | model.put(asset, Tuple.of(2), true); | 66 | model.put(asset, Tuple.of(2), true); |
67 | 67 | ||
68 | |||
69 | model.flushChanges(); | 68 | model.flushChanges(); |
70 | assertEquals(2, model.countResults(predicate)); | 69 | assertEquals(2, model.countResults(predicate)); |
71 | compareMatchSets(model.allResults(predicate), Set.of(List.of(Tuple.of(0)), List.of(Tuple.of(1)))); | 70 | compareMatchSets(model.allResults(predicate), Set.of(List.of(Tuple.of(0)), List.of(Tuple.of(1)))); |
@@ -214,14 +213,14 @@ class QueryTest { | |||
214 | RelationAtom personRelationAtom1 = new RelationAtom(persionView, Arrays.asList(p1)); | 213 | RelationAtom personRelationAtom1 = new RelationAtom(persionView, Arrays.asList(p1)); |
215 | RelationAtom personRelationAtom2 = new RelationAtom(persionView, Arrays.asList(p2)); | 214 | RelationAtom personRelationAtom2 = new RelationAtom(persionView, Arrays.asList(p2)); |
216 | RelationAtom friendRelationAtom1 = new RelationAtom(friendMustView, Arrays.asList(p1, p2)); | 215 | RelationAtom friendRelationAtom1 = new RelationAtom(friendMustView, Arrays.asList(p1, p2)); |
217 | DNFAnd clause1 = new DNFAnd(new HashSet<>(parameters), | 216 | DNFAnd clause1 = new DNFAnd(Collections.emptySet(), |
218 | Arrays.asList(personRelationAtom1, personRelationAtom2, friendRelationAtom1)); | 217 | Arrays.asList(personRelationAtom1, personRelationAtom2, friendRelationAtom1)); |
219 | 218 | ||
220 | // Animal-Animal friendship | 219 | // Animal-Animal friendship |
221 | RelationAtom animalRelationAtom1 = new RelationAtom(animalView, Arrays.asList(p1)); | 220 | RelationAtom animalRelationAtom1 = new RelationAtom(animalView, Arrays.asList(p1)); |
222 | RelationAtom animalRelationAtom2 = new RelationAtom(animalView, Arrays.asList(p2)); | 221 | RelationAtom animalRelationAtom2 = new RelationAtom(animalView, Arrays.asList(p2)); |
223 | RelationAtom friendRelationAtom2 = new RelationAtom(friendMustView, Arrays.asList(p1, p2)); | 222 | RelationAtom friendRelationAtom2 = new RelationAtom(friendMustView, Arrays.asList(p1, p2)); |
224 | DNFAnd clause2 = new DNFAnd(new HashSet<>(parameters), | 223 | DNFAnd clause2 = new DNFAnd(Collections.emptySet(), |
225 | Arrays.asList(animalRelationAtom1, animalRelationAtom2, friendRelationAtom2)); | 224 | Arrays.asList(animalRelationAtom1, animalRelationAtom2, friendRelationAtom2)); |
226 | 225 | ||
227 | // No inter-species friendship | 226 | // No inter-species friendship |
@@ -259,7 +258,7 @@ class QueryTest { | |||
259 | RelationAtom personRelationAtom1 = new RelationAtom(persionView, Arrays.asList(p1)); | 258 | RelationAtom personRelationAtom1 = new RelationAtom(persionView, Arrays.asList(p1)); |
260 | RelationAtom personRelationAtom2 = new RelationAtom(persionView, Arrays.asList(p2)); | 259 | RelationAtom personRelationAtom2 = new RelationAtom(persionView, Arrays.asList(p2)); |
261 | EquivalenceAtom equivalenceAtom = new EquivalenceAtom(true, p1, p2); | 260 | EquivalenceAtom equivalenceAtom = new EquivalenceAtom(true, p1, p2); |
262 | DNFAnd clause = new DNFAnd(new HashSet<>(parameters), | 261 | DNFAnd clause = new DNFAnd(Collections.emptySet(), |
263 | Arrays.asList(personRelationAtom1, personRelationAtom2, equivalenceAtom)); | 262 | Arrays.asList(personRelationAtom1, personRelationAtom2, equivalenceAtom)); |
264 | DNFPredicate predicate = new DNFPredicate("Equality", parameters, Arrays.asList(clause)); | 263 | DNFPredicate predicate = new DNFPredicate("Equality", parameters, Arrays.asList(clause)); |
265 | 264 | ||
@@ -293,7 +292,7 @@ class QueryTest { | |||
293 | RelationAtom friendRelationAtom1 = new RelationAtom(friendMustView, Arrays.asList(p1, p3)); | 292 | RelationAtom friendRelationAtom1 = new RelationAtom(friendMustView, Arrays.asList(p1, p3)); |
294 | RelationAtom friendRelationAtom2 = new RelationAtom(friendMustView, Arrays.asList(p2, p3)); | 293 | RelationAtom friendRelationAtom2 = new RelationAtom(friendMustView, Arrays.asList(p2, p3)); |
295 | EquivalenceAtom inequivalenceAtom = new EquivalenceAtom(false, p1, p2); | 294 | EquivalenceAtom inequivalenceAtom = new EquivalenceAtom(false, p1, p2); |
296 | DNFAnd clause = new DNFAnd(new HashSet<>(parameters), Arrays.asList(personRelationAtom1, personRelationAtom2, | 295 | DNFAnd clause = new DNFAnd(Collections.emptySet(), Arrays.asList(personRelationAtom1, personRelationAtom2, |
297 | friendRelationAtom1, friendRelationAtom2, inequivalenceAtom)); | 296 | friendRelationAtom1, friendRelationAtom2, inequivalenceAtom)); |
298 | DNFPredicate predicate = new DNFPredicate("Inequality", parameters, Arrays.asList(clause)); | 297 | DNFPredicate predicate = new DNFPredicate("Inequality", parameters, Arrays.asList(clause)); |
299 | 298 | ||
@@ -327,7 +326,7 @@ class QueryTest { | |||
327 | RelationAtom personRelationAtom1 = new RelationAtom(persionView, Arrays.asList(p1)); | 326 | RelationAtom personRelationAtom1 = new RelationAtom(persionView, Arrays.asList(p1)); |
328 | RelationAtom personRelationAtom2 = new RelationAtom(persionView, Arrays.asList(p2)); | 327 | RelationAtom personRelationAtom2 = new RelationAtom(persionView, Arrays.asList(p2)); |
329 | RelationAtom friendRelationAtom = new RelationAtom(friendMustView, Arrays.asList(p1, p2)); | 328 | RelationAtom friendRelationAtom = new RelationAtom(friendMustView, Arrays.asList(p1, p2)); |
330 | DNFAnd clause = new DNFAnd(new HashSet<>(parameters), | 329 | DNFAnd clause = new DNFAnd(Collections.emptySet(), |
331 | Arrays.asList(personRelationAtom1, personRelationAtom2, friendRelationAtom)); | 330 | Arrays.asList(personRelationAtom1, personRelationAtom2, friendRelationAtom)); |
332 | DNFPredicate friendPredicate = new DNFPredicate("RelationConstraint", parameters, Arrays.asList(clause)); | 331 | DNFPredicate friendPredicate = new DNFPredicate("RelationConstraint", parameters, Arrays.asList(clause)); |
333 | 332 | ||
@@ -337,7 +336,7 @@ class QueryTest { | |||
337 | RelationAtom personRelationAtom3 = new RelationAtom(persionView, Arrays.asList(p3)); | 336 | RelationAtom personRelationAtom3 = new RelationAtom(persionView, Arrays.asList(p3)); |
338 | RelationAtom personRelationAtom4 = new RelationAtom(persionView, Arrays.asList(p4)); | 337 | RelationAtom personRelationAtom4 = new RelationAtom(persionView, Arrays.asList(p4)); |
339 | PredicateAtom friendPredicateAtom = new PredicateAtom(true, false, friendPredicate, substitution); | 338 | PredicateAtom friendPredicateAtom = new PredicateAtom(true, false, friendPredicate, substitution); |
340 | DNFAnd patternCallClause = new DNFAnd(new HashSet<>(substitution), | 339 | DNFAnd patternCallClause = new DNFAnd(Collections.emptySet(), |
341 | Arrays.asList(personRelationAtom3, personRelationAtom4, friendPredicateAtom)); | 340 | Arrays.asList(personRelationAtom3, personRelationAtom4, friendPredicateAtom)); |
342 | DNFPredicate predicate = new DNFPredicate("PatternCall", substitution, Arrays.asList(patternCallClause)); | 341 | DNFPredicate predicate = new DNFPredicate("PatternCall", substitution, Arrays.asList(patternCallClause)); |
343 | 342 | ||
@@ -371,7 +370,7 @@ class QueryTest { | |||
371 | RelationAtom personRelationAtom1 = new RelationAtom(persionView, Arrays.asList(p1)); | 370 | RelationAtom personRelationAtom1 = new RelationAtom(persionView, Arrays.asList(p1)); |
372 | RelationAtom personRelationAtom2 = new RelationAtom(persionView, Arrays.asList(p2)); | 371 | RelationAtom personRelationAtom2 = new RelationAtom(persionView, Arrays.asList(p2)); |
373 | RelationAtom friendRelationAtom = new RelationAtom(friendMustView, Arrays.asList(p1, p2)); | 372 | RelationAtom friendRelationAtom = new RelationAtom(friendMustView, Arrays.asList(p1, p2)); |
374 | DNFAnd clause = new DNFAnd(new HashSet<>(parameters), | 373 | DNFAnd clause = new DNFAnd(Collections.emptySet(), |
375 | Arrays.asList(personRelationAtom1, personRelationAtom2, friendRelationAtom)); | 374 | Arrays.asList(personRelationAtom1, personRelationAtom2, friendRelationAtom)); |
376 | DNFPredicate friendPredicate = new DNFPredicate("RelationConstraint", parameters, Arrays.asList(clause)); | 375 | DNFPredicate friendPredicate = new DNFPredicate("RelationConstraint", parameters, Arrays.asList(clause)); |
377 | 376 | ||
@@ -381,7 +380,7 @@ class QueryTest { | |||
381 | RelationAtom personRelationAtom3 = new RelationAtom(persionView, Arrays.asList(p3)); | 380 | RelationAtom personRelationAtom3 = new RelationAtom(persionView, Arrays.asList(p3)); |
382 | RelationAtom personRelationAtom4 = new RelationAtom(persionView, Arrays.asList(p4)); | 381 | RelationAtom personRelationAtom4 = new RelationAtom(persionView, Arrays.asList(p4)); |
383 | PredicateAtom friendPredicateAtom = new PredicateAtom(false, false, friendPredicate, substitution); | 382 | PredicateAtom friendPredicateAtom = new PredicateAtom(false, false, friendPredicate, substitution); |
384 | DNFAnd negativePatternCallClause = new DNFAnd(new HashSet<>(substitution), | 383 | DNFAnd negativePatternCallClause = new DNFAnd(Collections.emptySet(), |
385 | Arrays.asList(personRelationAtom3, personRelationAtom4, friendPredicateAtom)); | 384 | Arrays.asList(personRelationAtom3, personRelationAtom4, friendPredicateAtom)); |
386 | DNFPredicate predicate = new DNFPredicate("NegativePatternCall", substitution, | 385 | DNFPredicate predicate = new DNFPredicate("NegativePatternCall", substitution, |
387 | Arrays.asList(negativePatternCallClause)); | 386 | Arrays.asList(negativePatternCallClause)); |
@@ -415,7 +414,7 @@ class QueryTest { | |||
415 | RelationAtom personRelationAtom1 = new RelationAtom(persionView, Arrays.asList(p1)); | 414 | RelationAtom personRelationAtom1 = new RelationAtom(persionView, Arrays.asList(p1)); |
416 | RelationAtom personRelationAtom2 = new RelationAtom(persionView, Arrays.asList(p2)); | 415 | RelationAtom personRelationAtom2 = new RelationAtom(persionView, Arrays.asList(p2)); |
417 | RelationAtom friendRelationAtom = new RelationAtom(friendMustView, Arrays.asList(p1, p2)); | 416 | RelationAtom friendRelationAtom = new RelationAtom(friendMustView, Arrays.asList(p1, p2)); |
418 | DNFAnd clause = new DNFAnd(new HashSet<>(parameters), | 417 | DNFAnd clause = new DNFAnd(Collections.emptySet(), |
419 | Arrays.asList(personRelationAtom1, personRelationAtom2, friendRelationAtom)); | 418 | Arrays.asList(personRelationAtom1, personRelationAtom2, friendRelationAtom)); |
420 | DNFPredicate friendPredicate = new DNFPredicate("RelationConstraint", parameters, Arrays.asList(clause)); | 419 | DNFPredicate friendPredicate = new DNFPredicate("RelationConstraint", parameters, Arrays.asList(clause)); |
421 | 420 | ||
@@ -425,7 +424,7 @@ class QueryTest { | |||
425 | RelationAtom personRelationAtom3 = new RelationAtom(persionView, Arrays.asList(p3)); | 424 | RelationAtom personRelationAtom3 = new RelationAtom(persionView, Arrays.asList(p3)); |
426 | RelationAtom personRelationAtom4 = new RelationAtom(persionView, Arrays.asList(p4)); | 425 | RelationAtom personRelationAtom4 = new RelationAtom(persionView, Arrays.asList(p4)); |
427 | PredicateAtom friendPredicateAtom = new PredicateAtom(true, true, friendPredicate, substitution); | 426 | PredicateAtom friendPredicateAtom = new PredicateAtom(true, true, friendPredicate, substitution); |
428 | DNFAnd patternCallClause = new DNFAnd(new HashSet<>(substitution), | 427 | DNFAnd patternCallClause = new DNFAnd(Collections.emptySet(), |
429 | Arrays.asList(personRelationAtom3, personRelationAtom4, friendPredicateAtom)); | 428 | Arrays.asList(personRelationAtom3, personRelationAtom4, friendPredicateAtom)); |
430 | DNFPredicate predicate = new DNFPredicate("TransitivePatternCall", substitution, | 429 | DNFPredicate predicate = new DNFPredicate("TransitivePatternCall", substitution, |
431 | Arrays.asList(patternCallClause)); | 430 | Arrays.asList(patternCallClause)); |