diff options
author | OszkarSemerath <semerath@mit.bme.hu> | 2021-10-22 02:17:17 +0200 |
---|---|---|
committer | OszkarSemerath <semerath@mit.bme.hu> | 2021-10-22 02:18:25 +0200 |
commit | 5729c9069c135f7720b36f76821e82f4b6bc01f1 (patch) | |
tree | ffa9edd03d468a5fc539148784ad36481cf63542 | |
parent | Merge branch 'graphs4value:main' into main (diff) | |
download | refinery-5729c9069c135f7720b36f76821e82f4b6bc01f1.tar.gz refinery-5729c9069c135f7720b36f76821e82f4b6bc01f1.tar.zst refinery-5729c9069c135f7720b36f76821e82f4b6bc01f1.zip |
Test compilation fixes for Query building
-rw-r--r-- | store/src/main/java/tools/refinery/store/query/internal/PredicateTranslator.java | 210 | ||||
-rw-r--r-- | store/src/test/java/tools/refinery/store/query/test/QueryTest.java | 141 |
2 files changed, 68 insertions, 283 deletions
diff --git a/store/src/main/java/tools/refinery/store/query/internal/PredicateTranslator.java b/store/src/main/java/tools/refinery/store/query/internal/PredicateTranslator.java deleted file mode 100644 index 6b050182..00000000 --- a/store/src/main/java/tools/refinery/store/query/internal/PredicateTranslator.java +++ /dev/null | |||
@@ -1,210 +0,0 @@ | |||
1 | package tools.refinery.store.query.internal; | ||
2 | |||
3 | import java.util.ArrayList; | ||
4 | import java.util.HashMap; | ||
5 | import java.util.LinkedHashSet; | ||
6 | import java.util.LinkedList; | ||
7 | import java.util.List; | ||
8 | import java.util.Map; | ||
9 | import java.util.Set; | ||
10 | |||
11 | import org.eclipse.viatra.query.runtime.api.GenericPatternMatcher; | ||
12 | import org.eclipse.viatra.query.runtime.api.GenericQuerySpecification; | ||
13 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
14 | import org.eclipse.viatra.query.runtime.api.scope.QueryScope; | ||
15 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
16 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.BinaryReflexiveTransitiveClosure; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.BinaryTransitiveClosure; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.BasePQuery; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PQuery; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
31 | |||
32 | import tools.refinery.store.query.RelationalScope; | ||
33 | import tools.refinery.store.query.view.RelationView; | ||
34 | |||
35 | public class PredicateTranslator extends BasePQuery { | ||
36 | |||
37 | private final Map<String, PParameter> parameters = new HashMap<String, PParameter>(); | ||
38 | private String fullyQualifiedName; | ||
39 | private LinkedList<PBody> bodies = new LinkedList<PBody>(); | ||
40 | private List<ExportedParameter> symbolicParameters; | ||
41 | |||
42 | public PredicateTranslator(String fullyQualifiedName) { | ||
43 | super(PVisibility.PUBLIC); | ||
44 | this.fullyQualifiedName = fullyQualifiedName; | ||
45 | PBody body = new PBody(this); | ||
46 | bodies.add(body); | ||
47 | } | ||
48 | |||
49 | @Override | ||
50 | public String getFullyQualifiedName() { | ||
51 | return fullyQualifiedName; | ||
52 | } | ||
53 | |||
54 | public PredicateTranslator addParameter(String name, RelationView<?> type) { | ||
55 | PParameter parameter = new PParameter(name); | ||
56 | parameters.put(name, parameter); | ||
57 | |||
58 | PBody body = bodies.peekLast(); | ||
59 | List<ExportedParameter> symbolicParameters = new ArrayList<>(); | ||
60 | parameters.forEach((pName, pParameter) -> { | ||
61 | PVariable var = body.getOrCreateVariableByName(pName); | ||
62 | symbolicParameters.add(new ExportedParameter(body, var, pParameter)); | ||
63 | }); | ||
64 | body.setSymbolicParameters(symbolicParameters); | ||
65 | |||
66 | return this; | ||
67 | } | ||
68 | |||
69 | @Override | ||
70 | public List<PParameter> getParameters() { | ||
71 | return new ArrayList<PParameter>(parameters.values()); | ||
72 | } | ||
73 | public <D> PredicateTranslator addConstraint(RelationView<D> view, String... name) { | ||
74 | if(name.length != view.getArity()) { | ||
75 | throw new IllegalArgumentException("Arity ("+view.getArity()+") does not match parameter numbers ("+name.length+")"); | ||
76 | } | ||
77 | PBody body = bodies.peekLast(); | ||
78 | Object[] variables = new Object[name.length]; | ||
79 | for(int i = 0; i<name.length; i++) { | ||
80 | variables[i] = body.getOrCreateVariableByName(name[i]); | ||
81 | } | ||
82 | new TypeConstraint(body, Tuples.flatTupleOf(variables), view); | ||
83 | return this; | ||
84 | } | ||
85 | |||
86 | // // Type constraint | ||
87 | // public RelationQuery addConstraint(String type, String name) { | ||
88 | // PBody body = bodies.peekLast(); | ||
89 | // PVariable var = body.getOrCreateVariableByName(name); | ||
90 | // new TypeConstraint(body, Tuples.flatTupleOf(var), new StringExactInstancesKey(type)); | ||
91 | // return this; | ||
92 | // } | ||
93 | // | ||
94 | // // Relation constraint | ||
95 | // public RelationQuery addConstraint(String type, String sourceName, String targetName) { | ||
96 | // PBody body = bodies.peekLast(); | ||
97 | // PVariable var_source = body.getOrCreateVariableByName(sourceName); | ||
98 | // PVariable var_target = body.getOrCreateVariableByName(targetName); | ||
99 | // new TypeConstraint(body, Tuples.flatTupleOf(var_source, var_target), | ||
100 | // new StringStructuralFeatureInstancesKey(type)); | ||
101 | // return this; | ||
102 | // } | ||
103 | |||
104 | // Create new Body | ||
105 | public PredicateTranslator or() { | ||
106 | PBody body = new PBody(this); | ||
107 | List<ExportedParameter> symbolicParameters = new ArrayList<>(); | ||
108 | parameters.forEach((name, parameter) -> { | ||
109 | PVariable var = body.getOrCreateVariableByName(name); | ||
110 | symbolicParameters.add(new ExportedParameter(body, var, parameter)); | ||
111 | }); | ||
112 | body.setSymbolicParameters(symbolicParameters); | ||
113 | bodies.add(body); | ||
114 | return this; | ||
115 | } | ||
116 | |||
117 | // Equality constraint | ||
118 | public PredicateTranslator addEquality(String sourceName, String targetName) { | ||
119 | PBody body = bodies.peekLast(); | ||
120 | PVariable var_source = body.getOrCreateVariableByName(sourceName); | ||
121 | PVariable var_target = body.getOrCreateVariableByName(targetName); | ||
122 | new Equality(body, var_source, var_target); | ||
123 | return this; | ||
124 | } | ||
125 | |||
126 | // Inequality constraint | ||
127 | public PredicateTranslator addInequality(String sourceName, String targetName) { | ||
128 | PBody body = bodies.peekLast(); | ||
129 | PVariable var_source = body.getOrCreateVariableByName(sourceName); | ||
130 | PVariable var_target = body.getOrCreateVariableByName(targetName); | ||
131 | new Inequality(body, var_source, var_target); | ||
132 | return this; | ||
133 | } | ||
134 | |||
135 | // Positive pattern call | ||
136 | public PredicateTranslator addPatternCall(PQuery query, String... names) { | ||
137 | PBody body = bodies.peekLast(); | ||
138 | PVariable[] vars = new PVariable[names.length]; | ||
139 | for (int i = 0; i < names.length; i++) { | ||
140 | vars[i] = body.getOrCreateVariableByName(names[i]); | ||
141 | } | ||
142 | new PositivePatternCall(body, Tuples.flatTupleOf(vars), query); | ||
143 | return this; | ||
144 | } | ||
145 | |||
146 | // Negative pattern call | ||
147 | public PredicateTranslator addNegativePatternCall(PQuery query, String... names) { | ||
148 | PBody body = bodies.peekLast(); | ||
149 | PVariable[] vars = new PVariable[names.length]; | ||
150 | for (int i = 0; i < names.length; i++) { | ||
151 | vars[i] = body.getOrCreateVariableByName(names[i]); | ||
152 | } | ||
153 | new NegativePatternCall(body, Tuples.flatTupleOf(vars), query); | ||
154 | return this; | ||
155 | } | ||
156 | |||
157 | // Binary transitive closure pattern call | ||
158 | public PredicateTranslator addBinaryTransitiveClosure(PQuery query, String sourceName, String targetName) { | ||
159 | PBody body = bodies.peekLast(); | ||
160 | PVariable var_source = body.getOrCreateVariableByName(sourceName); | ||
161 | PVariable var_target = body.getOrCreateVariableByName(targetName); | ||
162 | new BinaryTransitiveClosure(body, Tuples.flatTupleOf(var_source, var_target), query); | ||
163 | return this; | ||
164 | } | ||
165 | |||
166 | // Binary reflexive transitive closure pattern call | ||
167 | public PredicateTranslator addBinaryReflexiveTransitiveClosure(PQuery query, String sourceName, String targetName) { | ||
168 | PBody body = bodies.peekLast(); | ||
169 | PVariable var_source = body.getOrCreateVariableByName(sourceName); | ||
170 | PVariable var_target = body.getOrCreateVariableByName(targetName); | ||
171 | new BinaryReflexiveTransitiveClosure(body, Tuples.flatTupleOf(var_source, var_target), query, | ||
172 | query.getParameters().get(0).getDeclaredUnaryType()); | ||
173 | return this; | ||
174 | } | ||
175 | |||
176 | @Override | ||
177 | public Set<PBody> doGetContainedBodies() { | ||
178 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
179 | return new LinkedHashSet<PBody>(bodies); | ||
180 | } | ||
181 | |||
182 | public void addSymbolicParameters(ExportedParameter symbolicParameter) { | ||
183 | checkMutability(); | ||
184 | if (symbolicParameters == null) { | ||
185 | symbolicParameters = new ArrayList<>(); | ||
186 | } | ||
187 | symbolicParameters.add(symbolicParameter); | ||
188 | } | ||
189 | |||
190 | public GenericQuerySpecification<GenericPatternMatcher> build() { | ||
191 | return new GenericQuerySpecification<GenericPatternMatcher>(this) { | ||
192 | |||
193 | @Override | ||
194 | public Class<? extends QueryScope> getPreferredScopeClass() { | ||
195 | return RelationalScope.class; | ||
196 | } | ||
197 | |||
198 | @Override | ||
199 | protected GenericPatternMatcher instantiate(ViatraQueryEngine engine) { | ||
200 | return defaultInstantiate(engine); | ||
201 | } | ||
202 | |||
203 | @Override | ||
204 | public GenericPatternMatcher instantiate() { | ||
205 | return new GenericPatternMatcher(this); | ||
206 | } | ||
207 | |||
208 | }; | ||
209 | } | ||
210 | } \ No newline at end of file | ||
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 b1014700..beb50bf3 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 | |||
@@ -1,17 +1,13 @@ | |||
1 | package tools.refinery.store.query.test; | 1 | package tools.refinery.store.query.test; |
2 | 2 | ||
3 | import static org.junit.jupiter.api.Assertions.assertEquals; | 3 | import static org.junit.jupiter.api.Assertions.assertEquals; |
4 | import static org.junit.jupiter.api.Assertions.assertFalse; | ||
5 | import static org.junit.jupiter.api.Assertions.assertTrue; | ||
6 | 4 | ||
7 | import java.util.Arrays; | 5 | import java.util.Arrays; |
8 | import java.util.Collection; | ||
9 | import java.util.HashSet; | 6 | import java.util.HashSet; |
10 | import java.util.List; | 7 | import java.util.List; |
11 | import java.util.Set; | 8 | import java.util.Set; |
12 | 9 | ||
13 | import org.eclipse.viatra.query.runtime.api.AdvancedViatraQueryEngine; | 10 | import org.eclipse.viatra.query.runtime.api.AdvancedViatraQueryEngine; |
14 | import org.eclipse.viatra.query.runtime.api.GenericPatternMatch; | ||
15 | import org.eclipse.viatra.query.runtime.api.GenericPatternMatcher; | 11 | import org.eclipse.viatra.query.runtime.api.GenericPatternMatcher; |
16 | import org.eclipse.viatra.query.runtime.api.GenericQuerySpecification; | 12 | import org.eclipse.viatra.query.runtime.api.GenericQuerySpecification; |
17 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | 13 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; |
@@ -32,72 +28,71 @@ import tools.refinery.store.query.building.PredicateAtom; | |||
32 | import tools.refinery.store.query.building.RelationAtom; | 28 | import tools.refinery.store.query.building.RelationAtom; |
33 | import tools.refinery.store.query.building.Variable; | 29 | import tools.refinery.store.query.building.Variable; |
34 | import tools.refinery.store.query.internal.DNF2PQuery; | 30 | import tools.refinery.store.query.internal.DNF2PQuery; |
35 | import tools.refinery.store.query.internal.PredicateTranslator; | 31 | import tools.refinery.store.query.internal.RawPatternMatcher; |
36 | import tools.refinery.store.query.view.FilteredRelationView; | 32 | import tools.refinery.store.query.view.FilteredRelationView; |
37 | import tools.refinery.store.query.view.FunctionalRelationView; | ||
38 | import tools.refinery.store.query.view.KeyOnlyRelationView; | 33 | import tools.refinery.store.query.view.KeyOnlyRelationView; |
39 | import tools.refinery.store.query.view.RelationView; | 34 | import tools.refinery.store.query.view.RelationView; |
40 | 35 | ||
41 | class QueryTest { | 36 | class QueryTest { |
42 | @Test | 37 | // @Test |
43 | void minimalTest() { | 38 | // void minimalTest() { |
44 | Relation<Boolean> person = new Relation<>("Person", 1, false); | 39 | // Relation<Boolean> person = new Relation<>("Person", 1, false); |
45 | 40 | // | |
46 | RelationView<Boolean> persionView = new KeyOnlyRelationView(person); | 41 | // RelationView<Boolean> persionView = new KeyOnlyRelationView(person); |
47 | GenericQuerySpecification<GenericPatternMatcher> personQuery = (new PredicateTranslator("PersonQuery")) | 42 | // GenericQuerySpecification<GenericPatternMatcher> personQuery = (new PredicateTranslator("PersonQuery")) |
48 | .addParameter("p", persionView).addConstraint(persionView, "p").build(); | 43 | // .addParameter("p", persionView).addConstraint(persionView, "p").build(); |
49 | 44 | // | |
50 | ModelStore store = new ModelStoreImpl(Set.of(person)); | 45 | // ModelStore store = new ModelStoreImpl(Set.of(person)); |
51 | Model model = store.createModel(); | 46 | // Model model = store.createModel(); |
52 | 47 | // | |
53 | model.put(person, Tuple.of(0), true); | 48 | // model.put(person, Tuple.of(0), true); |
54 | model.put(person, Tuple.of(1), true); | 49 | // model.put(person, Tuple.of(1), true); |
55 | 50 | // | |
56 | RelationalScope scope = new RelationalScope(model, Set.of(persionView)); | 51 | // RelationalScope scope = new RelationalScope(model, Set.of(persionView)); |
57 | 52 | // | |
58 | ViatraQueryEngine engine = AdvancedViatraQueryEngine.on(scope); | 53 | // ViatraQueryEngine engine = AdvancedViatraQueryEngine.on(scope); |
59 | GenericPatternMatcher personMatcher = engine.getMatcher(personQuery); | 54 | // GenericPatternMatcher personMatcher = engine.getMatcher(personQuery); |
60 | 55 | // | |
61 | assertEquals(2, personMatcher.countMatches()); | 56 | // assertEquals(2, personMatcher.countMatches()); |
62 | } | 57 | // } |
63 | 58 | // | |
64 | void modelBuildingTest() { | 59 | // void modelBuildingTest() { |
65 | Relation<Boolean> person = new Relation<>("Person", 1, false); | 60 | // Relation<Boolean> person = new Relation<>("Person", 1, false); |
66 | Relation<Integer> age = new Relation<Integer>("age", 1, null); | 61 | // Relation<Integer> age = new Relation<Integer>("age", 1, null); |
67 | Relation<TruthValue> friend = new Relation<>("friend", 2, TruthValue.FALSE); | 62 | // Relation<TruthValue> friend = new Relation<>("friend", 2, TruthValue.FALSE); |
68 | 63 | // | |
69 | ModelStore store = new ModelStoreImpl(Set.of(person, age, friend)); | 64 | // ModelStore store = new ModelStoreImpl(Set.of(person, age, friend)); |
70 | Model model = store.createModel(); | 65 | // Model model = store.createModel(); |
71 | 66 | // | |
72 | model.put(person, Tuple.of(0), true); | 67 | // model.put(person, Tuple.of(0), true); |
73 | model.put(person, Tuple.of(1), true); | 68 | // model.put(person, Tuple.of(1), true); |
74 | model.put(age, Tuple.of(0), 3); | 69 | // model.put(age, Tuple.of(0), 3); |
75 | model.put(age, Tuple.of(1), 1); | 70 | // model.put(age, Tuple.of(1), 1); |
76 | model.put(friend, Tuple.of(0, 1), TruthValue.TRUE); | 71 | // model.put(friend, Tuple.of(0, 1), TruthValue.TRUE); |
77 | model.put(friend, Tuple.of(1, 0), TruthValue.UNKNOWN); | 72 | // model.put(friend, Tuple.of(1, 0), TruthValue.UNKNOWN); |
78 | 73 | // | |
79 | // Sanity check | 74 | // // Sanity check |
80 | assertTrue(model.get(person, Tuple.of(0))); | 75 | // assertTrue(model.get(person, Tuple.of(0))); |
81 | assertTrue(model.get(person, Tuple.of(1))); | 76 | // assertTrue(model.get(person, Tuple.of(1))); |
82 | assertFalse(model.get(person, Tuple.of(2))); | 77 | // assertFalse(model.get(person, Tuple.of(2))); |
83 | 78 | // | |
84 | RelationView<Boolean> persionView = new KeyOnlyRelationView(person); | 79 | // RelationView<Boolean> persionView = new KeyOnlyRelationView(person); |
85 | RelationView<Integer> ageView = new FunctionalRelationView<>(age); | 80 | // RelationView<Integer> ageView = new FunctionalRelationView<>(age); |
86 | RelationView<TruthValue> friendMustView = new FilteredRelationView<TruthValue>(friend, (k, v) -> v.must()); | 81 | // RelationView<TruthValue> friendMustView = new FilteredRelationView<TruthValue>(friend, (k, v) -> v.must()); |
87 | RelationView<TruthValue> friendMayView = new FilteredRelationView<TruthValue>(friend, (k, v) -> v.may()); | 82 | // RelationView<TruthValue> friendMayView = new FilteredRelationView<TruthValue>(friend, (k, v) -> v.may()); |
88 | 83 | // | |
89 | RelationalScope scope = new RelationalScope(model, Set.of(persionView, ageView, friendMustView, friendMayView)); | 84 | // RelationalScope scope = new RelationalScope(model, Set.of(persionView, ageView, friendMustView, friendMayView)); |
90 | 85 | // | |
91 | GenericQuerySpecification<GenericPatternMatcher> personQuery = (new PredicateTranslator("PersonQuery")) | 86 | // GenericQuerySpecification<GenericPatternMatcher> personQuery = (new PredicateTranslator("PersonQuery")) |
92 | .addParameter("p", persionView).addConstraint(persionView, "p").build(); | 87 | // .addParameter("p", persionView).addConstraint(persionView, "p").build(); |
93 | 88 | // | |
94 | ViatraQueryEngine engine = AdvancedViatraQueryEngine.on(scope); | 89 | // ViatraQueryEngine engine = AdvancedViatraQueryEngine.on(scope); |
95 | GenericPatternMatcher personMatcher = engine.getMatcher(personQuery); | 90 | // GenericPatternMatcher personMatcher = engine.getMatcher(personQuery); |
96 | Collection<GenericPatternMatch> personMatches = personMatcher.getAllMatches(); | 91 | // Collection<GenericPatternMatch> personMatches = personMatcher.getAllMatches(); |
97 | for (GenericPatternMatch personMatch : personMatches) { | 92 | // for (GenericPatternMatch personMatch : personMatches) { |
98 | System.out.println(personMatch); | 93 | // System.out.println(personMatch); |
99 | } | 94 | // } |
100 | } | 95 | // } |
101 | 96 | ||
102 | @Test | 97 | @Test |
103 | @Disabled | 98 | @Disabled |
@@ -110,7 +105,7 @@ class QueryTest { | |||
110 | RelationAtom personRelationAtom = new RelationAtom(persionView, parameters); | 105 | RelationAtom personRelationAtom = new RelationAtom(persionView, parameters); |
111 | DNFAnd clause = new DNFAnd(new HashSet<>(parameters), Arrays.asList(personRelationAtom)); | 106 | DNFAnd clause = new DNFAnd(new HashSet<>(parameters), Arrays.asList(personRelationAtom)); |
112 | DNFPredicate predicate = new DNFPredicate("TypeConstraint", parameters, Arrays.asList(clause)); | 107 | DNFPredicate predicate = new DNFPredicate("TypeConstraint", parameters, Arrays.asList(clause)); |
113 | GenericQuerySpecification<GenericPatternMatcher> query = DNF2PQuery.translate(predicate).build(); | 108 | GenericQuerySpecification<RawPatternMatcher> query = DNF2PQuery.translate(predicate).build(); |
114 | 109 | ||
115 | ModelStore store = new ModelStoreImpl(Set.of(person, asset)); | 110 | ModelStore store = new ModelStoreImpl(Set.of(person, asset)); |
116 | Model model = store.createModel(); | 111 | Model model = store.createModel(); |
@@ -147,7 +142,7 @@ class QueryTest { | |||
147 | Arrays.asList(personRelationAtom1, personRelationAtom2, friendRelationAtom)); | 142 | Arrays.asList(personRelationAtom1, personRelationAtom2, friendRelationAtom)); |
148 | DNFPredicate predicate = new DNFPredicate("RelationConstraint", parameters, Arrays.asList(clause)); | 143 | DNFPredicate predicate = new DNFPredicate("RelationConstraint", parameters, Arrays.asList(clause)); |
149 | 144 | ||
150 | GenericQuerySpecification<GenericPatternMatcher> query = DNF2PQuery.translate(predicate).build(); | 145 | GenericQuerySpecification<RawPatternMatcher> query = DNF2PQuery.translate(predicate).build(); |
151 | 146 | ||
152 | ModelStore store = new ModelStoreImpl(Set.of(person, friend)); | 147 | ModelStore store = new ModelStoreImpl(Set.of(person, friend)); |
153 | Model model = store.createModel(); | 148 | Model model = store.createModel(); |
@@ -196,7 +191,7 @@ class QueryTest { | |||
196 | Arrays.asList(personRelationAtom3, personRelationAtom4, friendPredicateAtom)); | 191 | Arrays.asList(personRelationAtom3, personRelationAtom4, friendPredicateAtom)); |
197 | DNFPredicate predicate = new DNFPredicate("PatternCall", substitution, Arrays.asList(patternCallClause)); | 192 | DNFPredicate predicate = new DNFPredicate("PatternCall", substitution, Arrays.asList(patternCallClause)); |
198 | 193 | ||
199 | GenericQuerySpecification<GenericPatternMatcher> query = DNF2PQuery.translate(predicate).build(); | 194 | GenericQuerySpecification<RawPatternMatcher> query = DNF2PQuery.translate(predicate).build(); |
200 | 195 | ||
201 | ModelStore store = new ModelStoreImpl(Set.of(person, friend)); | 196 | ModelStore store = new ModelStoreImpl(Set.of(person, friend)); |
202 | Model model = store.createModel(); | 197 | Model model = store.createModel(); |
@@ -246,7 +241,7 @@ class QueryTest { | |||
246 | DNFPredicate predicate = new DNFPredicate("NegativePatternCall", substitution, | 241 | DNFPredicate predicate = new DNFPredicate("NegativePatternCall", substitution, |
247 | Arrays.asList(negativePatternCallClause)); | 242 | Arrays.asList(negativePatternCallClause)); |
248 | 243 | ||
249 | GenericQuerySpecification<GenericPatternMatcher> query = DNF2PQuery.translate(predicate).build(); | 244 | GenericQuerySpecification<RawPatternMatcher> query = DNF2PQuery.translate(predicate).build(); |
250 | 245 | ||
251 | ModelStore store = new ModelStoreImpl(Set.of(person, friend)); | 246 | ModelStore store = new ModelStoreImpl(Set.of(person, friend)); |
252 | Model model = store.createModel(); | 247 | Model model = store.createModel(); |
@@ -283,7 +278,7 @@ class QueryTest { | |||
283 | Arrays.asList(personRelationAtom1, personRelationAtom2, equivalenceAtom)); | 278 | Arrays.asList(personRelationAtom1, personRelationAtom2, equivalenceAtom)); |
284 | DNFPredicate predicate = new DNFPredicate("Equality", parameters, Arrays.asList(clause)); | 279 | DNFPredicate predicate = new DNFPredicate("Equality", parameters, Arrays.asList(clause)); |
285 | 280 | ||
286 | GenericQuerySpecification<GenericPatternMatcher> query = DNF2PQuery.translate(predicate).build(); | 281 | GenericQuerySpecification<RawPatternMatcher> query = DNF2PQuery.translate(predicate).build(); |
287 | 282 | ||
288 | ModelStore store = new ModelStoreImpl(Set.of(person)); | 283 | ModelStore store = new ModelStoreImpl(Set.of(person)); |
289 | Model model = store.createModel(); | 284 | Model model = store.createModel(); |
@@ -322,7 +317,7 @@ class QueryTest { | |||
322 | friendRelationAtom1, friendRelationAtom2, inequivalenceAtom)); | 317 | friendRelationAtom1, friendRelationAtom2, inequivalenceAtom)); |
323 | DNFPredicate predicate = new DNFPredicate("Inequality", parameters, Arrays.asList(clause)); | 318 | DNFPredicate predicate = new DNFPredicate("Inequality", parameters, Arrays.asList(clause)); |
324 | 319 | ||
325 | GenericQuerySpecification<GenericPatternMatcher> query = DNF2PQuery.translate(predicate).build(); | 320 | GenericQuerySpecification<RawPatternMatcher> query = DNF2PQuery.translate(predicate).build(); |
326 | 321 | ||
327 | ModelStore store = new ModelStoreImpl(Set.of(person, friend)); | 322 | ModelStore store = new ModelStoreImpl(Set.of(person, friend)); |
328 | Model model = store.createModel(); | 323 | Model model = store.createModel(); |
@@ -371,7 +366,7 @@ class QueryTest { | |||
371 | DNFPredicate predicate = new DNFPredicate("TransitivePatternCall", substitution, | 366 | DNFPredicate predicate = new DNFPredicate("TransitivePatternCall", substitution, |
372 | Arrays.asList(patternCallClause)); | 367 | Arrays.asList(patternCallClause)); |
373 | 368 | ||
374 | GenericQuerySpecification<GenericPatternMatcher> query = DNF2PQuery.translate(predicate).build(); | 369 | GenericQuerySpecification<RawPatternMatcher> query = DNF2PQuery.translate(predicate).build(); |
375 | 370 | ||
376 | ModelStore store = new ModelStoreImpl(Set.of(person, friend)); | 371 | ModelStore store = new ModelStoreImpl(Set.of(person, friend)); |
377 | Model model = store.createModel(); | 372 | Model model = store.createModel(); |
@@ -417,7 +412,7 @@ class QueryTest { | |||
417 | Arrays.asList(animalRelationAtom1, animalRelationAtom2, friendRelationAtom2)); | 412 | Arrays.asList(animalRelationAtom1, animalRelationAtom2, friendRelationAtom2)); |
418 | 413 | ||
419 | DNFPredicate predicate = new DNFPredicate("Or", parameters, Arrays.asList(clause1, clause2)); | 414 | DNFPredicate predicate = new DNFPredicate("Or", parameters, Arrays.asList(clause1, clause2)); |
420 | GenericQuerySpecification<GenericPatternMatcher> query = DNF2PQuery.translate(predicate).build(); | 415 | GenericQuerySpecification<RawPatternMatcher> query = DNF2PQuery.translate(predicate).build(); |
421 | 416 | ||
422 | ModelStore store = new ModelStoreImpl(Set.of(person, animal, friend)); | 417 | ModelStore store = new ModelStoreImpl(Set.of(person, animal, friend)); |
423 | Model model = store.createModel(); | 418 | Model model = store.createModel(); |