diff options
-rw-r--r-- | store/src/main/java/tools/refinery/store/query/internal/DNF2PQuery.java | 8 | ||||
-rw-r--r-- | store/src/test/java/tools/refinery/store/query/test/QueryTest.java | 9 |
2 files changed, 9 insertions, 8 deletions
diff --git a/store/src/main/java/tools/refinery/store/query/internal/DNF2PQuery.java b/store/src/main/java/tools/refinery/store/query/internal/DNF2PQuery.java index 5e408f59..c72e0234 100644 --- a/store/src/main/java/tools/refinery/store/query/internal/DNF2PQuery.java +++ b/store/src/main/java/tools/refinery/store/query/internal/DNF2PQuery.java | |||
@@ -54,10 +54,10 @@ public class DNF2PQuery { | |||
54 | for (DNFAnd clause : predicate.getClauses()) { | 54 | for (DNFAnd clause : predicate.getClauses()) { |
55 | PBody body = new PBody(query); | 55 | PBody body = new PBody(query); |
56 | List<ExportedParameter> symbolicParameters = new ArrayList<>(); | 56 | List<ExportedParameter> symbolicParameters = new ArrayList<>(); |
57 | parameters.forEach((variable, parameter) -> { | 57 | for(var param : predicate.getVariables()) { |
58 | PVariable pVar = body.getOrCreateVariableByName(variable.getName()); | 58 | PVariable pVar = body.getOrCreateVariableByName(param.getName()); |
59 | symbolicParameters.add(new ExportedParameter(body, pVar, parameter)); | 59 | symbolicParameters.add(new ExportedParameter(body, pVar, parameters.get(param))); |
60 | }); | 60 | } |
61 | body.setSymbolicParameters(symbolicParameters); | 61 | body.setSymbolicParameters(symbolicParameters); |
62 | query.addBody(body); | 62 | query.addBody(body); |
63 | for (DNFAtom constraint : clause.getConstraints()) { | 63 | for (DNFAtom constraint : clause.getConstraints()) { |
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 f19aa69c..e55cb021 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 | |||
@@ -4,6 +4,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; | |||
4 | 4 | ||
5 | import java.util.ArrayList; | 5 | import java.util.ArrayList; |
6 | import java.util.Arrays; | 6 | import java.util.Arrays; |
7 | import java.util.Collections; | ||
7 | import java.util.HashSet; | 8 | import java.util.HashSet; |
8 | import java.util.List; | 9 | import java.util.List; |
9 | import java.util.Set; | 10 | import java.util.Set; |
@@ -115,7 +116,7 @@ class QueryTest { | |||
115 | 116 | ||
116 | List<Variable> parameters = Arrays.asList(new Variable("p1")); | 117 | List<Variable> parameters = Arrays.asList(new Variable("p1")); |
117 | RelationAtom personRelationAtom = new RelationAtom(persionView, parameters); | 118 | RelationAtom personRelationAtom = new RelationAtom(persionView, parameters); |
118 | DNFAnd clause = new DNFAnd(new HashSet<>(parameters), Arrays.asList(personRelationAtom)); | 119 | DNFAnd clause = new DNFAnd(Collections.emptySet(), Arrays.asList(personRelationAtom)); |
119 | DNFPredicate predicate = new DNFPredicate("TypeConstraint", parameters, Arrays.asList(clause)); | 120 | DNFPredicate predicate = new DNFPredicate("TypeConstraint", parameters, Arrays.asList(clause)); |
120 | 121 | ||
121 | QueriableModelStore store = new QueriableModelStoreImpl(Set.of(person, asset), Set.of(persionView), Set.of(predicate)); | 122 | QueriableModelStore store = new QueriableModelStoreImpl(Set.of(person, asset), Set.of(persionView), Set.of(predicate)); |
@@ -151,7 +152,7 @@ class QueryTest { | |||
151 | RelationAtom personRelationAtom1 = new RelationAtom(persionView, Arrays.asList(p1)); | 152 | RelationAtom personRelationAtom1 = new RelationAtom(persionView, Arrays.asList(p1)); |
152 | RelationAtom personRelationAtom2 = new RelationAtom(persionView, Arrays.asList(p2)); | 153 | RelationAtom personRelationAtom2 = new RelationAtom(persionView, Arrays.asList(p2)); |
153 | RelationAtom friendRelationAtom = new RelationAtom(friendMustView, Arrays.asList(p1, p2)); | 154 | RelationAtom friendRelationAtom = new RelationAtom(friendMustView, Arrays.asList(p1, p2)); |
154 | DNFAnd clause = new DNFAnd(new HashSet<>(parameters), | 155 | DNFAnd clause = new DNFAnd(Collections.emptySet(), |
155 | Arrays.asList(personRelationAtom1, personRelationAtom2, friendRelationAtom)); | 156 | Arrays.asList(personRelationAtom1, personRelationAtom2, friendRelationAtom)); |
156 | DNFPredicate predicate = new DNFPredicate("RelationConstraint", parameters, Arrays.asList(clause)); | 157 | DNFPredicate predicate = new DNFPredicate("RelationConstraint", parameters, Arrays.asList(clause)); |
157 | 158 | ||
@@ -193,7 +194,7 @@ class QueryTest { | |||
193 | RelationAtom personRelationAtom2 = new RelationAtom(persionView, Arrays.asList(p2)); | 194 | RelationAtom personRelationAtom2 = new RelationAtom(persionView, Arrays.asList(p2)); |
194 | RelationAtom friendRelationAtom1 = new RelationAtom(friendMustView, Arrays.asList(p1, p2)); | 195 | RelationAtom friendRelationAtom1 = new RelationAtom(friendMustView, Arrays.asList(p1, p2)); |
195 | RelationAtom friendRelationAtom2 = new RelationAtom(friendMustView, Arrays.asList(p2, p1)); | 196 | RelationAtom friendRelationAtom2 = new RelationAtom(friendMustView, Arrays.asList(p2, p1)); |
196 | DNFAnd clause = new DNFAnd(new HashSet<>(parameters), | 197 | DNFAnd clause = new DNFAnd(Collections.emptySet(), |
197 | Arrays.asList(personRelationAtom1, personRelationAtom2, friendRelationAtom1, friendRelationAtom2)); | 198 | Arrays.asList(personRelationAtom1, personRelationAtom2, friendRelationAtom1, friendRelationAtom2)); |
198 | DNFPredicate predicate = new DNFPredicate("RelationConstraint", parameters, Arrays.asList(clause)); | 199 | DNFPredicate predicate = new DNFPredicate("RelationConstraint", parameters, Arrays.asList(clause)); |
199 | 200 | ||
@@ -245,7 +246,7 @@ class QueryTest { | |||
245 | RelationAtom personRelationAtom1 = new RelationAtom(persionView, Arrays.asList(p1)); | 246 | RelationAtom personRelationAtom1 = new RelationAtom(persionView, Arrays.asList(p1)); |
246 | RelationAtom personRelationAtom2 = new RelationAtom(persionView, Arrays.asList(p2)); | 247 | RelationAtom personRelationAtom2 = new RelationAtom(persionView, Arrays.asList(p2)); |
247 | RelationAtom friendRelationAtom = new RelationAtom(friendMustView, Arrays.asList(p1, p2)); | 248 | RelationAtom friendRelationAtom = new RelationAtom(friendMustView, Arrays.asList(p1, p2)); |
248 | DNFAnd clause = new DNFAnd(new HashSet<>(parameters), | 249 | DNFAnd clause = new DNFAnd(Set.of(p2), |
249 | Arrays.asList(personRelationAtom1, personRelationAtom2, friendRelationAtom)); | 250 | Arrays.asList(personRelationAtom1, personRelationAtom2, friendRelationAtom)); |
250 | DNFPredicate predicate = new DNFPredicate("RelationConstraint", parameters, Arrays.asList(clause)); | 251 | DNFPredicate predicate = new DNFPredicate("RelationConstraint", parameters, Arrays.asList(clause)); |
251 | 252 | ||