diff options
author | Kristóf Marussy <kristof@marussy.com> | 2023-09-10 23:07:11 +0200 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2023-09-10 23:07:11 +0200 |
commit | c7a86623b1589a3bd68a84a8d54a1eadc1aacefb (patch) | |
tree | 16fb5eb3d3b1282fecedefd9c7ae519162c540da /subprojects/store-query-viatra | |
parent | feat: integrate DSE with partial interpretation (diff) | |
download | refinery-c7a86623b1589a3bd68a84a8d54a1eadc1aacefb.tar.gz refinery-c7a86623b1589a3bd68a84a8d54a1eadc1aacefb.tar.zst refinery-c7a86623b1589a3bd68a84a8d54a1eadc1aacefb.zip |
fix: VIATRA projection indexer error
When a projection indexer is constructed for a production node, the projection
memory is only populated if changes are being propagated. The cache doesn't get
populated even if changes are flushed afterwards. This not only returns invalid
query results, but also a duplicate deletion exception will be thrown when the
production node tries to delete a tuple from the index memory.
To counteract this issue, we enable update propagation while a matcher (and its
associated indexers) are being created.
Diffstat (limited to 'subprojects/store-query-viatra')
2 files changed, 7 insertions, 6 deletions
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/TermEvaluator.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/TermEvaluator.java index 5df861a6..d064ff2c 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/TermEvaluator.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/TermEvaluator.java | |||
@@ -5,10 +5,10 @@ | |||
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.pquery; | 6 | package tools.refinery.store.query.viatra.internal.pquery; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.psystem.IExpressionEvaluator; | ||
9 | import tools.refinery.viatra.runtime.matchers.psystem.IValueProvider; | ||
10 | import tools.refinery.store.query.term.Term; | 8 | import tools.refinery.store.query.term.Term; |
11 | import tools.refinery.store.query.term.Variable; | 9 | import tools.refinery.store.query.term.Variable; |
10 | import tools.refinery.viatra.runtime.matchers.psystem.IExpressionEvaluator; | ||
11 | import tools.refinery.viatra.runtime.matchers.psystem.IValueProvider; | ||
12 | 12 | ||
13 | import java.util.stream.Collectors; | 13 | import java.util.stream.Collectors; |
14 | 14 | ||
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TupleChangingViewUpdateListener.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TupleChangingViewUpdateListener.java index 9dc739f1..5577faa3 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TupleChangingViewUpdateListener.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TupleChangingViewUpdateListener.java | |||
@@ -5,11 +5,11 @@ | |||
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.update; | 6 | package tools.refinery.store.query.viatra.internal.update; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | ||
9 | import tools.refinery.store.model.Interpretation; | 8 | import tools.refinery.store.model.Interpretation; |
10 | import tools.refinery.store.query.viatra.internal.ViatraModelQueryAdapterImpl; | 9 | import tools.refinery.store.query.viatra.internal.ViatraModelQueryAdapterImpl; |
11 | import tools.refinery.store.query.view.SymbolView; | 10 | import tools.refinery.store.query.view.SymbolView; |
12 | import tools.refinery.store.tuple.Tuple; | 11 | import tools.refinery.store.tuple.Tuple; |
12 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | ||
13 | 13 | ||
14 | import java.util.Arrays; | 14 | import java.util.Arrays; |
15 | 15 | ||
@@ -27,18 +27,19 @@ public class TupleChangingViewUpdateListener<T> extends SymbolViewUpdateListener | |||
27 | boolean fromPresent = view.filter(key, fromValue); | 27 | boolean fromPresent = view.filter(key, fromValue); |
28 | boolean toPresent = view.filter(key, toValue); | 28 | boolean toPresent = view.filter(key, toValue); |
29 | if (fromPresent) { | 29 | if (fromPresent) { |
30 | var fromArray = view.forwardMap(key, fromValue); | ||
30 | if (toPresent) { // value change | 31 | if (toPresent) { // value change |
31 | var fromArray = view.forwardMap(key, fromValue); | ||
32 | var toArray = view.forwardMap(key, toValue); | 32 | var toArray = view.forwardMap(key, toValue); |
33 | if (!Arrays.equals(fromArray, toArray)) { | 33 | if (!Arrays.equals(fromArray, toArray)) { |
34 | processUpdate(Tuples.flatTupleOf(fromArray), false); | 34 | processUpdate(Tuples.flatTupleOf(fromArray), false); |
35 | processUpdate(Tuples.flatTupleOf(toArray), true); | 35 | processUpdate(Tuples.flatTupleOf(toArray), true); |
36 | } | 36 | } |
37 | } else { // fromValue disappears | 37 | } else { // fromValue disappears |
38 | processUpdate(Tuples.flatTupleOf(view.forwardMap(key, fromValue)), false); | 38 | processUpdate(Tuples.flatTupleOf(fromArray), false); |
39 | } | 39 | } |
40 | } else if (toPresent) { // toValue appears | 40 | } else if (toPresent) { // toValue appears |
41 | processUpdate(Tuples.flatTupleOf(view.forwardMap(key, toValue)), true); | 41 | var toArray = view.forwardMap(key, toValue); |
42 | processUpdate(Tuples.flatTupleOf(toArray), true); | ||
42 | } | 43 | } |
43 | } | 44 | } |
44 | } | 45 | } |