From da5d898b3bad6f55efd6619f0abee0ec8aa1de4b Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Wed, 1 Mar 2023 02:15:50 +0100 Subject: refactor: more direct access to VIATRA result set Accessing VIATRA result sets through IQueryResultProvider requires a lot of indirection, allocations, and locking. We use reflection instead to have direct access to the underlying Indexer instead. Unfortunately, projection to arbitrary tuple masks (with wildcard entries in a tuple) is completely broken in VIATRA when RETE update propagation is delayed. While a new, ad-hoc projection indexer gets added to the RETE net immediately, it is not populated with the projection results until updates are flushed in the query engine. Therefore, when encountering an ad-hoc projection for the first time, the projection results will always be empty (thus usually out of date). While declaring the desired projections ahead of time would be a possible solution, for now, we completely remove ad-hoc projection support. If projections are needed on the ModelQuery level, we should create an API for declaring projections for each registered Dnf. --- .../java/tools/refinery/store/reasoning/seed/Seed.java | 14 ++++++++++++++ .../tools/refinery/store/reasoning/translator/Seed.java | 12 ------------ 2 files changed, 14 insertions(+), 12 deletions(-) create mode 100644 subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/Seed.java delete mode 100644 subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/Seed.java (limited to 'subprojects/store-reasoning/src/main/java') diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/Seed.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/Seed.java new file mode 100644 index 00000000..042c2636 --- /dev/null +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/Seed.java @@ -0,0 +1,14 @@ +package tools.refinery.store.reasoning.translator; + +import tools.refinery.store.map.Cursor; +import tools.refinery.store.tuple.Tuple; + +public interface Seed { + int arity(); + + T getReducedValue(); + + T get(Tuple key); + + Cursor getCursor(T defaultValue, int nodeCount); +} diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/Seed.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/Seed.java deleted file mode 100644 index 779eadbe..00000000 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/Seed.java +++ /dev/null @@ -1,12 +0,0 @@ -package tools.refinery.store.reasoning.translator; - -import tools.refinery.store.map.Cursor; -import tools.refinery.store.tuple.Tuple; - -public interface Seed { - int arity(); - - T get(Tuple key); - - Cursor getCursor(T defaultValue, int nodeCount); -} -- cgit v1.2.3-70-g09d2