diff options
author | 2023-04-21 02:12:04 +0200 | |
---|---|---|
committer | 2023-04-21 02:34:52 +0200 | |
commit | ea0f09096afe05e2d414c707584e1e33c0c44383 (patch) | |
tree | 60763156db85be14e34aaf1b504ccbd1faad8bff /subprojects/store-query-viatra/src/test | |
parent | fix: REAL_SUM input and result type (diff) | |
download | refinery-ea0f09096afe05e2d414c707584e1e33c0c44383.tar.gz refinery-ea0f09096afe05e2d414c707584e1e33c0c44383.tar.zst refinery-ea0f09096afe05e2d414c707584e1e33c0c44383.zip |
refactor: simplify ModelAdapter
* Remove the reflection-based machinery around adapter types.
* Adapter builders, store adapters, and model adapters are now only associated
with each other based on static and runtime types.
* Simplifies writing new adapters.
* Hierarchical syntax for adding adapter builders to the store builder.
Diffstat (limited to 'subprojects/store-query-viatra/src/test')
4 files changed, 162 insertions, 163 deletions
diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/DiagonalQueryTest.java b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/DiagonalQueryTest.java index 3ff01064..56ddb9b4 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/DiagonalQueryTest.java +++ b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/DiagonalQueryTest.java | |||
@@ -7,7 +7,7 @@ package tools.refinery.store.query.viatra; | |||
7 | 7 | ||
8 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | 8 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; |
9 | import tools.refinery.store.model.ModelStore; | 9 | import tools.refinery.store.model.ModelStore; |
10 | import tools.refinery.store.query.ModelQuery; | 10 | import tools.refinery.store.query.ModelQueryAdapter; |
11 | import tools.refinery.store.query.dnf.Dnf; | 11 | import tools.refinery.store.query.dnf.Dnf; |
12 | import tools.refinery.store.query.dnf.Query; | 12 | import tools.refinery.store.query.dnf.Query; |
13 | import tools.refinery.store.query.viatra.tests.QueryEngineTest; | 13 | import tools.refinery.store.query.viatra.tests.QueryEngineTest; |
@@ -40,15 +40,15 @@ class DiagonalQueryTest { | |||
40 | 40 | ||
41 | var store = ModelStore.builder() | 41 | var store = ModelStore.builder() |
42 | .symbols(person, symbol) | 42 | .symbols(person, symbol) |
43 | .with(ViatraModelQuery.ADAPTER) | 43 | .with(ViatraModelQueryAdapter.builder() |
44 | .defaultHint(hint) | 44 | .defaultHint(hint) |
45 | .queries(query) | 45 | .queries(query)) |
46 | .build(); | 46 | .build(); |
47 | 47 | ||
48 | var model = store.createEmptyModel(); | 48 | var model = store.createEmptyModel(); |
49 | var personInterpretation = model.getInterpretation(person); | 49 | var personInterpretation = model.getInterpretation(person); |
50 | var symbolInterpretation = model.getInterpretation(symbol); | 50 | var symbolInterpretation = model.getInterpretation(symbol); |
51 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 51 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
52 | var queryResultSet = queryEngine.getResultSet(query); | 52 | var queryResultSet = queryEngine.getResultSet(query); |
53 | 53 | ||
54 | personInterpretation.put(Tuple.of(0), true); | 54 | personInterpretation.put(Tuple.of(0), true); |
@@ -97,15 +97,15 @@ class DiagonalQueryTest { | |||
97 | 97 | ||
98 | var store = ModelStore.builder() | 98 | var store = ModelStore.builder() |
99 | .symbols(person, symbol) | 99 | .symbols(person, symbol) |
100 | .with(ViatraModelQuery.ADAPTER) | 100 | .with(ViatraModelQueryAdapter.builder() |
101 | .defaultHint(hint) | 101 | .defaultHint(hint) |
102 | .queries(query) | 102 | .queries(query)) |
103 | .build(); | 103 | .build(); |
104 | 104 | ||
105 | var model = store.createEmptyModel(); | 105 | var model = store.createEmptyModel(); |
106 | var personInterpretation = model.getInterpretation(person); | 106 | var personInterpretation = model.getInterpretation(person); |
107 | var symbolInterpretation = model.getInterpretation(symbol); | 107 | var symbolInterpretation = model.getInterpretation(symbol); |
108 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 108 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
109 | var queryResultSet = queryEngine.getResultSet(query); | 109 | var queryResultSet = queryEngine.getResultSet(query); |
110 | 110 | ||
111 | personInterpretation.put(Tuple.of(0), true); | 111 | personInterpretation.put(Tuple.of(0), true); |
@@ -140,15 +140,15 @@ class DiagonalQueryTest { | |||
140 | 140 | ||
141 | var store = ModelStore.builder() | 141 | var store = ModelStore.builder() |
142 | .symbols(person, symbol) | 142 | .symbols(person, symbol) |
143 | .with(ViatraModelQuery.ADAPTER) | 143 | .with(ViatraModelQueryAdapter.builder() |
144 | .defaultHint(hint) | 144 | .defaultHint(hint) |
145 | .queries(query) | 145 | .queries(query)) |
146 | .build(); | 146 | .build(); |
147 | 147 | ||
148 | var model = store.createEmptyModel(); | 148 | var model = store.createEmptyModel(); |
149 | var personInterpretation = model.getInterpretation(person); | 149 | var personInterpretation = model.getInterpretation(person); |
150 | var symbolInterpretation = model.getInterpretation(symbol); | 150 | var symbolInterpretation = model.getInterpretation(symbol); |
151 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 151 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
152 | var queryResultSet = queryEngine.getResultSet(query); | 152 | var queryResultSet = queryEngine.getResultSet(query); |
153 | 153 | ||
154 | personInterpretation.put(Tuple.of(0), true); | 154 | personInterpretation.put(Tuple.of(0), true); |
@@ -198,15 +198,15 @@ class DiagonalQueryTest { | |||
198 | 198 | ||
199 | var store = ModelStore.builder() | 199 | var store = ModelStore.builder() |
200 | .symbols(person, symbol) | 200 | .symbols(person, symbol) |
201 | .with(ViatraModelQuery.ADAPTER) | 201 | .with(ViatraModelQueryAdapter.builder() |
202 | .defaultHint(hint) | 202 | .defaultHint(hint) |
203 | .queries(query) | 203 | .queries(query)) |
204 | .build(); | 204 | .build(); |
205 | 205 | ||
206 | var model = store.createEmptyModel(); | 206 | var model = store.createEmptyModel(); |
207 | var personInterpretation = model.getInterpretation(person); | 207 | var personInterpretation = model.getInterpretation(person); |
208 | var symbolInterpretation = model.getInterpretation(symbol); | 208 | var symbolInterpretation = model.getInterpretation(symbol); |
209 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 209 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
210 | var queryResultSet = queryEngine.getResultSet(query); | 210 | var queryResultSet = queryEngine.getResultSet(query); |
211 | 211 | ||
212 | personInterpretation.put(Tuple.of(0), true); | 212 | personInterpretation.put(Tuple.of(0), true); |
@@ -243,15 +243,15 @@ class DiagonalQueryTest { | |||
243 | 243 | ||
244 | var store = ModelStore.builder() | 244 | var store = ModelStore.builder() |
245 | .symbols(person, symbol) | 245 | .symbols(person, symbol) |
246 | .with(ViatraModelQuery.ADAPTER) | 246 | .with(ViatraModelQueryAdapter.builder() |
247 | .defaultHint(hint) | 247 | .defaultHint(hint) |
248 | .queries(query) | 248 | .queries(query)) |
249 | .build(); | 249 | .build(); |
250 | 250 | ||
251 | var model = store.createEmptyModel(); | 251 | var model = store.createEmptyModel(); |
252 | var personInterpretation = model.getInterpretation(person); | 252 | var personInterpretation = model.getInterpretation(person); |
253 | var symbolInterpretation = model.getInterpretation(symbol); | 253 | var symbolInterpretation = model.getInterpretation(symbol); |
254 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 254 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
255 | var queryResultSet = queryEngine.getResultSet(query); | 255 | var queryResultSet = queryEngine.getResultSet(query); |
256 | 256 | ||
257 | personInterpretation.put(Tuple.of(0), true); | 257 | personInterpretation.put(Tuple.of(0), true); |
@@ -306,15 +306,15 @@ class DiagonalQueryTest { | |||
306 | 306 | ||
307 | var store = ModelStore.builder() | 307 | var store = ModelStore.builder() |
308 | .symbols(person, symbol) | 308 | .symbols(person, symbol) |
309 | .with(ViatraModelQuery.ADAPTER) | 309 | .with(ViatraModelQueryAdapter.builder() |
310 | .defaultHint(hint) | 310 | .defaultHint(hint) |
311 | .queries(query) | 311 | .queries(query)) |
312 | .build(); | 312 | .build(); |
313 | 313 | ||
314 | var model = store.createEmptyModel(); | 314 | var model = store.createEmptyModel(); |
315 | var personInterpretation = model.getInterpretation(person); | 315 | var personInterpretation = model.getInterpretation(person); |
316 | var symbolInterpretation = model.getInterpretation(symbol); | 316 | var symbolInterpretation = model.getInterpretation(symbol); |
317 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 317 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
318 | var queryResultSet = queryEngine.getResultSet(query); | 318 | var queryResultSet = queryEngine.getResultSet(query); |
319 | 319 | ||
320 | personInterpretation.put(Tuple.of(0), true); | 320 | personInterpretation.put(Tuple.of(0), true); |
@@ -350,15 +350,15 @@ class DiagonalQueryTest { | |||
350 | 350 | ||
351 | var store = ModelStore.builder() | 351 | var store = ModelStore.builder() |
352 | .symbols(person, symbol) | 352 | .symbols(person, symbol) |
353 | .with(ViatraModelQuery.ADAPTER) | 353 | .with(ViatraModelQueryAdapter.builder() |
354 | .defaultHint(hint) | 354 | .defaultHint(hint) |
355 | .queries(query) | 355 | .queries(query)) |
356 | .build(); | 356 | .build(); |
357 | 357 | ||
358 | var model = store.createEmptyModel(); | 358 | var model = store.createEmptyModel(); |
359 | var personInterpretation = model.getInterpretation(person); | 359 | var personInterpretation = model.getInterpretation(person); |
360 | var symbolInterpretation = model.getInterpretation(symbol); | 360 | var symbolInterpretation = model.getInterpretation(symbol); |
361 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 361 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
362 | var queryResultSet = queryEngine.getResultSet(query); | 362 | var queryResultSet = queryEngine.getResultSet(query); |
363 | 363 | ||
364 | personInterpretation.put(Tuple.of(0), true); | 364 | personInterpretation.put(Tuple.of(0), true); |
@@ -404,15 +404,15 @@ class DiagonalQueryTest { | |||
404 | 404 | ||
405 | var store = ModelStore.builder() | 405 | var store = ModelStore.builder() |
406 | .symbols(person, symbol) | 406 | .symbols(person, symbol) |
407 | .with(ViatraModelQuery.ADAPTER) | 407 | .with(ViatraModelQueryAdapter.builder() |
408 | .defaultHint(hint) | 408 | .defaultHint(hint) |
409 | .queries(query) | 409 | .queries(query)) |
410 | .build(); | 410 | .build(); |
411 | 411 | ||
412 | var model = store.createEmptyModel(); | 412 | var model = store.createEmptyModel(); |
413 | var personInterpretation = model.getInterpretation(person); | 413 | var personInterpretation = model.getInterpretation(person); |
414 | var symbolInterpretation = model.getInterpretation(symbol); | 414 | var symbolInterpretation = model.getInterpretation(symbol); |
415 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 415 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
416 | var queryResultSet = queryEngine.getResultSet(query); | 416 | var queryResultSet = queryEngine.getResultSet(query); |
417 | 417 | ||
418 | personInterpretation.put(Tuple.of(0), true); | 418 | personInterpretation.put(Tuple.of(0), true); |
diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/FunctionalQueryTest.java b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/FunctionalQueryTest.java index ffa5e60b..98c8cd92 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/FunctionalQueryTest.java +++ b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/FunctionalQueryTest.java | |||
@@ -8,7 +8,7 @@ package tools.refinery.store.query.viatra; | |||
8 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | 8 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; |
9 | import tools.refinery.store.map.Cursor; | 9 | import tools.refinery.store.map.Cursor; |
10 | import tools.refinery.store.model.ModelStore; | 10 | import tools.refinery.store.model.ModelStore; |
11 | import tools.refinery.store.query.ModelQuery; | 11 | import tools.refinery.store.query.ModelQueryAdapter; |
12 | import tools.refinery.store.query.dnf.Dnf; | 12 | import tools.refinery.store.query.dnf.Dnf; |
13 | import tools.refinery.store.query.dnf.Query; | 13 | import tools.refinery.store.query.dnf.Query; |
14 | import tools.refinery.store.query.term.Variable; | 14 | import tools.refinery.store.query.term.Variable; |
@@ -49,15 +49,15 @@ class FunctionalQueryTest { | |||
49 | 49 | ||
50 | var store = ModelStore.builder() | 50 | var store = ModelStore.builder() |
51 | .symbols(person, age) | 51 | .symbols(person, age) |
52 | .with(ViatraModelQuery.ADAPTER) | 52 | .with(ViatraModelQueryAdapter.builder() |
53 | .defaultHint(hint) | 53 | .defaultHint(hint) |
54 | .queries(query) | 54 | .queries(query)) |
55 | .build(); | 55 | .build(); |
56 | 56 | ||
57 | var model = store.createEmptyModel(); | 57 | var model = store.createEmptyModel(); |
58 | var personInterpretation = model.getInterpretation(person); | 58 | var personInterpretation = model.getInterpretation(person); |
59 | var ageInterpretation = model.getInterpretation(age); | 59 | var ageInterpretation = model.getInterpretation(age); |
60 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 60 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
61 | var queryResultSet = queryEngine.getResultSet(query); | 61 | var queryResultSet = queryEngine.getResultSet(query); |
62 | 62 | ||
63 | personInterpretation.put(Tuple.of(0), true); | 63 | personInterpretation.put(Tuple.of(0), true); |
@@ -97,15 +97,15 @@ class FunctionalQueryTest { | |||
97 | 97 | ||
98 | var store = ModelStore.builder() | 98 | var store = ModelStore.builder() |
99 | .symbols(person, age) | 99 | .symbols(person, age) |
100 | .with(ViatraModelQuery.ADAPTER) | 100 | .with(ViatraModelQueryAdapter.builder() |
101 | .defaultHint(hint) | 101 | .defaultHint(hint) |
102 | .queries(query) | 102 | .queries(query)) |
103 | .build(); | 103 | .build(); |
104 | 104 | ||
105 | var model = store.createEmptyModel(); | 105 | var model = store.createEmptyModel(); |
106 | var personInterpretation = model.getInterpretation(person); | 106 | var personInterpretation = model.getInterpretation(person); |
107 | var ageInterpretation = model.getInterpretation(age); | 107 | var ageInterpretation = model.getInterpretation(age); |
108 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 108 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
109 | var queryResultSet = queryEngine.getResultSet(query); | 109 | var queryResultSet = queryEngine.getResultSet(query); |
110 | 110 | ||
111 | personInterpretation.put(Tuple.of(0), true); | 111 | personInterpretation.put(Tuple.of(0), true); |
@@ -141,15 +141,15 @@ class FunctionalQueryTest { | |||
141 | 141 | ||
142 | var store = ModelStore.builder() | 142 | var store = ModelStore.builder() |
143 | .symbols(person, age) | 143 | .symbols(person, age) |
144 | .with(ViatraModelQuery.ADAPTER) | 144 | .with(ViatraModelQueryAdapter.builder() |
145 | .defaultHint(hint) | 145 | .defaultHint(hint) |
146 | .queries(query) | 146 | .queries(query)) |
147 | .build(); | 147 | .build(); |
148 | 148 | ||
149 | var model = store.createEmptyModel(); | 149 | var model = store.createEmptyModel(); |
150 | var personInterpretation = model.getInterpretation(person); | 150 | var personInterpretation = model.getInterpretation(person); |
151 | var ageInterpretation = model.getInterpretation(age); | 151 | var ageInterpretation = model.getInterpretation(age); |
152 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 152 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
153 | var queryResultSet = queryEngine.getResultSet(query); | 153 | var queryResultSet = queryEngine.getResultSet(query); |
154 | 154 | ||
155 | personInterpretation.put(Tuple.of(0), true); | 155 | personInterpretation.put(Tuple.of(0), true); |
@@ -180,15 +180,15 @@ class FunctionalQueryTest { | |||
180 | 180 | ||
181 | var store = ModelStore.builder() | 181 | var store = ModelStore.builder() |
182 | .symbols(person, friend) | 182 | .symbols(person, friend) |
183 | .with(ViatraModelQuery.ADAPTER) | 183 | .with(ViatraModelQueryAdapter.builder() |
184 | .defaultHint(hint) | 184 | .defaultHint(hint) |
185 | .queries(query) | 185 | .queries(query)) |
186 | .build(); | 186 | .build(); |
187 | 187 | ||
188 | var model = store.createEmptyModel(); | 188 | var model = store.createEmptyModel(); |
189 | var personInterpretation = model.getInterpretation(person); | 189 | var personInterpretation = model.getInterpretation(person); |
190 | var friendInterpretation = model.getInterpretation(friend); | 190 | var friendInterpretation = model.getInterpretation(friend); |
191 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 191 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
192 | var queryResultSet = queryEngine.getResultSet(query); | 192 | var queryResultSet = queryEngine.getResultSet(query); |
193 | 193 | ||
194 | personInterpretation.put(Tuple.of(0), true); | 194 | personInterpretation.put(Tuple.of(0), true); |
@@ -231,15 +231,15 @@ class FunctionalQueryTest { | |||
231 | 231 | ||
232 | var store = ModelStore.builder() | 232 | var store = ModelStore.builder() |
233 | .symbols(person, friend) | 233 | .symbols(person, friend) |
234 | .with(ViatraModelQuery.ADAPTER) | 234 | .with(ViatraModelQueryAdapter.builder() |
235 | .defaultHint(hint) | 235 | .defaultHint(hint) |
236 | .queries(query) | 236 | .queries(query)) |
237 | .build(); | 237 | .build(); |
238 | 238 | ||
239 | var model = store.createEmptyModel(); | 239 | var model = store.createEmptyModel(); |
240 | var personInterpretation = model.getInterpretation(person); | 240 | var personInterpretation = model.getInterpretation(person); |
241 | var friendInterpretation = model.getInterpretation(friend); | 241 | var friendInterpretation = model.getInterpretation(friend); |
242 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 242 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
243 | var queryResultSet = queryEngine.getResultSet(query); | 243 | var queryResultSet = queryEngine.getResultSet(query); |
244 | 244 | ||
245 | personInterpretation.put(Tuple.of(0), true); | 245 | personInterpretation.put(Tuple.of(0), true); |
@@ -269,14 +269,14 @@ class FunctionalQueryTest { | |||
269 | 269 | ||
270 | var store = ModelStore.builder() | 270 | var store = ModelStore.builder() |
271 | .symbols(age) | 271 | .symbols(age) |
272 | .with(ViatraModelQuery.ADAPTER) | 272 | .with(ViatraModelQueryAdapter.builder() |
273 | .defaultHint(hint) | 273 | .defaultHint(hint) |
274 | .queries(query) | 274 | .queries(query)) |
275 | .build(); | 275 | .build(); |
276 | 276 | ||
277 | var model = store.createEmptyModel(); | 277 | var model = store.createEmptyModel(); |
278 | var ageInterpretation = model.getInterpretation(age); | 278 | var ageInterpretation = model.getInterpretation(age); |
279 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 279 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
280 | var queryResultSet = queryEngine.getResultSet(query); | 280 | var queryResultSet = queryEngine.getResultSet(query); |
281 | 281 | ||
282 | ageInterpretation.put(Tuple.of(0), 12); | 282 | ageInterpretation.put(Tuple.of(0), 12); |
@@ -306,15 +306,15 @@ class FunctionalQueryTest { | |||
306 | 306 | ||
307 | var store = ModelStore.builder() | 307 | var store = ModelStore.builder() |
308 | .symbols(person, age) | 308 | .symbols(person, age) |
309 | .with(ViatraModelQuery.ADAPTER) | 309 | .with(ViatraModelQueryAdapter.builder() |
310 | .defaultHint(hint) | 310 | .defaultHint(hint) |
311 | .queries(query) | 311 | .queries(query)) |
312 | .build(); | 312 | .build(); |
313 | 313 | ||
314 | var model = store.createEmptyModel(); | 314 | var model = store.createEmptyModel(); |
315 | var personInterpretation = model.getInterpretation(person); | 315 | var personInterpretation = model.getInterpretation(person); |
316 | var ageInterpretation = model.getInterpretation(age); | 316 | var ageInterpretation = model.getInterpretation(age); |
317 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 317 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
318 | var queryResultSet = queryEngine.getResultSet(query); | 318 | var queryResultSet = queryEngine.getResultSet(query); |
319 | 319 | ||
320 | personInterpretation.put(Tuple.of(0), true); | 320 | personInterpretation.put(Tuple.of(0), true); |
@@ -349,15 +349,15 @@ class FunctionalQueryTest { | |||
349 | 349 | ||
350 | var store = ModelStore.builder() | 350 | var store = ModelStore.builder() |
351 | .symbols(person, friend) | 351 | .symbols(person, friend) |
352 | .with(ViatraModelQuery.ADAPTER) | 352 | .with(ViatraModelQueryAdapter.builder() |
353 | .defaultHint(hint) | 353 | .defaultHint(hint) |
354 | .queries(minQuery, maxQuery) | 354 | .queries(minQuery, maxQuery)) |
355 | .build(); | 355 | .build(); |
356 | 356 | ||
357 | var model = store.createEmptyModel(); | 357 | var model = store.createEmptyModel(); |
358 | var personInterpretation = model.getInterpretation(person); | 358 | var personInterpretation = model.getInterpretation(person); |
359 | var friendInterpretation = model.getInterpretation(friend); | 359 | var friendInterpretation = model.getInterpretation(friend); |
360 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 360 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
361 | var minResultSet = queryEngine.getResultSet(minQuery); | 361 | var minResultSet = queryEngine.getResultSet(minQuery); |
362 | var maxResultSet = queryEngine.getResultSet(maxQuery); | 362 | var maxResultSet = queryEngine.getResultSet(maxQuery); |
363 | 363 | ||
@@ -408,15 +408,15 @@ class FunctionalQueryTest { | |||
408 | 408 | ||
409 | var store = ModelStore.builder() | 409 | var store = ModelStore.builder() |
410 | .symbols(person, age) | 410 | .symbols(person, age) |
411 | .with(ViatraModelQuery.ADAPTER) | 411 | .with(ViatraModelQueryAdapter.builder() |
412 | .defaultHint(hint) | 412 | .defaultHint(hint) |
413 | .queries(query) | 413 | .queries(query)) |
414 | .build(); | 414 | .build(); |
415 | 415 | ||
416 | var model = store.createEmptyModel(); | 416 | var model = store.createEmptyModel(); |
417 | var personInterpretation = model.getInterpretation(person); | 417 | var personInterpretation = model.getInterpretation(person); |
418 | var ageInterpretation = model.getInterpretation(age); | 418 | var ageInterpretation = model.getInterpretation(age); |
419 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 419 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
420 | var queryResultSet = queryEngine.getResultSet(query); | 420 | var queryResultSet = queryEngine.getResultSet(query); |
421 | 421 | ||
422 | personInterpretation.put(Tuple.of(0), true); | 422 | personInterpretation.put(Tuple.of(0), true); |
@@ -448,15 +448,15 @@ class FunctionalQueryTest { | |||
448 | 448 | ||
449 | var store = ModelStore.builder() | 449 | var store = ModelStore.builder() |
450 | .symbols(person, age) | 450 | .symbols(person, age) |
451 | .with(ViatraModelQuery.ADAPTER) | 451 | .with(ViatraModelQueryAdapter.builder() |
452 | .defaultHint(hint) | 452 | .defaultHint(hint) |
453 | .queries(query) | 453 | .queries(query)) |
454 | .build(); | 454 | .build(); |
455 | 455 | ||
456 | var model = store.createEmptyModel(); | 456 | var model = store.createEmptyModel(); |
457 | var personInterpretation = model.getInterpretation(person); | 457 | var personInterpretation = model.getInterpretation(person); |
458 | var ageInterpretation = model.getInterpretation(age); | 458 | var ageInterpretation = model.getInterpretation(age); |
459 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 459 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
460 | var queryResultSet = queryEngine.getResultSet(query); | 460 | var queryResultSet = queryEngine.getResultSet(query); |
461 | 461 | ||
462 | personInterpretation.put(Tuple.of(0), true); | 462 | personInterpretation.put(Tuple.of(0), true); |
@@ -493,16 +493,16 @@ class FunctionalQueryTest { | |||
493 | 493 | ||
494 | var store = ModelStore.builder() | 494 | var store = ModelStore.builder() |
495 | .symbols(person, age, friend) | 495 | .symbols(person, age, friend) |
496 | .with(ViatraModelQuery.ADAPTER) | 496 | .with(ViatraModelQueryAdapter.builder() |
497 | .defaultHint(hint) | 497 | .defaultHint(hint) |
498 | .query(query) | 498 | .queries(query)) |
499 | .build(); | 499 | .build(); |
500 | 500 | ||
501 | var model = store.createEmptyModel(); | 501 | var model = store.createEmptyModel(); |
502 | var personInterpretation = model.getInterpretation(person); | 502 | var personInterpretation = model.getInterpretation(person); |
503 | var ageInterpretation = model.getInterpretation(age); | 503 | var ageInterpretation = model.getInterpretation(age); |
504 | var friendInterpretation = model.getInterpretation(friend); | 504 | var friendInterpretation = model.getInterpretation(friend); |
505 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 505 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
506 | var queryResultSet = queryEngine.getResultSet(query); | 506 | var queryResultSet = queryEngine.getResultSet(query); |
507 | 507 | ||
508 | personInterpretation.put(Tuple.of(0), true); | 508 | personInterpretation.put(Tuple.of(0), true); |
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 a90889c6..46ce37b4 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 | |||
@@ -8,7 +8,7 @@ package tools.refinery.store.query.viatra; | |||
8 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | 8 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; |
9 | import org.junit.jupiter.api.Test; | 9 | import org.junit.jupiter.api.Test; |
10 | import tools.refinery.store.model.ModelStore; | 10 | import tools.refinery.store.model.ModelStore; |
11 | import tools.refinery.store.query.ModelQuery; | 11 | import tools.refinery.store.query.ModelQueryAdapter; |
12 | import tools.refinery.store.query.dnf.Dnf; | 12 | import tools.refinery.store.query.dnf.Dnf; |
13 | import tools.refinery.store.query.dnf.Query; | 13 | import tools.refinery.store.query.dnf.Query; |
14 | import tools.refinery.store.query.term.Variable; | 14 | import tools.refinery.store.query.term.Variable; |
@@ -41,15 +41,15 @@ class QueryTest { | |||
41 | 41 | ||
42 | var store = ModelStore.builder() | 42 | var store = ModelStore.builder() |
43 | .symbols(person, asset) | 43 | .symbols(person, asset) |
44 | .with(ViatraModelQuery.ADAPTER) | 44 | .with(ViatraModelQueryAdapter.builder() |
45 | .defaultHint(hint) | 45 | .defaultHint(hint) |
46 | .query(predicate) | 46 | .queries(predicate)) |
47 | .build(); | 47 | .build(); |
48 | 48 | ||
49 | var model = store.createEmptyModel(); | 49 | var model = store.createEmptyModel(); |
50 | var personInterpretation = model.getInterpretation(person); | 50 | var personInterpretation = model.getInterpretation(person); |
51 | var assetInterpretation = model.getInterpretation(asset); | 51 | var assetInterpretation = model.getInterpretation(asset); |
52 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 52 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
53 | var predicateResultSet = queryEngine.getResultSet(predicate); | 53 | var predicateResultSet = queryEngine.getResultSet(predicate); |
54 | 54 | ||
55 | personInterpretation.put(Tuple.of(0), true); | 55 | personInterpretation.put(Tuple.of(0), true); |
@@ -81,15 +81,15 @@ class QueryTest { | |||
81 | 81 | ||
82 | var store = ModelStore.builder() | 82 | var store = ModelStore.builder() |
83 | .symbols(person, friend) | 83 | .symbols(person, friend) |
84 | .with(ViatraModelQuery.ADAPTER) | 84 | .with(ViatraModelQueryAdapter.builder() |
85 | .defaultHint(hint) | 85 | .defaultHint(hint) |
86 | .queries(predicate) | 86 | .queries(predicate)) |
87 | .build(); | 87 | .build(); |
88 | 88 | ||
89 | var model = store.createEmptyModel(); | 89 | var model = store.createEmptyModel(); |
90 | var personInterpretation = model.getInterpretation(person); | 90 | var personInterpretation = model.getInterpretation(person); |
91 | var friendInterpretation = model.getInterpretation(friend); | 91 | var friendInterpretation = model.getInterpretation(friend); |
92 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 92 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
93 | var predicateResultSet = queryEngine.getResultSet(predicate); | 93 | var predicateResultSet = queryEngine.getResultSet(predicate); |
94 | 94 | ||
95 | personInterpretation.put(Tuple.of(0), true); | 95 | personInterpretation.put(Tuple.of(0), true); |
@@ -125,15 +125,15 @@ class QueryTest { | |||
125 | 125 | ||
126 | var store = ModelStore.builder() | 126 | var store = ModelStore.builder() |
127 | .symbols(person, friend) | 127 | .symbols(person, friend) |
128 | .with(ViatraModelQuery.ADAPTER) | 128 | .with(ViatraModelQueryAdapter.builder() |
129 | .defaultHint(hint) | 129 | .defaultHint(hint) |
130 | .queries(predicate) | 130 | .queries(predicate)) |
131 | .build(); | 131 | .build(); |
132 | 132 | ||
133 | var model = store.createEmptyModel(); | 133 | var model = store.createEmptyModel(); |
134 | var personInterpretation = model.getInterpretation(person); | 134 | var personInterpretation = model.getInterpretation(person); |
135 | var friendInterpretation = model.getInterpretation(friend); | 135 | var friendInterpretation = model.getInterpretation(friend); |
136 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 136 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
137 | var predicateResultSet = queryEngine.getResultSet(predicate); | 137 | var predicateResultSet = queryEngine.getResultSet(predicate); |
138 | 138 | ||
139 | personInterpretation.put(Tuple.of(0), true); | 139 | personInterpretation.put(Tuple.of(0), true); |
@@ -175,16 +175,16 @@ class QueryTest { | |||
175 | 175 | ||
176 | var store = ModelStore.builder() | 176 | var store = ModelStore.builder() |
177 | .symbols(person, animal, friend) | 177 | .symbols(person, animal, friend) |
178 | .with(ViatraModelQuery.ADAPTER) | 178 | .with(ViatraModelQueryAdapter.builder() |
179 | .defaultHint(hint) | 179 | .defaultHint(hint) |
180 | .queries(predicate) | 180 | .queries(predicate)) |
181 | .build(); | 181 | .build(); |
182 | 182 | ||
183 | var model = store.createEmptyModel(); | 183 | var model = store.createEmptyModel(); |
184 | var personInterpretation = model.getInterpretation(person); | 184 | var personInterpretation = model.getInterpretation(person); |
185 | var animalInterpretation = model.getInterpretation(animal); | 185 | var animalInterpretation = model.getInterpretation(animal); |
186 | var friendInterpretation = model.getInterpretation(friend); | 186 | var friendInterpretation = model.getInterpretation(friend); |
187 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 187 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
188 | var predicateResultSet = queryEngine.getResultSet(predicate); | 188 | var predicateResultSet = queryEngine.getResultSet(predicate); |
189 | 189 | ||
190 | personInterpretation.put(Tuple.of(0), true); | 190 | personInterpretation.put(Tuple.of(0), true); |
@@ -221,14 +221,14 @@ class QueryTest { | |||
221 | 221 | ||
222 | var store = ModelStore.builder() | 222 | var store = ModelStore.builder() |
223 | .symbols(person) | 223 | .symbols(person) |
224 | .with(ViatraModelQuery.ADAPTER) | 224 | .with(ViatraModelQueryAdapter.builder() |
225 | .defaultHint(hint) | 225 | .defaultHint(hint) |
226 | .queries(predicate) | 226 | .queries(predicate)) |
227 | .build(); | 227 | .build(); |
228 | 228 | ||
229 | var model = store.createEmptyModel(); | 229 | var model = store.createEmptyModel(); |
230 | var personInterpretation = model.getInterpretation(person); | 230 | var personInterpretation = model.getInterpretation(person); |
231 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 231 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
232 | var predicateResultSet = queryEngine.getResultSet(predicate); | 232 | var predicateResultSet = queryEngine.getResultSet(predicate); |
233 | 233 | ||
234 | personInterpretation.put(Tuple.of(0), true); | 234 | personInterpretation.put(Tuple.of(0), true); |
@@ -262,15 +262,15 @@ class QueryTest { | |||
262 | 262 | ||
263 | var store = ModelStore.builder() | 263 | var store = ModelStore.builder() |
264 | .symbols(person, friend) | 264 | .symbols(person, friend) |
265 | .with(ViatraModelQuery.ADAPTER) | 265 | .with(ViatraModelQueryAdapter.builder() |
266 | .defaultHint(hint) | 266 | .defaultHint(hint) |
267 | .queries(predicate) | 267 | .queries(predicate)) |
268 | .build(); | 268 | .build(); |
269 | 269 | ||
270 | var model = store.createEmptyModel(); | 270 | var model = store.createEmptyModel(); |
271 | var personInterpretation = model.getInterpretation(person); | 271 | var personInterpretation = model.getInterpretation(person); |
272 | var friendInterpretation = model.getInterpretation(friend); | 272 | var friendInterpretation = model.getInterpretation(friend); |
273 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 273 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
274 | var predicateResultSet = queryEngine.getResultSet(predicate); | 274 | var predicateResultSet = queryEngine.getResultSet(predicate); |
275 | 275 | ||
276 | personInterpretation.put(Tuple.of(0), true); | 276 | personInterpretation.put(Tuple.of(0), true); |
@@ -312,15 +312,15 @@ class QueryTest { | |||
312 | 312 | ||
313 | var store = ModelStore.builder() | 313 | var store = ModelStore.builder() |
314 | .symbols(person, friend) | 314 | .symbols(person, friend) |
315 | .with(ViatraModelQuery.ADAPTER) | 315 | .with(ViatraModelQueryAdapter.builder() |
316 | .defaultHint(hint) | 316 | .defaultHint(hint) |
317 | .queries(predicate) | 317 | .queries(predicate)) |
318 | .build(); | 318 | .build(); |
319 | 319 | ||
320 | var model = store.createEmptyModel(); | 320 | var model = store.createEmptyModel(); |
321 | var personInterpretation = model.getInterpretation(person); | 321 | var personInterpretation = model.getInterpretation(person); |
322 | var friendInterpretation = model.getInterpretation(friend); | 322 | var friendInterpretation = model.getInterpretation(friend); |
323 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 323 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
324 | var predicateResultSet = queryEngine.getResultSet(predicate); | 324 | var predicateResultSet = queryEngine.getResultSet(predicate); |
325 | 325 | ||
326 | personInterpretation.put(Tuple.of(0), true); | 326 | personInterpretation.put(Tuple.of(0), true); |
@@ -355,15 +355,15 @@ class QueryTest { | |||
355 | 355 | ||
356 | var store = ModelStore.builder() | 356 | var store = ModelStore.builder() |
357 | .symbols(person, friend) | 357 | .symbols(person, friend) |
358 | .with(ViatraModelQuery.ADAPTER) | 358 | .with(ViatraModelQueryAdapter.builder() |
359 | .defaultHint(hint) | 359 | .defaultHint(hint) |
360 | .queries(predicate) | 360 | .queries(predicate)) |
361 | .build(); | 361 | .build(); |
362 | 362 | ||
363 | var model = store.createEmptyModel(); | 363 | var model = store.createEmptyModel(); |
364 | var personInterpretation = model.getInterpretation(person); | 364 | var personInterpretation = model.getInterpretation(person); |
365 | var friendInterpretation = model.getInterpretation(friend); | 365 | var friendInterpretation = model.getInterpretation(friend); |
366 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 366 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
367 | var predicateResultSet = queryEngine.getResultSet(predicate); | 367 | var predicateResultSet = queryEngine.getResultSet(predicate); |
368 | 368 | ||
369 | personInterpretation.put(Tuple.of(0), true); | 369 | personInterpretation.put(Tuple.of(0), true); |
@@ -413,15 +413,15 @@ class QueryTest { | |||
413 | 413 | ||
414 | var store = ModelStore.builder() | 414 | var store = ModelStore.builder() |
415 | .symbols(person, friend) | 415 | .symbols(person, friend) |
416 | .with(ViatraModelQuery.ADAPTER) | 416 | .with(ViatraModelQueryAdapter.builder() |
417 | .defaultHint(hint) | 417 | .defaultHint(hint) |
418 | .queries(predicate) | 418 | .queries(predicate)) |
419 | .build(); | 419 | .build(); |
420 | 420 | ||
421 | var model = store.createEmptyModel(); | 421 | var model = store.createEmptyModel(); |
422 | var personInterpretation = model.getInterpretation(person); | 422 | var personInterpretation = model.getInterpretation(person); |
423 | var friendInterpretation = model.getInterpretation(friend); | 423 | var friendInterpretation = model.getInterpretation(friend); |
424 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 424 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
425 | var predicateResultSet = queryEngine.getResultSet(predicate); | 425 | var predicateResultSet = queryEngine.getResultSet(predicate); |
426 | 426 | ||
427 | personInterpretation.put(Tuple.of(0), true); | 427 | personInterpretation.put(Tuple.of(0), true); |
@@ -461,15 +461,15 @@ class QueryTest { | |||
461 | 461 | ||
462 | var store = ModelStore.builder() | 462 | var store = ModelStore.builder() |
463 | .symbols(person, friend) | 463 | .symbols(person, friend) |
464 | .with(ViatraModelQuery.ADAPTER) | 464 | .with(ViatraModelQueryAdapter.builder() |
465 | .defaultHint(hint) | 465 | .defaultHint(hint) |
466 | .queries(predicate) | 466 | .queries(predicate)) |
467 | .build(); | 467 | .build(); |
468 | 468 | ||
469 | var model = store.createEmptyModel(); | 469 | var model = store.createEmptyModel(); |
470 | var personInterpretation = model.getInterpretation(person); | 470 | var personInterpretation = model.getInterpretation(person); |
471 | var friendInterpretation = model.getInterpretation(friend); | 471 | var friendInterpretation = model.getInterpretation(friend); |
472 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 472 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
473 | var predicateResultSet = queryEngine.getResultSet(predicate); | 473 | var predicateResultSet = queryEngine.getResultSet(predicate); |
474 | 474 | ||
475 | personInterpretation.put(Tuple.of(0), true); | 475 | personInterpretation.put(Tuple.of(0), true); |
@@ -511,15 +511,15 @@ class QueryTest { | |||
511 | 511 | ||
512 | var store = ModelStore.builder() | 512 | var store = ModelStore.builder() |
513 | .symbols(person, friend) | 513 | .symbols(person, friend) |
514 | .with(ViatraModelQuery.ADAPTER) | 514 | .with(ViatraModelQueryAdapter.builder() |
515 | .defaultHint(hint) | 515 | .defaultHint(hint) |
516 | .queries(predicate) | 516 | .queries(predicate)) |
517 | .build(); | 517 | .build(); |
518 | 518 | ||
519 | var model = store.createEmptyModel(); | 519 | var model = store.createEmptyModel(); |
520 | var personInterpretation = model.getInterpretation(person); | 520 | var personInterpretation = model.getInterpretation(person); |
521 | var friendInterpretation = model.getInterpretation(friend); | 521 | var friendInterpretation = model.getInterpretation(friend); |
522 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 522 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
523 | var predicateResultSet = queryEngine.getResultSet(predicate); | 523 | var predicateResultSet = queryEngine.getResultSet(predicate); |
524 | 524 | ||
525 | personInterpretation.put(Tuple.of(0), true); | 525 | personInterpretation.put(Tuple.of(0), true); |
@@ -553,15 +553,15 @@ class QueryTest { | |||
553 | 553 | ||
554 | var store = ModelStore.builder() | 554 | var store = ModelStore.builder() |
555 | .symbols(person, friend) | 555 | .symbols(person, friend) |
556 | .with(ViatraModelQuery.ADAPTER) | 556 | .with(ViatraModelQueryAdapter.builder() |
557 | .defaultHint(hint) | 557 | .defaultHint(hint) |
558 | .queries(predicate) | 558 | .queries(predicate)) |
559 | .build(); | 559 | .build(); |
560 | 560 | ||
561 | var model = store.createEmptyModel(); | 561 | var model = store.createEmptyModel(); |
562 | var personInterpretation = model.getInterpretation(person); | 562 | var personInterpretation = model.getInterpretation(person); |
563 | var friendInterpretation = model.getInterpretation(friend); | 563 | var friendInterpretation = model.getInterpretation(friend); |
564 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 564 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
565 | var predicateResultSet = queryEngine.getResultSet(predicate); | 565 | var predicateResultSet = queryEngine.getResultSet(predicate); |
566 | 566 | ||
567 | personInterpretation.put(Tuple.of(0), true); | 567 | personInterpretation.put(Tuple.of(0), true); |
@@ -610,15 +610,15 @@ class QueryTest { | |||
610 | 610 | ||
611 | var store = ModelStore.builder() | 611 | var store = ModelStore.builder() |
612 | .symbols(person, friend) | 612 | .symbols(person, friend) |
613 | .with(ViatraModelQuery.ADAPTER) | 613 | .with(ViatraModelQueryAdapter.builder() |
614 | .defaultHint(hint) | 614 | .defaultHint(hint) |
615 | .queries(predicate) | 615 | .queries(predicate)) |
616 | .build(); | 616 | .build(); |
617 | 617 | ||
618 | var model = store.createEmptyModel(); | 618 | var model = store.createEmptyModel(); |
619 | var personInterpretation = model.getInterpretation(person); | 619 | var personInterpretation = model.getInterpretation(person); |
620 | var friendInterpretation = model.getInterpretation(friend); | 620 | var friendInterpretation = model.getInterpretation(friend); |
621 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 621 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
622 | var predicateResultSet = queryEngine.getResultSet(predicate); | 622 | var predicateResultSet = queryEngine.getResultSet(predicate); |
623 | 623 | ||
624 | personInterpretation.put(Tuple.of(0), true); | 624 | personInterpretation.put(Tuple.of(0), true); |
@@ -658,15 +658,15 @@ class QueryTest { | |||
658 | 658 | ||
659 | var store = ModelStore.builder() | 659 | var store = ModelStore.builder() |
660 | .symbols(person, age) | 660 | .symbols(person, age) |
661 | .with(ViatraModelQuery.ADAPTER) | 661 | .with(ViatraModelQueryAdapter.builder() |
662 | .defaultHint(hint) | 662 | .defaultHint(hint) |
663 | .queries(query) | 663 | .queries(query)) |
664 | .build(); | 664 | .build(); |
665 | 665 | ||
666 | var model = store.createEmptyModel(); | 666 | var model = store.createEmptyModel(); |
667 | var personInterpretation = model.getInterpretation(person); | 667 | var personInterpretation = model.getInterpretation(person); |
668 | var ageInterpretation = model.getInterpretation(age); | 668 | var ageInterpretation = model.getInterpretation(age); |
669 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 669 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
670 | var queryResultSet = queryEngine.getResultSet(query); | 670 | var queryResultSet = queryEngine.getResultSet(query); |
671 | 671 | ||
672 | personInterpretation.put(Tuple.of(0), true); | 672 | personInterpretation.put(Tuple.of(0), true); |
@@ -691,13 +691,13 @@ class QueryTest { | |||
691 | 691 | ||
692 | var store = ModelStore.builder() | 692 | var store = ModelStore.builder() |
693 | .symbols(person) | 693 | .symbols(person) |
694 | .with(ViatraModelQuery.ADAPTER) | 694 | .with(ViatraModelQueryAdapter.builder() |
695 | .queries(predicate) | 695 | .queries(predicate)) |
696 | .build(); | 696 | .build(); |
697 | 697 | ||
698 | var model = store.createEmptyModel(); | 698 | var model = store.createEmptyModel(); |
699 | var personInterpretation = model.getInterpretation(person); | 699 | var personInterpretation = model.getInterpretation(person); |
700 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 700 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
701 | var predicateResultSet = queryEngine.getResultSet(predicate); | 701 | var predicateResultSet = queryEngine.getResultSet(predicate); |
702 | 702 | ||
703 | personInterpretation.put(Tuple.of(0), true); | 703 | personInterpretation.put(Tuple.of(0), true); |
@@ -713,8 +713,7 @@ class QueryTest { | |||
713 | var p1 = Variable.of("p1"); | 713 | var p1 = Variable.of("p1"); |
714 | var predicate = Query.builder("AlwaysTrue").parameters(p1).clause().build(); | 714 | var predicate = Query.builder("AlwaysTrue").parameters(p1).clause().build(); |
715 | 715 | ||
716 | var storeBuilder = ModelStore.builder().symbols(person); | 716 | var queryBuilder = ViatraModelQueryAdapter.builder(); |
717 | var queryBuilder = storeBuilder.with(ViatraModelQuery.ADAPTER); | ||
718 | 717 | ||
719 | assertThrows(IllegalArgumentException.class, () -> queryBuilder.queries(predicate)); | 718 | assertThrows(IllegalArgumentException.class, () -> queryBuilder.queries(predicate)); |
720 | } | 719 | } |
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 9de2655f..6860ece9 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 | |||
@@ -9,7 +9,7 @@ import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | |||
9 | import org.junit.jupiter.api.Disabled; | 9 | import org.junit.jupiter.api.Disabled; |
10 | import org.junit.jupiter.api.Test; | 10 | import org.junit.jupiter.api.Test; |
11 | import tools.refinery.store.model.ModelStore; | 11 | import tools.refinery.store.model.ModelStore; |
12 | import tools.refinery.store.query.ModelQuery; | 12 | import tools.refinery.store.query.ModelQueryAdapter; |
13 | import tools.refinery.store.query.dnf.Query; | 13 | import tools.refinery.store.query.dnf.Query; |
14 | import tools.refinery.store.query.view.FilteredView; | 14 | import tools.refinery.store.query.view.FilteredView; |
15 | import tools.refinery.store.query.view.FunctionView; | 15 | import tools.refinery.store.query.view.FunctionView; |
@@ -35,13 +35,13 @@ class QueryTransactionTest { | |||
35 | 35 | ||
36 | var store = ModelStore.builder() | 36 | var store = ModelStore.builder() |
37 | .symbols(person) | 37 | .symbols(person) |
38 | .with(ViatraModelQuery.ADAPTER) | 38 | .with(ViatraModelQueryAdapter.builder() |
39 | .queries(predicate) | 39 | .queries(predicate)) |
40 | .build(); | 40 | .build(); |
41 | 41 | ||
42 | var model = store.createEmptyModel(); | 42 | var model = store.createEmptyModel(); |
43 | var personInterpretation = model.getInterpretation(person); | 43 | var personInterpretation = model.getInterpretation(person); |
44 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 44 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
45 | var predicateResultSet = queryEngine.getResultSet(predicate); | 45 | var predicateResultSet = queryEngine.getResultSet(predicate); |
46 | 46 | ||
47 | assertResults(Map.of( | 47 | assertResults(Map.of( |
@@ -102,14 +102,14 @@ class QueryTransactionTest { | |||
102 | 102 | ||
103 | var store = ModelStore.builder() | 103 | var store = ModelStore.builder() |
104 | .symbols(person) | 104 | .symbols(person) |
105 | .with(ViatraModelQuery.ADAPTER) | 105 | .with(ViatraModelQueryAdapter.builder() |
106 | .defaultHint(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.DEFAULT_SEARCH)) | 106 | .defaultHint(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.DEFAULT_SEARCH)) |
107 | .queries(predicate) | 107 | .queries(predicate)) |
108 | .build(); | 108 | .build(); |
109 | 109 | ||
110 | var model = store.createEmptyModel(); | 110 | var model = store.createEmptyModel(); |
111 | var personInterpretation = model.getInterpretation(person); | 111 | var personInterpretation = model.getInterpretation(person); |
112 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 112 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
113 | var predicateResultSet = queryEngine.getResultSet(predicate); | 113 | var predicateResultSet = queryEngine.getResultSet(predicate); |
114 | 114 | ||
115 | assertResults(Map.of( | 115 | assertResults(Map.of( |
@@ -153,14 +153,14 @@ class QueryTransactionTest { | |||
153 | 153 | ||
154 | var store = ModelStore.builder() | 154 | var store = ModelStore.builder() |
155 | .symbols(person, asset) | 155 | .symbols(person, asset) |
156 | .with(ViatraModelQuery.ADAPTER) | 156 | .with(ViatraModelQueryAdapter.builder() |
157 | .queries(predicate) | 157 | .queries(predicate)) |
158 | .build(); | 158 | .build(); |
159 | 159 | ||
160 | var model = store.createEmptyModel(); | 160 | var model = store.createEmptyModel(); |
161 | var personInterpretation = model.getInterpretation(person); | 161 | var personInterpretation = model.getInterpretation(person); |
162 | var assetInterpretation = model.getInterpretation(asset); | 162 | var assetInterpretation = model.getInterpretation(asset); |
163 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 163 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
164 | var predicateResultSet = queryEngine.getResultSet(predicate); | 164 | var predicateResultSet = queryEngine.getResultSet(predicate); |
165 | 165 | ||
166 | assertFalse(queryEngine.hasPendingChanges()); | 166 | assertFalse(queryEngine.hasPendingChanges()); |
@@ -226,14 +226,14 @@ class QueryTransactionTest { | |||
226 | 226 | ||
227 | var store = ModelStore.builder() | 227 | var store = ModelStore.builder() |
228 | .symbols(person, age) | 228 | .symbols(person, age) |
229 | .with(ViatraModelQuery.ADAPTER) | 229 | .with(ViatraModelQueryAdapter.builder() |
230 | .query(query) | 230 | .queries(query)) |
231 | .build(); | 231 | .build(); |
232 | 232 | ||
233 | var model = store.createEmptyModel(); | 233 | var model = store.createEmptyModel(); |
234 | var personInterpretation = model.getInterpretation(person); | 234 | var personInterpretation = model.getInterpretation(person); |
235 | var ageInterpretation = model.getInterpretation(age); | 235 | var ageInterpretation = model.getInterpretation(age); |
236 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 236 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
237 | var queryResultSet = queryEngine.getResultSet(query); | 237 | var queryResultSet = queryEngine.getResultSet(query); |
238 | 238 | ||
239 | personInterpretation.put(Tuple.of(0), true); | 239 | personInterpretation.put(Tuple.of(0), true); |
@@ -268,14 +268,14 @@ class QueryTransactionTest { | |||
268 | 268 | ||
269 | var store = ModelStore.builder() | 269 | var store = ModelStore.builder() |
270 | .symbols(person, age) | 270 | .symbols(person, age) |
271 | .with(ViatraModelQuery.ADAPTER) | 271 | .with(ViatraModelQueryAdapter.builder() |
272 | .query(query) | 272 | .queries(query)) |
273 | .build(); | 273 | .build(); |
274 | 274 | ||
275 | var model = store.createEmptyModel(); | 275 | var model = store.createEmptyModel(); |
276 | var personInterpretation = model.getInterpretation(person); | 276 | var personInterpretation = model.getInterpretation(person); |
277 | var ageInterpretation = model.getInterpretation(age); | 277 | var ageInterpretation = model.getInterpretation(age); |
278 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 278 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
279 | var queryResultSet = queryEngine.getResultSet(query); | 279 | var queryResultSet = queryEngine.getResultSet(query); |
280 | 280 | ||
281 | personInterpretation.put(Tuple.of(0), true); | 281 | personInterpretation.put(Tuple.of(0), true); |
@@ -306,13 +306,13 @@ class QueryTransactionTest { | |||
306 | 306 | ||
307 | var store = ModelStore.builder() | 307 | var store = ModelStore.builder() |
308 | .symbols(person) | 308 | .symbols(person) |
309 | .with(ViatraModelQuery.ADAPTER) | 309 | .with(ViatraModelQueryAdapter.builder() |
310 | .queries(predicate) | 310 | .queries(predicate)) |
311 | .build(); | 311 | .build(); |
312 | 312 | ||
313 | var model = store.createEmptyModel(); | 313 | var model = store.createEmptyModel(); |
314 | var personInterpretation = model.getInterpretation(person); | 314 | var personInterpretation = model.getInterpretation(person); |
315 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 315 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
316 | var predicateResultSet = queryEngine.getResultSet(predicate); | 316 | var predicateResultSet = queryEngine.getResultSet(predicate); |
317 | 317 | ||
318 | personInterpretation.put(Tuple.of(0), true); | 318 | personInterpretation.put(Tuple.of(0), true); |
@@ -360,13 +360,13 @@ class QueryTransactionTest { | |||
360 | 360 | ||
361 | var store = ModelStore.builder() | 361 | var store = ModelStore.builder() |
362 | .symbols(person) | 362 | .symbols(person) |
363 | .with(ViatraModelQuery.ADAPTER) | 363 | .with(ViatraModelQueryAdapter.builder() |
364 | .queries(predicate) | 364 | .queries(predicate)) |
365 | .build(); | 365 | .build(); |
366 | 366 | ||
367 | var model = store.createEmptyModel(); | 367 | var model = store.createEmptyModel(); |
368 | var personInterpretation = model.getInterpretation(person); | 368 | var personInterpretation = model.getInterpretation(person); |
369 | var queryEngine = model.getAdapter(ModelQuery.ADAPTER); | 369 | var queryEngine = model.getAdapter(ModelQueryAdapter.class); |
370 | var predicateResultSet = queryEngine.getResultSet(predicate); | 370 | var predicateResultSet = queryEngine.getResultSet(predicate); |
371 | 371 | ||
372 | personInterpretation.put(Tuple.of(0), true); | 372 | personInterpretation.put(Tuple.of(0), true); |