diff options
Diffstat (limited to 'subprojects/store-query-viatra')
15 files changed, 190 insertions, 190 deletions
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryBuilderImpl.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryBuilderImpl.java index 999d349a..44ed1505 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryBuilderImpl.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryBuilderImpl.java | |||
@@ -117,7 +117,7 @@ public class ViatraModelQueryBuilderImpl extends AbstractModelAdapterBuilder imp | |||
117 | public ViatraModelQueryStoreAdapterImpl createStoreAdapter(ModelStore store) { | 117 | public ViatraModelQueryStoreAdapterImpl createStoreAdapter(ModelStore store) { |
118 | validateSymbols(store); | 118 | validateSymbols(store); |
119 | dnf2PQuery.assertNoUnusedHints(); | 119 | dnf2PQuery.assertNoUnusedHints(); |
120 | return new ViatraModelQueryStoreAdapterImpl(store, buildEngineOptions(), dnf2PQuery.getRelationViews(), | 120 | return new ViatraModelQueryStoreAdapterImpl(store, buildEngineOptions(), dnf2PQuery.getSymbolViews(), |
121 | Collections.unmodifiableMap(querySpecifications), Collections.unmodifiableSet(vacuousQueries)); | 121 | Collections.unmodifiableMap(querySpecifications), Collections.unmodifiableSet(vacuousQueries)); |
122 | } | 122 | } |
123 | 123 | ||
@@ -140,11 +140,11 @@ public class ViatraModelQueryBuilderImpl extends AbstractModelAdapterBuilder imp | |||
140 | 140 | ||
141 | private void validateSymbols(ModelStore store) { | 141 | private void validateSymbols(ModelStore store) { |
142 | var symbols = store.getSymbols(); | 142 | var symbols = store.getSymbols(); |
143 | for (var relationView : dnf2PQuery.getRelationViews().keySet()) { | 143 | for (var symbolView : dnf2PQuery.getSymbolViews().keySet()) { |
144 | var symbol = relationView.getSymbol(); | 144 | var symbol = symbolView.getSymbol(); |
145 | if (!symbols.contains(symbol)) { | 145 | if (!symbols.contains(symbol)) { |
146 | throw new IllegalArgumentException("Cannot query relation view %s: symbol %s is not in the model" | 146 | throw new IllegalArgumentException("Cannot query view %s: symbol %s is not in the model" |
147 | .formatted(relationView, symbol)); | 147 | .formatted(symbolView, symbol)); |
148 | } | 148 | } |
149 | } | 149 | } |
150 | } | 150 | } |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryStoreAdapterImpl.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryStoreAdapterImpl.java index aa102a35..11a3c7fd 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryStoreAdapterImpl.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryStoreAdapterImpl.java | |||
@@ -13,20 +13,20 @@ import tools.refinery.store.model.ModelStore; | |||
13 | import tools.refinery.store.query.dnf.AnyQuery; | 13 | import tools.refinery.store.query.dnf.AnyQuery; |
14 | import tools.refinery.store.query.viatra.ViatraModelQueryStoreAdapter; | 14 | import tools.refinery.store.query.viatra.ViatraModelQueryStoreAdapter; |
15 | import tools.refinery.store.query.viatra.internal.matcher.RawPatternMatcher; | 15 | import tools.refinery.store.query.viatra.internal.matcher.RawPatternMatcher; |
16 | import tools.refinery.store.query.view.AnyRelationView; | 16 | import tools.refinery.store.query.view.AnySymbolView; |
17 | 17 | ||
18 | import java.util.*; | 18 | import java.util.*; |
19 | 19 | ||
20 | public class ViatraModelQueryStoreAdapterImpl implements ViatraModelQueryStoreAdapter { | 20 | public class ViatraModelQueryStoreAdapterImpl implements ViatraModelQueryStoreAdapter { |
21 | private final ModelStore store; | 21 | private final ModelStore store; |
22 | private final ViatraQueryEngineOptions engineOptions; | 22 | private final ViatraQueryEngineOptions engineOptions; |
23 | private final Map<AnyRelationView, IInputKey> inputKeys; | 23 | private final Map<AnySymbolView, IInputKey> inputKeys; |
24 | private final Map<AnyQuery, IQuerySpecification<RawPatternMatcher>> querySpecifications; | 24 | private final Map<AnyQuery, IQuerySpecification<RawPatternMatcher>> querySpecifications; |
25 | private final Set<AnyQuery> vacuousQueries; | 25 | private final Set<AnyQuery> vacuousQueries; |
26 | private final Set<AnyQuery> allQueries; | 26 | private final Set<AnyQuery> allQueries; |
27 | 27 | ||
28 | ViatraModelQueryStoreAdapterImpl(ModelStore store, ViatraQueryEngineOptions engineOptions, | 28 | ViatraModelQueryStoreAdapterImpl(ModelStore store, ViatraQueryEngineOptions engineOptions, |
29 | Map<AnyRelationView, IInputKey> inputKeys, | 29 | Map<AnySymbolView, IInputKey> inputKeys, |
30 | Map<AnyQuery, IQuerySpecification<RawPatternMatcher>> querySpecifications, | 30 | Map<AnyQuery, IQuerySpecification<RawPatternMatcher>> querySpecifications, |
31 | Set<AnyQuery> vacuousQueries) { | 31 | Set<AnyQuery> vacuousQueries) { |
32 | this.store = store; | 32 | this.store = store; |
@@ -45,11 +45,11 @@ public class ViatraModelQueryStoreAdapterImpl implements ViatraModelQueryStoreAd | |||
45 | return store; | 45 | return store; |
46 | } | 46 | } |
47 | 47 | ||
48 | public Collection<AnyRelationView> getRelationViews() { | 48 | public Collection<AnySymbolView> getSymbolViews() { |
49 | return inputKeys.keySet(); | 49 | return inputKeys.keySet(); |
50 | } | 50 | } |
51 | 51 | ||
52 | public Map<AnyRelationView, IInputKey> getInputKeys() { | 52 | public Map<AnySymbolView, IInputKey> getInputKeys() { |
53 | return inputKeys; | 53 | return inputKeys; |
54 | } | 54 | } |
55 | 55 | ||
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 index 07a5a6ea..cf96b7fd 100644 --- 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 | |||
@@ -10,8 +10,8 @@ import org.eclipse.viatra.query.runtime.matchers.context.IInputKey; | |||
10 | import org.eclipse.viatra.query.runtime.matchers.context.InputKeyImplication; | 10 | import org.eclipse.viatra.query.runtime.matchers.context.InputKeyImplication; |
11 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | 11 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; |
12 | import tools.refinery.store.query.term.DataSort; | 12 | import tools.refinery.store.query.term.DataSort; |
13 | import tools.refinery.store.query.viatra.internal.pquery.RelationViewWrapper; | 13 | import tools.refinery.store.query.viatra.internal.pquery.SymbolViewWrapper; |
14 | import tools.refinery.store.query.view.AnyRelationView; | 14 | import tools.refinery.store.query.view.AnySymbolView; |
15 | 15 | ||
16 | import java.util.*; | 16 | import java.util.*; |
17 | 17 | ||
@@ -19,9 +19,9 @@ import java.util.*; | |||
19 | * The meta context information for String scopes. | 19 | * The meta context information for String scopes. |
20 | */ | 20 | */ |
21 | public class RelationalQueryMetaContext extends AbstractQueryMetaContext { | 21 | public class RelationalQueryMetaContext extends AbstractQueryMetaContext { |
22 | private final Map<AnyRelationView, IInputKey> inputKeys; | 22 | private final Map<AnySymbolView, IInputKey> inputKeys; |
23 | 23 | ||
24 | RelationalQueryMetaContext(Map<AnyRelationView, IInputKey> inputKeys) { | 24 | RelationalQueryMetaContext(Map<AnySymbolView, IInputKey> inputKeys) { |
25 | this.inputKeys = inputKeys; | 25 | this.inputKeys = inputKeys; |
26 | } | 26 | } |
27 | 27 | ||
@@ -47,23 +47,23 @@ public class RelationalQueryMetaContext extends AbstractQueryMetaContext { | |||
47 | if (implyingKey instanceof JavaTransitiveInstancesKey) { | 47 | if (implyingKey instanceof JavaTransitiveInstancesKey) { |
48 | return List.of(); | 48 | return List.of(); |
49 | } | 49 | } |
50 | var relationView = checkKey(implyingKey); | 50 | var symbolView = checkKey(implyingKey); |
51 | var relationViewImplications = relationView.getImpliedRelationViews(); | 51 | var relationViewImplications = symbolView.getImpliedRelationViews(); |
52 | var inputKeyImplications = new HashSet<InputKeyImplication>(relationViewImplications.size()); | 52 | var inputKeyImplications = new HashSet<InputKeyImplication>(relationViewImplications.size()); |
53 | for (var relationViewImplication : relationViewImplications) { | 53 | for (var relationViewImplication : relationViewImplications) { |
54 | if (!relationView.equals(relationViewImplication.implyingRelationView())) { | 54 | if (!symbolView.equals(relationViewImplication.implyingView())) { |
55 | throw new IllegalArgumentException("Relation view %s returned unrelated implication %s".formatted( | 55 | throw new IllegalArgumentException("Relation view %s returned unrelated implication %s".formatted( |
56 | relationView, relationViewImplication)); | 56 | symbolView, relationViewImplication)); |
57 | } | 57 | } |
58 | var impliedInputKey = inputKeys.get(relationViewImplication.impliedRelationView()); | 58 | var impliedInputKey = inputKeys.get(relationViewImplication.impliedView()); |
59 | // Ignore implications not relevant for any queries included in the model. | 59 | // Ignore implications not relevant for any queries included in the model. |
60 | if (impliedInputKey != null) { | 60 | if (impliedInputKey != null) { |
61 | inputKeyImplications.add(new InputKeyImplication(implyingKey, impliedInputKey, | 61 | inputKeyImplications.add(new InputKeyImplication(implyingKey, impliedInputKey, |
62 | relationViewImplication.impliedIndices())); | 62 | relationViewImplication.impliedIndices())); |
63 | } | 63 | } |
64 | } | 64 | } |
65 | var sorts = relationView.getSorts(); | 65 | var sorts = symbolView.getSorts(); |
66 | int arity = relationView.arity(); | 66 | int arity = symbolView.arity(); |
67 | for (int i = 0; i < arity; i++) { | 67 | for (int i = 0; i < arity; i++) { |
68 | var sort = sorts.get(i); | 68 | var sort = sorts.get(i); |
69 | if (sort instanceof DataSort<?> dataSort) { | 69 | if (sort instanceof DataSort<?> dataSort) { |
@@ -99,20 +99,20 @@ public class RelationalQueryMetaContext extends AbstractQueryMetaContext { | |||
99 | return flattened; | 99 | return flattened; |
100 | } | 100 | } |
101 | 101 | ||
102 | private static void checkValidIndices(AnyRelationView relationView, Collection<Integer> indices) { | 102 | private static void checkValidIndices(AnySymbolView relationView, Collection<Integer> indices) { |
103 | indices.stream().filter(relationView::invalidIndex).findAny().ifPresent(i -> { | 103 | indices.stream().filter(relationView::invalidIndex).findAny().ifPresent(i -> { |
104 | throw new IllegalArgumentException("Index %d is invalid for %s".formatted(i, relationView)); | 104 | throw new IllegalArgumentException("Index %d is invalid for %s".formatted(i, relationView)); |
105 | }); | 105 | }); |
106 | } | 106 | } |
107 | 107 | ||
108 | public AnyRelationView checkKey(IInputKey key) { | 108 | public AnySymbolView checkKey(IInputKey key) { |
109 | if (!(key instanceof RelationViewWrapper wrapper)) { | 109 | if (!(key instanceof SymbolViewWrapper wrapper)) { |
110 | throw new IllegalArgumentException("The input key %s is not a valid input key".formatted(key)); | 110 | throw new IllegalArgumentException("The input key %s is not a valid input key".formatted(key)); |
111 | } | 111 | } |
112 | var relationView = wrapper.getWrappedKey(); | 112 | var symbolView = wrapper.getWrappedKey(); |
113 | if (!inputKeys.containsKey(relationView)) { | 113 | if (!inputKeys.containsKey(symbolView)) { |
114 | throw new IllegalArgumentException("The input key %s is not present in the model".formatted(key)); | 114 | throw new IllegalArgumentException("The input key %s is not present in the model".formatted(key)); |
115 | } | 115 | } |
116 | return relationView; | 116 | return symbolView; |
117 | } | 117 | } |
118 | } | 118 | } |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalRuntimeContext.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalRuntimeContext.java index 71943737..0f2daca8 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalRuntimeContext.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalRuntimeContext.java | |||
@@ -13,9 +13,9 @@ import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | |||
13 | import org.eclipse.viatra.query.runtime.matchers.util.Accuracy; | 13 | import org.eclipse.viatra.query.runtime.matchers.util.Accuracy; |
14 | import tools.refinery.store.model.Model; | 14 | import tools.refinery.store.model.Model; |
15 | import tools.refinery.store.query.viatra.internal.ViatraModelQueryAdapterImpl; | 15 | import tools.refinery.store.query.viatra.internal.ViatraModelQueryAdapterImpl; |
16 | import tools.refinery.store.query.viatra.internal.pquery.RelationViewWrapper; | 16 | import tools.refinery.store.query.viatra.internal.pquery.SymbolViewWrapper; |
17 | import tools.refinery.store.query.viatra.internal.update.ModelUpdateListener; | 17 | import tools.refinery.store.query.viatra.internal.update.ModelUpdateListener; |
18 | import tools.refinery.store.query.view.AnyRelationView; | 18 | import tools.refinery.store.query.view.AnySymbolView; |
19 | 19 | ||
20 | import java.lang.reflect.InvocationTargetException; | 20 | import java.lang.reflect.InvocationTargetException; |
21 | import java.util.Iterator; | 21 | import java.util.Iterator; |
@@ -59,9 +59,9 @@ public class RelationalRuntimeContext implements IQueryRuntimeContext { | |||
59 | 59 | ||
60 | @Override | 60 | @Override |
61 | public boolean isIndexed(IInputKey key, IndexingService service) { | 61 | public boolean isIndexed(IInputKey key, IndexingService service) { |
62 | if (key instanceof RelationViewWrapper wrapper) { | 62 | if (key instanceof SymbolViewWrapper wrapper) { |
63 | var relationalKey = wrapper.getWrappedKey(); | 63 | var symbolViewKey = wrapper.getWrappedKey(); |
64 | return this.modelUpdateListener.containsRelationView(relationalKey); | 64 | return this.modelUpdateListener.containsSymbolView(symbolViewKey); |
65 | } else { | 65 | } else { |
66 | return false; | 66 | return false; |
67 | } | 67 | } |
@@ -74,13 +74,13 @@ public class RelationalRuntimeContext implements IQueryRuntimeContext { | |||
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | AnyRelationView checkKey(IInputKey key) { | 77 | AnySymbolView checkKey(IInputKey key) { |
78 | if (key instanceof RelationViewWrapper wrappedKey) { | 78 | if (key instanceof SymbolViewWrapper wrappedKey) { |
79 | var relationViewKey = wrappedKey.getWrappedKey(); | 79 | var symbolViewKey = wrappedKey.getWrappedKey(); |
80 | if (modelUpdateListener.containsRelationView(relationViewKey)) { | 80 | if (modelUpdateListener.containsSymbolView(symbolViewKey)) { |
81 | return relationViewKey; | 81 | return symbolViewKey; |
82 | } else { | 82 | } else { |
83 | throw new IllegalStateException("Query is asking for non-indexed key %s".formatted(relationViewKey)); | 83 | throw new IllegalStateException("Query is asking for non-indexed key %s".formatted(symbolViewKey)); |
84 | } | 84 | } |
85 | } else { | 85 | } else { |
86 | throw new IllegalStateException("Query is asking for non-relational key"); | 86 | throw new IllegalStateException("Query is asking for non-relational key"); |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/Dnf2PQuery.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/Dnf2PQuery.java index 714d41c0..b511a5c7 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/Dnf2PQuery.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/Dnf2PQuery.java | |||
@@ -29,7 +29,7 @@ import tools.refinery.store.query.term.ConstantTerm; | |||
29 | import tools.refinery.store.query.term.StatefulAggregator; | 29 | import tools.refinery.store.query.term.StatefulAggregator; |
30 | import tools.refinery.store.query.term.StatelessAggregator; | 30 | import tools.refinery.store.query.term.StatelessAggregator; |
31 | import tools.refinery.store.query.term.Variable; | 31 | import tools.refinery.store.query.term.Variable; |
32 | import tools.refinery.store.query.view.AnyRelationView; | 32 | import tools.refinery.store.query.view.AnySymbolView; |
33 | import tools.refinery.store.util.CycleDetectingMapper; | 33 | import tools.refinery.store.util.CycleDetectingMapper; |
34 | 34 | ||
35 | import java.util.*; | 35 | import java.util.*; |
@@ -53,8 +53,8 @@ public class Dnf2PQuery { | |||
53 | return mapper.map(dnfQuery); | 53 | return mapper.map(dnfQuery); |
54 | } | 54 | } |
55 | 55 | ||
56 | public Map<AnyRelationView, IInputKey> getRelationViews() { | 56 | public Map<AnySymbolView, IInputKey> getSymbolViews() { |
57 | return wrapperFactory.getRelationViews(); | 57 | return wrapperFactory.getSymbolViews(); |
58 | } | 58 | } |
59 | 59 | ||
60 | public void hint(Dnf dnf, QueryEvaluationHint hint) { | 60 | public void hint(Dnf dnf, QueryEvaluationHint hint) { |
@@ -165,8 +165,8 @@ public class Dnf2PQuery { | |||
165 | if (constraint instanceof Dnf dnf) { | 165 | if (constraint instanceof Dnf dnf) { |
166 | var pattern = translate(dnf); | 166 | var pattern = translate(dnf); |
167 | new PositivePatternCall(body, substitution, pattern); | 167 | new PositivePatternCall(body, substitution, pattern); |
168 | } else if (constraint instanceof AnyRelationView relationView) { | 168 | } else if (constraint instanceof AnySymbolView symbolView) { |
169 | var inputKey = wrapperFactory.getInputKey(relationView); | 169 | var inputKey = wrapperFactory.getInputKey(symbolView); |
170 | new TypeConstraint(body, substitution, inputKey); | 170 | new TypeConstraint(body, substitution, inputKey); |
171 | } else { | 171 | } else { |
172 | throw new IllegalArgumentException("Unknown Constraint: " + constraint); | 172 | throw new IllegalArgumentException("Unknown Constraint: " + constraint); |
@@ -178,8 +178,8 @@ public class Dnf2PQuery { | |||
178 | PQuery pattern; | 178 | PQuery pattern; |
179 | if (constraint instanceof Dnf dnf) { | 179 | if (constraint instanceof Dnf dnf) { |
180 | pattern = translate(dnf); | 180 | pattern = translate(dnf); |
181 | } else if (constraint instanceof AnyRelationView relationView) { | 181 | } else if (constraint instanceof AnySymbolView symbolView) { |
182 | pattern = wrapperFactory.wrapRelationViewIdentityArguments(relationView); | 182 | pattern = wrapperFactory.wrapSymbolViewIdentityArguments(symbolView); |
183 | } else { | 183 | } else { |
184 | throw new IllegalArgumentException("Unknown Constraint: " + constraint); | 184 | throw new IllegalArgumentException("Unknown Constraint: " + constraint); |
185 | } | 185 | } |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/QueryWrapperFactory.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/QueryWrapperFactory.java index 30f848a6..0d046455 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/QueryWrapperFactory.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/QueryWrapperFactory.java | |||
@@ -21,8 +21,8 @@ import tools.refinery.store.query.dnf.DnfClause; | |||
21 | import tools.refinery.store.query.dnf.DnfUtils; | 21 | import tools.refinery.store.query.dnf.DnfUtils; |
22 | import tools.refinery.store.query.literal.AbstractCallLiteral; | 22 | import tools.refinery.store.query.literal.AbstractCallLiteral; |
23 | import tools.refinery.store.query.term.Variable; | 23 | import tools.refinery.store.query.term.Variable; |
24 | import tools.refinery.store.query.view.AnyRelationView; | 24 | import tools.refinery.store.query.view.AnySymbolView; |
25 | import tools.refinery.store.query.view.RelationView; | 25 | import tools.refinery.store.query.view.SymbolView; |
26 | import tools.refinery.store.util.CycleDetectingMapper; | 26 | import tools.refinery.store.util.CycleDetectingMapper; |
27 | 27 | ||
28 | import java.util.*; | 28 | import java.util.*; |
@@ -30,7 +30,7 @@ import java.util.function.ToIntFunction; | |||
30 | 30 | ||
31 | class QueryWrapperFactory { | 31 | class QueryWrapperFactory { |
32 | private final Dnf2PQuery dnf2PQuery; | 32 | private final Dnf2PQuery dnf2PQuery; |
33 | private final Map<AnyRelationView, RelationViewWrapper> view2WrapperMap = new LinkedHashMap<>(); | 33 | private final Map<AnySymbolView, SymbolViewWrapper> view2WrapperMap = new LinkedHashMap<>(); |
34 | private final CycleDetectingMapper<RemappedConstraint, RawPQuery> wrapConstraint = new CycleDetectingMapper<>( | 34 | private final CycleDetectingMapper<RemappedConstraint, RawPQuery> wrapConstraint = new CycleDetectingMapper<>( |
35 | RemappedConstraint::toString, this::doWrapConstraint); | 35 | RemappedConstraint::toString, this::doWrapConstraint); |
36 | 36 | ||
@@ -38,12 +38,12 @@ class QueryWrapperFactory { | |||
38 | this.dnf2PQuery = dnf2PQuery; | 38 | this.dnf2PQuery = dnf2PQuery; |
39 | } | 39 | } |
40 | 40 | ||
41 | public PQuery wrapRelationViewIdentityArguments(AnyRelationView relationView) { | 41 | public PQuery wrapSymbolViewIdentityArguments(AnySymbolView symbolView) { |
42 | var identity = new int[relationView.arity()]; | 42 | var identity = new int[symbolView.arity()]; |
43 | for (int i = 0; i < identity.length; i++) { | 43 | for (int i = 0; i < identity.length; i++) { |
44 | identity[i] = i; | 44 | identity[i] = i; |
45 | } | 45 | } |
46 | return maybeWrapConstraint(relationView, identity); | 46 | return maybeWrapConstraint(symbolView, identity); |
47 | } | 47 | } |
48 | public WrappedCall maybeWrapConstraint(AbstractCallLiteral callLiteral, DnfClause clause) { | 48 | public WrappedCall maybeWrapConstraint(AbstractCallLiteral callLiteral, DnfClause clause) { |
49 | var arguments = callLiteral.getArguments(); | 49 | var arguments = callLiteral.getArguments(); |
@@ -112,8 +112,8 @@ class QueryWrapperFactory { | |||
112 | } | 112 | } |
113 | var argumentTuple = Tuples.flatTupleOf(arguments); | 113 | var argumentTuple = Tuples.flatTupleOf(arguments); |
114 | 114 | ||
115 | if (constraint instanceof RelationView<?> relationView) { | 115 | if (constraint instanceof SymbolView<?> view) { |
116 | new TypeConstraint(body, argumentTuple, getInputKey(relationView)); | 116 | new TypeConstraint(body, argumentTuple, getInputKey(view)); |
117 | } else if (constraint instanceof Dnf dnf) { | 117 | } else if (constraint instanceof Dnf dnf) { |
118 | var calledPQuery = dnf2PQuery.translate(dnf); | 118 | var calledPQuery = dnf2PQuery.translate(dnf); |
119 | new PositivePatternCall(body, argumentTuple, calledPQuery); | 119 | new PositivePatternCall(body, argumentTuple, calledPQuery); |
@@ -125,11 +125,11 @@ class QueryWrapperFactory { | |||
125 | return embeddedPQuery; | 125 | return embeddedPQuery; |
126 | } | 126 | } |
127 | 127 | ||
128 | public IInputKey getInputKey(AnyRelationView relationView) { | 128 | public IInputKey getInputKey(AnySymbolView symbolView) { |
129 | return view2WrapperMap.computeIfAbsent(relationView, RelationViewWrapper::new); | 129 | return view2WrapperMap.computeIfAbsent(symbolView, SymbolViewWrapper::new); |
130 | } | 130 | } |
131 | 131 | ||
132 | public Map<AnyRelationView, IInputKey> getRelationViews() { | 132 | public Map<AnySymbolView, IInputKey> getSymbolViews() { |
133 | return Collections.unmodifiableMap(view2WrapperMap); | 133 | return Collections.unmodifiableMap(view2WrapperMap); |
134 | } | 134 | } |
135 | 135 | ||
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/RelationViewWrapper.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/SymbolViewWrapper.java index 02da932b..a777613e 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/RelationViewWrapper.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/SymbolViewWrapper.java | |||
@@ -6,10 +6,10 @@ | |||
6 | package tools.refinery.store.query.viatra.internal.pquery; | 6 | package tools.refinery.store.query.viatra.internal.pquery; |
7 | 7 | ||
8 | import org.eclipse.viatra.query.runtime.matchers.context.common.BaseInputKeyWrapper; | 8 | import org.eclipse.viatra.query.runtime.matchers.context.common.BaseInputKeyWrapper; |
9 | import tools.refinery.store.query.view.AnyRelationView; | 9 | import tools.refinery.store.query.view.AnySymbolView; |
10 | 10 | ||
11 | public class RelationViewWrapper extends BaseInputKeyWrapper<AnyRelationView> { | 11 | public class SymbolViewWrapper extends BaseInputKeyWrapper<AnySymbolView> { |
12 | public RelationViewWrapper(AnyRelationView wrappedKey) { | 12 | public SymbolViewWrapper(AnySymbolView wrappedKey) { |
13 | super(wrappedKey); | 13 | super(wrappedKey); |
14 | } | 14 | } |
15 | 15 | ||
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/ModelUpdateListener.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/ModelUpdateListener.java index c612574f..986bb0b1 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/ModelUpdateListener.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/ModelUpdateListener.java | |||
@@ -9,43 +9,43 @@ import org.eclipse.viatra.query.runtime.matchers.context.IInputKey; | |||
9 | import org.eclipse.viatra.query.runtime.matchers.context.IQueryRuntimeContextListener; | 9 | import org.eclipse.viatra.query.runtime.matchers.context.IQueryRuntimeContextListener; |
10 | import org.eclipse.viatra.query.runtime.matchers.tuple.ITuple; | 10 | import org.eclipse.viatra.query.runtime.matchers.tuple.ITuple; |
11 | import tools.refinery.store.query.viatra.internal.ViatraModelQueryAdapterImpl; | 11 | import tools.refinery.store.query.viatra.internal.ViatraModelQueryAdapterImpl; |
12 | import tools.refinery.store.query.view.AnyRelationView; | 12 | import tools.refinery.store.query.view.AnySymbolView; |
13 | import tools.refinery.store.query.view.RelationView; | 13 | import tools.refinery.store.query.view.SymbolView; |
14 | 14 | ||
15 | import java.util.HashMap; | 15 | import java.util.HashMap; |
16 | import java.util.Map; | 16 | import java.util.Map; |
17 | 17 | ||
18 | public class ModelUpdateListener { | 18 | public class ModelUpdateListener { |
19 | private final Map<AnyRelationView, RelationViewUpdateListener<?>> relationViewUpdateListeners; | 19 | private final Map<AnySymbolView, SymbolViewUpdateListener<?>> symbolViewUpdateListeners; |
20 | 20 | ||
21 | public ModelUpdateListener(ViatraModelQueryAdapterImpl adapter) { | 21 | public ModelUpdateListener(ViatraModelQueryAdapterImpl adapter) { |
22 | var relationViews = adapter.getStoreAdapter().getInputKeys().keySet(); | 22 | var symbolViews = adapter.getStoreAdapter().getInputKeys().keySet(); |
23 | relationViewUpdateListeners = new HashMap<>(relationViews.size()); | 23 | symbolViewUpdateListeners = new HashMap<>(symbolViews.size()); |
24 | for (var relationView : relationViews) { | 24 | for (var symbolView : symbolViews) { |
25 | registerView(adapter, (RelationView<?>) relationView); | 25 | registerView(adapter, (SymbolView<?>) symbolView); |
26 | } | 26 | } |
27 | } | 27 | } |
28 | 28 | ||
29 | private <T> void registerView(ViatraModelQueryAdapterImpl adapter, RelationView<T> relationView) { | 29 | private <T> void registerView(ViatraModelQueryAdapterImpl adapter, SymbolView<T> view) { |
30 | var model = adapter.getModel(); | 30 | var model = adapter.getModel(); |
31 | var interpretation = model.getInterpretation(relationView.getSymbol()); | 31 | var interpretation = model.getInterpretation(view.getSymbol()); |
32 | var listener = RelationViewUpdateListener.of(adapter, relationView, interpretation); | 32 | var listener = SymbolViewUpdateListener.of(adapter, view, interpretation); |
33 | relationViewUpdateListeners.put(relationView, listener); | 33 | symbolViewUpdateListeners.put(view, listener); |
34 | } | 34 | } |
35 | 35 | ||
36 | public boolean containsRelationView(AnyRelationView relationView) { | 36 | public boolean containsSymbolView(AnySymbolView relationView) { |
37 | return relationViewUpdateListeners.containsKey(relationView); | 37 | return symbolViewUpdateListeners.containsKey(relationView); |
38 | } | 38 | } |
39 | 39 | ||
40 | public void addListener(IInputKey key, AnyRelationView relationView, ITuple seed, | 40 | public void addListener(IInputKey key, AnySymbolView symbolView, ITuple seed, |
41 | IQueryRuntimeContextListener listener) { | 41 | IQueryRuntimeContextListener listener) { |
42 | var relationViewUpdateListener = relationViewUpdateListeners.get(relationView); | 42 | var symbolViewUpdateListener = symbolViewUpdateListeners.get(symbolView); |
43 | relationViewUpdateListener.addFilter(key, seed, listener); | 43 | symbolViewUpdateListener.addFilter(key, seed, listener); |
44 | } | 44 | } |
45 | 45 | ||
46 | public void removeListener(IInputKey key, AnyRelationView relationView, ITuple seed, | 46 | public void removeListener(IInputKey key, AnySymbolView symbolView, ITuple seed, |
47 | IQueryRuntimeContextListener listener) { | 47 | IQueryRuntimeContextListener listener) { |
48 | var relationViewUpdateListener = relationViewUpdateListeners.get(relationView); | 48 | var symbolViewUpdateListener = symbolViewUpdateListeners.get(symbolView); |
49 | relationViewUpdateListener.removeFilter(key, seed, listener); | 49 | symbolViewUpdateListener.removeFilter(key, seed, listener); |
50 | } | 50 | } |
51 | } | 51 | } |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/RelationViewUpdateListener.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/SymbolViewUpdateListener.java index 185e4ebc..f1a2ac7c 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/RelationViewUpdateListener.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/SymbolViewUpdateListener.java | |||
@@ -12,18 +12,18 @@ import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | |||
12 | import tools.refinery.store.model.Interpretation; | 12 | import tools.refinery.store.model.Interpretation; |
13 | import tools.refinery.store.model.InterpretationListener; | 13 | import tools.refinery.store.model.InterpretationListener; |
14 | import tools.refinery.store.query.viatra.internal.ViatraModelQueryAdapterImpl; | 14 | import tools.refinery.store.query.viatra.internal.ViatraModelQueryAdapterImpl; |
15 | import tools.refinery.store.query.view.RelationView; | 15 | import tools.refinery.store.query.view.SymbolView; |
16 | import tools.refinery.store.query.view.TuplePreservingRelationView; | 16 | import tools.refinery.store.query.view.TuplePreservingView; |
17 | 17 | ||
18 | import java.util.ArrayList; | 18 | import java.util.ArrayList; |
19 | import java.util.List; | 19 | import java.util.List; |
20 | 20 | ||
21 | public abstract class RelationViewUpdateListener<T> implements InterpretationListener<T> { | 21 | public abstract class SymbolViewUpdateListener<T> implements InterpretationListener<T> { |
22 | private final ViatraModelQueryAdapterImpl adapter; | 22 | private final ViatraModelQueryAdapterImpl adapter; |
23 | private final Interpretation<T> interpretation; | 23 | private final Interpretation<T> interpretation; |
24 | private final List<RelationViewFilter> filters = new ArrayList<>(); | 24 | private final List<RelationViewFilter> filters = new ArrayList<>(); |
25 | 25 | ||
26 | protected RelationViewUpdateListener(ViatraModelQueryAdapterImpl adapter, Interpretation<T> interpretation) { | 26 | protected SymbolViewUpdateListener(ViatraModelQueryAdapterImpl adapter, Interpretation<T> interpretation) { |
27 | this.adapter = adapter; | 27 | this.adapter = adapter; |
28 | this.interpretation = interpretation; | 28 | this.interpretation = interpretation; |
29 | } | 29 | } |
@@ -53,13 +53,13 @@ public abstract class RelationViewUpdateListener<T> implements InterpretationLis | |||
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
56 | public static <T> RelationViewUpdateListener<T> of(ViatraModelQueryAdapterImpl adapter, | 56 | public static <T> SymbolViewUpdateListener<T> of(ViatraModelQueryAdapterImpl adapter, |
57 | RelationView<T> relationView, | 57 | SymbolView<T> view, |
58 | Interpretation<T> interpretation) { | 58 | Interpretation<T> interpretation) { |
59 | if (relationView instanceof TuplePreservingRelationView<T> tuplePreservingRelationView) { | 59 | if (view instanceof TuplePreservingView<T> tuplePreservingRelationView) { |
60 | return new TuplePreservingRelationViewUpdateListener<>(adapter, tuplePreservingRelationView, | 60 | return new TuplePreservingViewUpdateListener<>(adapter, tuplePreservingRelationView, |
61 | interpretation); | 61 | interpretation); |
62 | } | 62 | } |
63 | return new TupleChangingRelationViewUpdateListener<>(adapter, relationView, interpretation); | 63 | return new TupleChangingViewUpdateListener<>(adapter, view, interpretation); |
64 | } | 64 | } |
65 | } | 65 | } |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TupleChangingRelationViewUpdateListener.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TupleChangingViewUpdateListener.java index be4951af..45d35571 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TupleChangingRelationViewUpdateListener.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TupleChangingViewUpdateListener.java | |||
@@ -8,37 +8,37 @@ package tools.refinery.store.query.viatra.internal.update; | |||
8 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | 8 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; |
9 | import tools.refinery.store.model.Interpretation; | 9 | import tools.refinery.store.model.Interpretation; |
10 | import tools.refinery.store.query.viatra.internal.ViatraModelQueryAdapterImpl; | 10 | import tools.refinery.store.query.viatra.internal.ViatraModelQueryAdapterImpl; |
11 | import tools.refinery.store.query.view.RelationView; | 11 | import tools.refinery.store.query.view.SymbolView; |
12 | import tools.refinery.store.tuple.Tuple; | 12 | import tools.refinery.store.tuple.Tuple; |
13 | 13 | ||
14 | import java.util.Arrays; | 14 | import java.util.Arrays; |
15 | 15 | ||
16 | public class TupleChangingRelationViewUpdateListener<T> extends RelationViewUpdateListener<T> { | 16 | public class TupleChangingViewUpdateListener<T> extends SymbolViewUpdateListener<T> { |
17 | private final RelationView<T> relationView; | 17 | private final SymbolView<T> view; |
18 | 18 | ||
19 | TupleChangingRelationViewUpdateListener(ViatraModelQueryAdapterImpl adapter, RelationView<T> relationView, | 19 | TupleChangingViewUpdateListener(ViatraModelQueryAdapterImpl adapter, SymbolView<T> view, |
20 | Interpretation<T> interpretation) { | 20 | Interpretation<T> interpretation) { |
21 | super(adapter, interpretation); | 21 | super(adapter, interpretation); |
22 | this.relationView = relationView; | 22 | this.view = view; |
23 | } | 23 | } |
24 | 24 | ||
25 | @Override | 25 | @Override |
26 | public void put(Tuple key, T fromValue, T toValue, boolean restoring) { | 26 | public void put(Tuple key, T fromValue, T toValue, boolean restoring) { |
27 | boolean fromPresent = relationView.filter(key, fromValue); | 27 | boolean fromPresent = view.filter(key, fromValue); |
28 | boolean toPresent = relationView.filter(key, toValue); | 28 | boolean toPresent = view.filter(key, toValue); |
29 | if (fromPresent) { | 29 | if (fromPresent) { |
30 | if (toPresent) { // value change | 30 | if (toPresent) { // value change |
31 | var fromArray = relationView.forwardMap(key, fromValue); | 31 | var fromArray = view.forwardMap(key, fromValue); |
32 | var toArray = relationView.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(relationView.forwardMap(key, fromValue)), false); | 38 | processUpdate(Tuples.flatTupleOf(view.forwardMap(key, fromValue)), false); |
39 | } | 39 | } |
40 | } else if (toPresent) { // toValue appears | 40 | } else if (toPresent) { // toValue appears |
41 | processUpdate(Tuples.flatTupleOf(relationView.forwardMap(key, toValue)), true); | 41 | processUpdate(Tuples.flatTupleOf(view.forwardMap(key, toValue)), true); |
42 | } | 42 | } |
43 | } | 43 | } |
44 | } | 44 | } |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TuplePreservingRelationViewUpdateListener.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TuplePreservingViewUpdateListener.java index 9638266b..c18dbafb 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TuplePreservingRelationViewUpdateListener.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TuplePreservingViewUpdateListener.java | |||
@@ -8,14 +8,14 @@ package tools.refinery.store.query.viatra.internal.update; | |||
8 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | 8 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; |
9 | import tools.refinery.store.model.Interpretation; | 9 | import tools.refinery.store.model.Interpretation; |
10 | import tools.refinery.store.query.viatra.internal.ViatraModelQueryAdapterImpl; | 10 | import tools.refinery.store.query.viatra.internal.ViatraModelQueryAdapterImpl; |
11 | import tools.refinery.store.query.view.TuplePreservingRelationView; | 11 | import tools.refinery.store.query.view.TuplePreservingView; |
12 | import tools.refinery.store.tuple.Tuple; | 12 | import tools.refinery.store.tuple.Tuple; |
13 | 13 | ||
14 | public class TuplePreservingRelationViewUpdateListener<T> extends RelationViewUpdateListener<T> { | 14 | public class TuplePreservingViewUpdateListener<T> extends SymbolViewUpdateListener<T> { |
15 | private final TuplePreservingRelationView<T> view; | 15 | private final TuplePreservingView<T> view; |
16 | 16 | ||
17 | TuplePreservingRelationViewUpdateListener(ViatraModelQueryAdapterImpl adapter, | 17 | TuplePreservingViewUpdateListener(ViatraModelQueryAdapterImpl adapter, TuplePreservingView<T> view, |
18 | TuplePreservingRelationView<T> view, Interpretation<T> interpretation) { | 18 | Interpretation<T> interpretation) { |
19 | super(adapter, interpretation); | 19 | super(adapter, interpretation); |
20 | this.view = view; | 20 | this.view = view; |
21 | } | 21 | } |
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 da4aba7f..5cffef71 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 | |||
@@ -12,8 +12,8 @@ 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.term.Variable; | 13 | import tools.refinery.store.query.term.Variable; |
14 | import tools.refinery.store.query.viatra.tests.QueryEngineTest; | 14 | import tools.refinery.store.query.viatra.tests.QueryEngineTest; |
15 | import tools.refinery.store.query.view.FunctionalRelationView; | 15 | import tools.refinery.store.query.view.FunctionView; |
16 | import tools.refinery.store.query.view.KeyOnlyRelationView; | 16 | import tools.refinery.store.query.view.KeyOnlyView; |
17 | import tools.refinery.store.representation.Symbol; | 17 | import tools.refinery.store.representation.Symbol; |
18 | import tools.refinery.store.tuple.Tuple; | 18 | import tools.refinery.store.tuple.Tuple; |
19 | 19 | ||
@@ -30,8 +30,8 @@ class DiagonalQueryTest { | |||
30 | void inputKeyNegationTest(QueryEvaluationHint hint) { | 30 | void inputKeyNegationTest(QueryEvaluationHint hint) { |
31 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 31 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
32 | var symbol = new Symbol<>("symbol", 4, Boolean.class, false); | 32 | var symbol = new Symbol<>("symbol", 4, Boolean.class, false); |
33 | var personView = new KeyOnlyRelationView<>(person); | 33 | var personView = new KeyOnlyView<>(person); |
34 | var symbolView = new KeyOnlyRelationView<>(symbol); | 34 | var symbolView = new KeyOnlyView<>(symbol); |
35 | 35 | ||
36 | var p1 = Variable.of("p1"); | 36 | var p1 = Variable.of("p1"); |
37 | var p2 = Variable.of("p2"); | 37 | var p2 = Variable.of("p2"); |
@@ -78,8 +78,8 @@ class DiagonalQueryTest { | |||
78 | void subQueryNegationTest(QueryEvaluationHint hint) { | 78 | void subQueryNegationTest(QueryEvaluationHint hint) { |
79 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 79 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
80 | var symbol = new Symbol<>("symbol", 4, Boolean.class, false); | 80 | var symbol = new Symbol<>("symbol", 4, Boolean.class, false); |
81 | var personView = new KeyOnlyRelationView<>(person); | 81 | var personView = new KeyOnlyView<>(person); |
82 | var symbolView = new KeyOnlyRelationView<>(symbol); | 82 | var symbolView = new KeyOnlyView<>(symbol); |
83 | 83 | ||
84 | var p1 = Variable.of("p1"); | 84 | var p1 = Variable.of("p1"); |
85 | var p2 = Variable.of("p2"); | 85 | var p2 = Variable.of("p2"); |
@@ -139,8 +139,8 @@ class DiagonalQueryTest { | |||
139 | void inputKeyCountTest(QueryEvaluationHint hint) { | 139 | void inputKeyCountTest(QueryEvaluationHint hint) { |
140 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 140 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
141 | var symbol = new Symbol<>("symbol", 4, Boolean.class, false); | 141 | var symbol = new Symbol<>("symbol", 4, Boolean.class, false); |
142 | var personView = new KeyOnlyRelationView<>(person); | 142 | var personView = new KeyOnlyView<>(person); |
143 | var symbolView = new KeyOnlyRelationView<>(symbol); | 143 | var symbolView = new KeyOnlyView<>(symbol); |
144 | 144 | ||
145 | var p1 = Variable.of("p1"); | 145 | var p1 = Variable.of("p1"); |
146 | var p2 = Variable.of("p2"); | 146 | var p2 = Variable.of("p2"); |
@@ -190,8 +190,8 @@ class DiagonalQueryTest { | |||
190 | void subQueryCountTest(QueryEvaluationHint hint) { | 190 | void subQueryCountTest(QueryEvaluationHint hint) { |
191 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 191 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
192 | var symbol = new Symbol<>("symbol", 4, Boolean.class, false); | 192 | var symbol = new Symbol<>("symbol", 4, Boolean.class, false); |
193 | var personView = new KeyOnlyRelationView<>(person); | 193 | var personView = new KeyOnlyView<>(person); |
194 | var symbolView = new KeyOnlyRelationView<>(symbol); | 194 | var symbolView = new KeyOnlyView<>(symbol); |
195 | 195 | ||
196 | var p1 = Variable.of("p1"); | 196 | var p1 = Variable.of("p1"); |
197 | var p2 = Variable.of("p2"); | 197 | var p2 = Variable.of("p2"); |
@@ -254,8 +254,8 @@ class DiagonalQueryTest { | |||
254 | void inputKeyAggregationTest(QueryEvaluationHint hint) { | 254 | void inputKeyAggregationTest(QueryEvaluationHint hint) { |
255 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 255 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
256 | var symbol = new Symbol<>("symbol", 4, Integer.class, null); | 256 | var symbol = new Symbol<>("symbol", 4, Integer.class, null); |
257 | var personView = new KeyOnlyRelationView<>(person); | 257 | var personView = new KeyOnlyView<>(person); |
258 | var symbolView = new FunctionalRelationView<>(symbol); | 258 | var symbolView = new FunctionView<>(symbol); |
259 | 259 | ||
260 | var p1 = Variable.of("p1"); | 260 | var p1 = Variable.of("p1"); |
261 | var p2 = Variable.of("p2"); | 261 | var p2 = Variable.of("p2"); |
@@ -306,8 +306,8 @@ class DiagonalQueryTest { | |||
306 | void subQueryAggregationTest(QueryEvaluationHint hint) { | 306 | void subQueryAggregationTest(QueryEvaluationHint hint) { |
307 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 307 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
308 | var symbol = new Symbol<>("symbol", 4, Integer.class, null); | 308 | var symbol = new Symbol<>("symbol", 4, Integer.class, null); |
309 | var personView = new KeyOnlyRelationView<>(person); | 309 | var personView = new KeyOnlyView<>(person); |
310 | var symbolView = new FunctionalRelationView<>(symbol); | 310 | var symbolView = new FunctionView<>(symbol); |
311 | 311 | ||
312 | var p1 = Variable.of("p1"); | 312 | var p1 = Variable.of("p1"); |
313 | var p2 = Variable.of("p2"); | 313 | var p2 = Variable.of("p2"); |
@@ -374,8 +374,8 @@ class DiagonalQueryTest { | |||
374 | void inputKeyTransitiveTest(QueryEvaluationHint hint) { | 374 | void inputKeyTransitiveTest(QueryEvaluationHint hint) { |
375 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 375 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
376 | var symbol = new Symbol<>("symbol", 2, Boolean.class, false); | 376 | var symbol = new Symbol<>("symbol", 2, Boolean.class, false); |
377 | var personView = new KeyOnlyRelationView<>(person); | 377 | var personView = new KeyOnlyView<>(person); |
378 | var symbolView = new KeyOnlyRelationView<>(symbol); | 378 | var symbolView = new KeyOnlyView<>(symbol); |
379 | 379 | ||
380 | var p1 = Variable.of("p1"); | 380 | var p1 = Variable.of("p1"); |
381 | var query = Query.builder("Diagonal") | 381 | var query = Query.builder("Diagonal") |
@@ -420,8 +420,8 @@ class DiagonalQueryTest { | |||
420 | void subQueryTransitiveTest(QueryEvaluationHint hint) { | 420 | void subQueryTransitiveTest(QueryEvaluationHint hint) { |
421 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 421 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
422 | var symbol = new Symbol<>("symbol", 2, Boolean.class, false); | 422 | var symbol = new Symbol<>("symbol", 2, Boolean.class, false); |
423 | var personView = new KeyOnlyRelationView<>(person); | 423 | var personView = new KeyOnlyView<>(person); |
424 | var symbolView = new KeyOnlyRelationView<>(symbol); | 424 | var symbolView = new KeyOnlyView<>(symbol); |
425 | 425 | ||
426 | var p1 = Variable.of("p1"); | 426 | var p1 = Variable.of("p1"); |
427 | var p2 = Variable.of("p2"); | 427 | var p2 = Variable.of("p2"); |
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 3af67a50..19584273 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 | |||
@@ -13,9 +13,9 @@ 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; |
15 | import tools.refinery.store.query.viatra.tests.QueryEngineTest; | 15 | import tools.refinery.store.query.viatra.tests.QueryEngineTest; |
16 | import tools.refinery.store.query.view.FilteredRelationView; | 16 | import tools.refinery.store.query.view.FilteredView; |
17 | import tools.refinery.store.query.view.FunctionalRelationView; | 17 | import tools.refinery.store.query.view.FunctionView; |
18 | import tools.refinery.store.query.view.KeyOnlyRelationView; | 18 | import tools.refinery.store.query.view.KeyOnlyView; |
19 | import tools.refinery.store.representation.Symbol; | 19 | import tools.refinery.store.representation.Symbol; |
20 | import tools.refinery.store.representation.TruthValue; | 20 | import tools.refinery.store.representation.TruthValue; |
21 | import tools.refinery.store.tuple.Tuple; | 21 | import tools.refinery.store.tuple.Tuple; |
@@ -38,8 +38,8 @@ class FunctionalQueryTest { | |||
38 | void inputKeyTest(QueryEvaluationHint hint) { | 38 | void inputKeyTest(QueryEvaluationHint hint) { |
39 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 39 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
40 | var age = new Symbol<>("age", 1, Integer.class, null); | 40 | var age = new Symbol<>("age", 1, Integer.class, null); |
41 | var personView = new KeyOnlyRelationView<>(person); | 41 | var personView = new KeyOnlyView<>(person); |
42 | var ageView = new FunctionalRelationView<>(age); | 42 | var ageView = new FunctionView<>(age); |
43 | 43 | ||
44 | var p1 = Variable.of("p1"); | 44 | var p1 = Variable.of("p1"); |
45 | var x = Variable.of("x", Integer.class); | 45 | var x = Variable.of("x", Integer.class); |
@@ -84,8 +84,8 @@ class FunctionalQueryTest { | |||
84 | void predicateTest(QueryEvaluationHint hint) { | 84 | void predicateTest(QueryEvaluationHint hint) { |
85 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 85 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
86 | var age = new Symbol<>("age", 1, Integer.class, null); | 86 | var age = new Symbol<>("age", 1, Integer.class, null); |
87 | var personView = new KeyOnlyRelationView<>(person); | 87 | var personView = new KeyOnlyView<>(person); |
88 | var ageView = new FunctionalRelationView<>(age); | 88 | var ageView = new FunctionView<>(age); |
89 | 89 | ||
90 | var p1 = Variable.of("p1"); | 90 | var p1 = Variable.of("p1"); |
91 | var x = Variable.of("x", Integer.class); | 91 | var x = Variable.of("x", Integer.class); |
@@ -137,8 +137,8 @@ class FunctionalQueryTest { | |||
137 | void computationTest(QueryEvaluationHint hint) { | 137 | void computationTest(QueryEvaluationHint hint) { |
138 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 138 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
139 | var age = new Symbol<>("age", 1, Integer.class, null); | 139 | var age = new Symbol<>("age", 1, Integer.class, null); |
140 | var personView = new KeyOnlyRelationView<>(person); | 140 | var personView = new KeyOnlyView<>(person); |
141 | var ageView = new FunctionalRelationView<>(age); | 141 | var ageView = new FunctionView<>(age); |
142 | 142 | ||
143 | var p1 = Variable.of("p1"); | 143 | var p1 = Variable.of("p1"); |
144 | var x = Variable.of("x", Integer.class); | 144 | var x = Variable.of("x", Integer.class); |
@@ -184,8 +184,8 @@ class FunctionalQueryTest { | |||
184 | void inputKeyCountTest(QueryEvaluationHint hint) { | 184 | void inputKeyCountTest(QueryEvaluationHint hint) { |
185 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 185 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
186 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); | 186 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); |
187 | var personView = new KeyOnlyRelationView<>(person); | 187 | var personView = new KeyOnlyView<>(person); |
188 | var friendMustView = new FilteredRelationView<>(friend, "must", TruthValue::must); | 188 | var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); |
189 | 189 | ||
190 | var p1 = Variable.of("p1"); | 190 | var p1 = Variable.of("p1"); |
191 | var p2 = Variable.of("p2"); | 191 | var p2 = Variable.of("p2"); |
@@ -233,8 +233,8 @@ class FunctionalQueryTest { | |||
233 | void predicateCountTest(QueryEvaluationHint hint) { | 233 | void predicateCountTest(QueryEvaluationHint hint) { |
234 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 234 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
235 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); | 235 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); |
236 | var personView = new KeyOnlyRelationView<>(person); | 236 | var personView = new KeyOnlyView<>(person); |
237 | var friendMustView = new FilteredRelationView<>(friend, "must", TruthValue::must); | 237 | var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); |
238 | 238 | ||
239 | var p1 = Variable.of("p1"); | 239 | var p1 = Variable.of("p1"); |
240 | var p2 = Variable.of("p2"); | 240 | var p2 = Variable.of("p2"); |
@@ -289,7 +289,7 @@ class FunctionalQueryTest { | |||
289 | @QueryEngineTest | 289 | @QueryEngineTest |
290 | void inputKeyAggregationTest(QueryEvaluationHint hint) { | 290 | void inputKeyAggregationTest(QueryEvaluationHint hint) { |
291 | var age = new Symbol<>("age", 1, Integer.class, null); | 291 | var age = new Symbol<>("age", 1, Integer.class, null); |
292 | var ageView = new FunctionalRelationView<>(age); | 292 | var ageView = new FunctionView<>(age); |
293 | 293 | ||
294 | var p1 = Variable.of("p1"); | 294 | var p1 = Variable.of("p1"); |
295 | var x = Variable.of("x", Integer.class); | 295 | var x = Variable.of("x", Integer.class); |
@@ -324,8 +324,8 @@ class FunctionalQueryTest { | |||
324 | void predicateAggregationTest(QueryEvaluationHint hint) { | 324 | void predicateAggregationTest(QueryEvaluationHint hint) { |
325 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 325 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
326 | var age = new Symbol<>("age", 1, Integer.class, null); | 326 | var age = new Symbol<>("age", 1, Integer.class, null); |
327 | var personView = new KeyOnlyRelationView<>(person); | 327 | var personView = new KeyOnlyView<>(person); |
328 | var ageView = new FunctionalRelationView<>(age); | 328 | var ageView = new FunctionView<>(age); |
329 | 329 | ||
330 | var p1 = Variable.of("p1"); | 330 | var p1 = Variable.of("p1"); |
331 | var x = Variable.of("x", Integer.class); | 331 | var x = Variable.of("x", Integer.class); |
@@ -371,8 +371,8 @@ class FunctionalQueryTest { | |||
371 | void extremeValueTest(QueryEvaluationHint hint) { | 371 | void extremeValueTest(QueryEvaluationHint hint) { |
372 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 372 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
373 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); | 373 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); |
374 | var personView = new KeyOnlyRelationView<>(person); | 374 | var personView = new KeyOnlyView<>(person); |
375 | var friendMustView = new FilteredRelationView<>(friend, "must", TruthValue::must); | 375 | var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); |
376 | 376 | ||
377 | var p1 = Variable.of("p1"); | 377 | var p1 = Variable.of("p1"); |
378 | var p2 = Variable.of("p2"); | 378 | var p2 = Variable.of("p2"); |
@@ -447,8 +447,8 @@ class FunctionalQueryTest { | |||
447 | void invalidComputationTest(QueryEvaluationHint hint) { | 447 | void invalidComputationTest(QueryEvaluationHint hint) { |
448 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 448 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
449 | var age = new Symbol<>("age", 1, Integer.class, null); | 449 | var age = new Symbol<>("age", 1, Integer.class, null); |
450 | var personView = new KeyOnlyRelationView<>(person); | 450 | var personView = new KeyOnlyView<>(person); |
451 | var ageView = new FunctionalRelationView<>(age); | 451 | var ageView = new FunctionView<>(age); |
452 | 452 | ||
453 | var p1 = Variable.of("p1"); | 453 | var p1 = Variable.of("p1"); |
454 | var x = Variable.of("x", Integer.class); | 454 | var x = Variable.of("x", Integer.class); |
@@ -494,8 +494,8 @@ class FunctionalQueryTest { | |||
494 | void invalidAssumeTest(QueryEvaluationHint hint) { | 494 | void invalidAssumeTest(QueryEvaluationHint hint) { |
495 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 495 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
496 | var age = new Symbol<>("age", 1, Integer.class, null); | 496 | var age = new Symbol<>("age", 1, Integer.class, null); |
497 | var personView = new KeyOnlyRelationView<>(person); | 497 | var personView = new KeyOnlyView<>(person); |
498 | var ageView = new FunctionalRelationView<>(age); | 498 | var ageView = new FunctionView<>(age); |
499 | 499 | ||
500 | var p1 = Variable.of("p1"); | 500 | var p1 = Variable.of("p1"); |
501 | var x = Variable.of("x", Integer.class); | 501 | var x = Variable.of("x", Integer.class); |
@@ -543,9 +543,9 @@ class FunctionalQueryTest { | |||
543 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 543 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
544 | var age = new Symbol<>("age", 1, Integer.class, null); | 544 | var age = new Symbol<>("age", 1, Integer.class, null); |
545 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); | 545 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); |
546 | var personView = new KeyOnlyRelationView<>(person); | 546 | var personView = new KeyOnlyView<>(person); |
547 | var ageView = new FunctionalRelationView<>(age); | 547 | var ageView = new FunctionView<>(age); |
548 | var friendMustView = new FilteredRelationView<>(friend, "must", TruthValue::must); | 548 | var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); |
549 | 549 | ||
550 | var p1 = Variable.of("p1"); | 550 | var p1 = Variable.of("p1"); |
551 | var p2 = Variable.of("p2"); | 551 | var p2 = Variable.of("p2"); |
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 e82f0a15..11ee98f5 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 | |||
@@ -13,9 +13,9 @@ 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; |
15 | import tools.refinery.store.query.viatra.tests.QueryEngineTest; | 15 | import tools.refinery.store.query.viatra.tests.QueryEngineTest; |
16 | import tools.refinery.store.query.view.FilteredRelationView; | 16 | import tools.refinery.store.query.view.FilteredView; |
17 | import tools.refinery.store.query.view.FunctionalRelationView; | 17 | import tools.refinery.store.query.view.FunctionView; |
18 | import tools.refinery.store.query.view.KeyOnlyRelationView; | 18 | import tools.refinery.store.query.view.KeyOnlyView; |
19 | import tools.refinery.store.representation.Symbol; | 19 | import tools.refinery.store.representation.Symbol; |
20 | import tools.refinery.store.representation.TruthValue; | 20 | import tools.refinery.store.representation.TruthValue; |
21 | import tools.refinery.store.tuple.Tuple; | 21 | import tools.refinery.store.tuple.Tuple; |
@@ -34,7 +34,7 @@ class QueryTest { | |||
34 | void typeConstraintTest(QueryEvaluationHint hint) { | 34 | void typeConstraintTest(QueryEvaluationHint hint) { |
35 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 35 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
36 | var asset = new Symbol<>("Asset", 1, Boolean.class, false); | 36 | var asset = new Symbol<>("Asset", 1, Boolean.class, false); |
37 | var personView = new KeyOnlyRelationView<>(person); | 37 | var personView = new KeyOnlyView<>(person); |
38 | 38 | ||
39 | var p1 = Variable.of("p1"); | 39 | var p1 = Variable.of("p1"); |
40 | var predicate = Query.builder("TypeConstraint") | 40 | var predicate = Query.builder("TypeConstraint") |
@@ -73,8 +73,8 @@ class QueryTest { | |||
73 | void relationConstraintTest(QueryEvaluationHint hint) { | 73 | void relationConstraintTest(QueryEvaluationHint hint) { |
74 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 74 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
75 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); | 75 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); |
76 | var personView = new KeyOnlyRelationView<>(person); | 76 | var personView = new KeyOnlyView<>(person); |
77 | var friendMustView = new FilteredRelationView<>(friend, "must", TruthValue::must); | 77 | var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); |
78 | 78 | ||
79 | var p1 = Variable.of("p1"); | 79 | var p1 = Variable.of("p1"); |
80 | var p2 = Variable.of("p2"); | 80 | var p2 = Variable.of("p2"); |
@@ -122,8 +122,8 @@ class QueryTest { | |||
122 | void existTest(QueryEvaluationHint hint) { | 122 | void existTest(QueryEvaluationHint hint) { |
123 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 123 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
124 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); | 124 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); |
125 | var personView = new KeyOnlyRelationView<>(person); | 125 | var personView = new KeyOnlyView<>(person); |
126 | var friendMustView = new FilteredRelationView<>(friend, "must", TruthValue::must); | 126 | var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); |
127 | 127 | ||
128 | var p1 = Variable.of("p1"); | 128 | var p1 = Variable.of("p1"); |
129 | var p2 = Variable.of("p2"); | 129 | var p2 = Variable.of("p2"); |
@@ -172,9 +172,9 @@ class QueryTest { | |||
172 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 172 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
173 | var animal = new Symbol<>("Animal", 1, Boolean.class, false); | 173 | var animal = new Symbol<>("Animal", 1, Boolean.class, false); |
174 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); | 174 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); |
175 | var personView = new KeyOnlyRelationView<>(person); | 175 | var personView = new KeyOnlyView<>(person); |
176 | var animalView = new KeyOnlyRelationView<>(animal); | 176 | var animalView = new KeyOnlyView<>(animal); |
177 | var friendMustView = new FilteredRelationView<>(friend, "must", TruthValue::must); | 177 | var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); |
178 | 178 | ||
179 | var p1 = Variable.of("p1"); | 179 | var p1 = Variable.of("p1"); |
180 | var p2 = Variable.of("p2"); | 180 | var p2 = Variable.of("p2"); |
@@ -230,7 +230,7 @@ class QueryTest { | |||
230 | @QueryEngineTest | 230 | @QueryEngineTest |
231 | void equalityTest(QueryEvaluationHint hint) { | 231 | void equalityTest(QueryEvaluationHint hint) { |
232 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 232 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
233 | var personView = new KeyOnlyRelationView<>(person); | 233 | var personView = new KeyOnlyView<>(person); |
234 | 234 | ||
235 | var p1 = Variable.of("p1"); | 235 | var p1 = Variable.of("p1"); |
236 | var p2 = Variable.of("p2"); | 236 | var p2 = Variable.of("p2"); |
@@ -273,8 +273,8 @@ class QueryTest { | |||
273 | void inequalityTest(QueryEvaluationHint hint) { | 273 | void inequalityTest(QueryEvaluationHint hint) { |
274 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 274 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
275 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); | 275 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); |
276 | var personView = new KeyOnlyRelationView<>(person); | 276 | var personView = new KeyOnlyView<>(person); |
277 | var friendMustView = new FilteredRelationView<>(friend, "must", TruthValue::must); | 277 | var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); |
278 | 278 | ||
279 | var p1 = Variable.of("p1"); | 279 | var p1 = Variable.of("p1"); |
280 | var p2 = Variable.of("p2"); | 280 | var p2 = Variable.of("p2"); |
@@ -322,8 +322,8 @@ class QueryTest { | |||
322 | void patternCallTest(QueryEvaluationHint hint) { | 322 | void patternCallTest(QueryEvaluationHint hint) { |
323 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 323 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
324 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); | 324 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); |
325 | var personView = new KeyOnlyRelationView<>(person); | 325 | var personView = new KeyOnlyView<>(person); |
326 | var friendMustView = new FilteredRelationView<>(friend, "must", TruthValue::must); | 326 | var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); |
327 | 327 | ||
328 | var p1 = Variable.of("p1"); | 328 | var p1 = Variable.of("p1"); |
329 | var p2 = Variable.of("p2"); | 329 | var p2 = Variable.of("p2"); |
@@ -381,8 +381,8 @@ class QueryTest { | |||
381 | void negativeRelationViewTest(QueryEvaluationHint hint) { | 381 | void negativeRelationViewTest(QueryEvaluationHint hint) { |
382 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 382 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
383 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); | 383 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); |
384 | var personView = new KeyOnlyRelationView<>(person); | 384 | var personView = new KeyOnlyView<>(person); |
385 | var friendMustView = new FilteredRelationView<>(friend, "must", TruthValue::must); | 385 | var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); |
386 | 386 | ||
387 | var p1 = Variable.of("p1"); | 387 | var p1 = Variable.of("p1"); |
388 | var p2 = Variable.of("p2"); | 388 | var p2 = Variable.of("p2"); |
@@ -435,8 +435,8 @@ class QueryTest { | |||
435 | void negativePatternCallTest(QueryEvaluationHint hint) { | 435 | void negativePatternCallTest(QueryEvaluationHint hint) { |
436 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 436 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
437 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); | 437 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); |
438 | var personView = new KeyOnlyRelationView<>(person); | 438 | var personView = new KeyOnlyView<>(person); |
439 | var friendMustView = new FilteredRelationView<>(friend, "must", TruthValue::must); | 439 | var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); |
440 | 440 | ||
441 | var p1 = Variable.of("p1"); | 441 | var p1 = Variable.of("p1"); |
442 | var p2 = Variable.of("p2"); | 442 | var p2 = Variable.of("p2"); |
@@ -500,8 +500,8 @@ class QueryTest { | |||
500 | void negativeRelationViewWithQuantificationTest(QueryEvaluationHint hint) { | 500 | void negativeRelationViewWithQuantificationTest(QueryEvaluationHint hint) { |
501 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 501 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
502 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); | 502 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); |
503 | var personView = new KeyOnlyRelationView<>(person); | 503 | var personView = new KeyOnlyView<>(person); |
504 | var friendMustView = new FilteredRelationView<>(friend, "must", TruthValue::must); | 504 | var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); |
505 | 505 | ||
506 | var p1 = Variable.of("p1"); | 506 | var p1 = Variable.of("p1"); |
507 | var p2 = Variable.of("p2"); | 507 | var p2 = Variable.of("p2"); |
@@ -547,8 +547,8 @@ class QueryTest { | |||
547 | void negativeWithQuantificationTest(QueryEvaluationHint hint) { | 547 | void negativeWithQuantificationTest(QueryEvaluationHint hint) { |
548 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 548 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
549 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); | 549 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); |
550 | var personView = new KeyOnlyRelationView<>(person); | 550 | var personView = new KeyOnlyView<>(person); |
551 | var friendMustView = new FilteredRelationView<>(friend, "must", TruthValue::must); | 551 | var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); |
552 | 552 | ||
553 | var p1 = Variable.of("p1"); | 553 | var p1 = Variable.of("p1"); |
554 | var p2 = Variable.of("p2"); | 554 | var p2 = Variable.of("p2"); |
@@ -603,8 +603,8 @@ class QueryTest { | |||
603 | void transitiveRelationViewTest(QueryEvaluationHint hint) { | 603 | void transitiveRelationViewTest(QueryEvaluationHint hint) { |
604 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 604 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
605 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); | 605 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); |
606 | var personView = new KeyOnlyRelationView<>(person); | 606 | var personView = new KeyOnlyView<>(person); |
607 | var friendMustView = new FilteredRelationView<>(friend, "must", TruthValue::must); | 607 | var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); |
608 | 608 | ||
609 | var p1 = Variable.of("p1"); | 609 | var p1 = Variable.of("p1"); |
610 | var p2 = Variable.of("p2"); | 610 | var p2 = Variable.of("p2"); |
@@ -656,8 +656,8 @@ class QueryTest { | |||
656 | void transitivePatternCallTest(QueryEvaluationHint hint) { | 656 | void transitivePatternCallTest(QueryEvaluationHint hint) { |
657 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 657 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
658 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); | 658 | var friend = new Symbol<>("friend", 2, TruthValue.class, TruthValue.FALSE); |
659 | var personView = new KeyOnlyRelationView<>(person); | 659 | var personView = new KeyOnlyView<>(person); |
660 | var friendMustView = new FilteredRelationView<>(friend, "must", TruthValue::must); | 660 | var friendMustView = new FilteredView<>(friend, "must", TruthValue::must); |
661 | 661 | ||
662 | var p1 = Variable.of("p1"); | 662 | var p1 = Variable.of("p1"); |
663 | var p2 = Variable.of("p2"); | 663 | var p2 = Variable.of("p2"); |
@@ -720,8 +720,8 @@ class QueryTest { | |||
720 | void assumeTest(QueryEvaluationHint hint) { | 720 | void assumeTest(QueryEvaluationHint hint) { |
721 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 721 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
722 | var age = new Symbol<>("age", 1, Integer.class, null); | 722 | var age = new Symbol<>("age", 1, Integer.class, null); |
723 | var personView = new KeyOnlyRelationView<>(person); | 723 | var personView = new KeyOnlyView<>(person); |
724 | var ageView = new FunctionalRelationView<>(age); | 724 | var ageView = new FunctionView<>(age); |
725 | 725 | ||
726 | var p1 = Variable.of("p1"); | 726 | var p1 = Variable.of("p1"); |
727 | var x = Variable.of("x", Integer.class); | 727 | var x = Variable.of("x", Integer.class); |
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 07b799ac..bd6b6b81 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 | |||
@@ -12,9 +12,9 @@ import tools.refinery.store.model.ModelStore; | |||
12 | import tools.refinery.store.query.ModelQuery; | 12 | import tools.refinery.store.query.ModelQuery; |
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; |
15 | import tools.refinery.store.query.view.FilteredRelationView; | 15 | import tools.refinery.store.query.view.FilteredView; |
16 | import tools.refinery.store.query.view.FunctionalRelationView; | 16 | import tools.refinery.store.query.view.FunctionView; |
17 | import tools.refinery.store.query.view.KeyOnlyRelationView; | 17 | import tools.refinery.store.query.view.KeyOnlyView; |
18 | import tools.refinery.store.representation.Symbol; | 18 | import tools.refinery.store.representation.Symbol; |
19 | import tools.refinery.store.tuple.Tuple; | 19 | import tools.refinery.store.tuple.Tuple; |
20 | 20 | ||
@@ -30,7 +30,7 @@ class QueryTransactionTest { | |||
30 | @Test | 30 | @Test |
31 | void flushTest() { | 31 | void flushTest() { |
32 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 32 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
33 | var personView = new KeyOnlyRelationView<>(person); | 33 | var personView = new KeyOnlyView<>(person); |
34 | 34 | ||
35 | var p1 = Variable.of("p1"); | 35 | var p1 = Variable.of("p1"); |
36 | var predicate = Query.builder("TypeConstraint") | 36 | var predicate = Query.builder("TypeConstraint") |
@@ -101,7 +101,7 @@ class QueryTransactionTest { | |||
101 | @Test | 101 | @Test |
102 | void localSearchTest() { | 102 | void localSearchTest() { |
103 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 103 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
104 | var personView = new KeyOnlyRelationView<>(person); | 104 | var personView = new KeyOnlyView<>(person); |
105 | 105 | ||
106 | var p1 = Variable.of("p1"); | 106 | var p1 = Variable.of("p1"); |
107 | var predicate = Query.builder("TypeConstraint") | 107 | var predicate = Query.builder("TypeConstraint") |
@@ -156,7 +156,7 @@ class QueryTransactionTest { | |||
156 | void unrelatedChangesTest() { | 156 | void unrelatedChangesTest() { |
157 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 157 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
158 | var asset = new Symbol<>("Asset", 1, Boolean.class, false); | 158 | var asset = new Symbol<>("Asset", 1, Boolean.class, false); |
159 | var personView = new KeyOnlyRelationView<>(person); | 159 | var personView = new KeyOnlyView<>(person); |
160 | 160 | ||
161 | var p1 = Variable.of("p1"); | 161 | var p1 = Variable.of("p1"); |
162 | var predicate = Query.builder("TypeConstraint") | 162 | var predicate = Query.builder("TypeConstraint") |
@@ -229,8 +229,8 @@ class QueryTransactionTest { | |||
229 | void tupleChangingChangeTest() { | 229 | void tupleChangingChangeTest() { |
230 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 230 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
231 | var age = new Symbol<>("age", 1, Integer.class, null); | 231 | var age = new Symbol<>("age", 1, Integer.class, null); |
232 | var personView = new KeyOnlyRelationView<>(person); | 232 | var personView = new KeyOnlyView<>(person); |
233 | var ageView = new FunctionalRelationView<>(age); | 233 | var ageView = new FunctionView<>(age); |
234 | 234 | ||
235 | var p1 = Variable.of("p1"); | 235 | var p1 = Variable.of("p1"); |
236 | var x = Variable.of("x", Integer.class); | 236 | var x = Variable.of("x", Integer.class); |
@@ -277,8 +277,8 @@ class QueryTransactionTest { | |||
277 | void tuplePreservingUnchangedTest() { | 277 | void tuplePreservingUnchangedTest() { |
278 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 278 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
279 | var age = new Symbol<>("age", 1, Integer.class, null); | 279 | var age = new Symbol<>("age", 1, Integer.class, null); |
280 | var personView = new KeyOnlyRelationView<>(person); | 280 | var personView = new KeyOnlyView<>(person); |
281 | var adultView = new FilteredRelationView<>(age, "adult", n -> n != null && n >= 18); | 281 | var adultView = new FilteredView<>(age, "adult", n -> n != null && n >= 18); |
282 | 282 | ||
283 | var p1 = Variable.of("p1"); | 283 | var p1 = Variable.of("p1"); |
284 | var x = Variable.of("x", Integer.class); | 284 | var x = Variable.of("x", Integer.class); |
@@ -324,7 +324,7 @@ class QueryTransactionTest { | |||
324 | @Test | 324 | @Test |
325 | void commitAfterFlushTest() { | 325 | void commitAfterFlushTest() { |
326 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 326 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
327 | var personView = new KeyOnlyRelationView<>(person); | 327 | var personView = new KeyOnlyView<>(person); |
328 | 328 | ||
329 | var p1 = Variable.of("p1"); | 329 | var p1 = Variable.of("p1"); |
330 | var predicate = Query.builder("TypeConstraint") | 330 | var predicate = Query.builder("TypeConstraint") |
@@ -382,7 +382,7 @@ class QueryTransactionTest { | |||
382 | @Test | 382 | @Test |
383 | void commitWithoutFlushTest() { | 383 | void commitWithoutFlushTest() { |
384 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 384 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
385 | var personView = new KeyOnlyRelationView<>(person); | 385 | var personView = new KeyOnlyView<>(person); |
386 | 386 | ||
387 | var p1 = Variable.of("p1"); | 387 | var p1 = Variable.of("p1"); |
388 | var predicate = Query.builder("TypeConstraint") | 388 | var predicate = Query.builder("TypeConstraint") |