diff options
Diffstat (limited to 'subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery')
-rw-r--r-- | subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/Dnf2PQuery.java | 14 | ||||
-rw-r--r-- | subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/QueryWrapperFactory.java | 22 | ||||
-rw-r--r-- | subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/SymbolViewWrapper.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/RelationViewWrapper.java) | 6 |
3 files changed, 21 insertions, 21 deletions
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 | ||