diff options
Diffstat (limited to 'subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalQueryMetaContext.java')
-rw-r--r-- | subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalQueryMetaContext.java | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalQueryMetaContext.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalQueryMetaContext.java new file mode 100644 index 00000000..64c23c61 --- /dev/null +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalQueryMetaContext.java | |||
@@ -0,0 +1,44 @@ | |||
1 | package tools.refinery.store.query.viatra.internal.context; | ||
2 | |||
3 | import org.eclipse.viatra.query.runtime.matchers.context.AbstractQueryMetaContext; | ||
4 | import org.eclipse.viatra.query.runtime.matchers.context.IInputKey; | ||
5 | import org.eclipse.viatra.query.runtime.matchers.context.InputKeyImplication; | ||
6 | import tools.refinery.store.query.view.RelationView; | ||
7 | |||
8 | import java.util.*; | ||
9 | |||
10 | /** | ||
11 | * The meta context information for String scopes. | ||
12 | */ | ||
13 | public class RelationalQueryMetaContext extends AbstractQueryMetaContext { | ||
14 | @Override | ||
15 | public boolean isEnumerable(IInputKey key) { | ||
16 | ensureValidKey(key); | ||
17 | return key.isEnumerable(); | ||
18 | } | ||
19 | |||
20 | @Override | ||
21 | public boolean isStateless(IInputKey key) { | ||
22 | ensureValidKey(key); | ||
23 | return true; | ||
24 | } | ||
25 | |||
26 | @Override | ||
27 | public Collection<InputKeyImplication> getImplications(IInputKey implyingKey) { | ||
28 | ensureValidKey(implyingKey); | ||
29 | return Set.of(); | ||
30 | } | ||
31 | |||
32 | @Override | ||
33 | public Map<Set<Integer>, Set<Integer>> getFunctionalDependencies(IInputKey key) { | ||
34 | ensureValidKey(key); | ||
35 | return Map.of(); | ||
36 | } | ||
37 | |||
38 | public void ensureValidKey(IInputKey key) { | ||
39 | if (key instanceof RelationView<?>) { | ||
40 | return; | ||
41 | } | ||
42 | throw new IllegalArgumentException("The input key %s is not a valid input key.".formatted(key)); | ||
43 | } | ||
44 | } | ||