diff options
Diffstat (limited to 'subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/QueryWrapperFactory.java')
-rw-r--r-- | subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/QueryWrapperFactory.java | 22 |
1 files changed, 11 insertions, 11 deletions
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 | ||