diff options
Diffstat (limited to 'subprojects/store-reasoning')
-rw-r--r-- | subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/Advice.java | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/Advice.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/Advice.java index dd7a018d..d6a9e02c 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/Advice.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/Advice.java | |||
@@ -5,11 +5,11 @@ | |||
5 | */ | 5 | */ |
6 | package tools.refinery.store.reasoning.translator; | 6 | package tools.refinery.store.reasoning.translator; |
7 | 7 | ||
8 | import tools.refinery.store.query.substitution.Substitution; | ||
8 | import tools.refinery.store.reasoning.representation.AnyPartialSymbol; | 9 | import tools.refinery.store.reasoning.representation.AnyPartialSymbol; |
9 | import tools.refinery.store.reasoning.representation.PartialRelation; | 10 | import tools.refinery.store.reasoning.representation.PartialRelation; |
10 | import tools.refinery.store.query.term.Variable; | 11 | import tools.refinery.store.query.term.Variable; |
11 | import tools.refinery.store.query.literal.Literal; | 12 | import tools.refinery.store.query.literal.Literal; |
12 | import tools.refinery.store.query.substitution.Substitutions; | ||
13 | 13 | ||
14 | import java.util.*; | 14 | import java.util.*; |
15 | 15 | ||
@@ -66,14 +66,9 @@ public final class Advice { | |||
66 | public List<Literal> substitute(List<Variable> substituteParameters) { | 66 | public List<Literal> substitute(List<Variable> substituteParameters) { |
67 | checkArity(substituteParameters); | 67 | checkArity(substituteParameters); |
68 | markProcessed(); | 68 | markProcessed(); |
69 | int arity = parameters.size(); | ||
70 | var variableMap = new HashMap<Variable, Variable>(arity); | ||
71 | for (int i = 0; i < arity; i++) { | ||
72 | variableMap.put(parameters.get(i), substituteParameters.get(i)); | ||
73 | } | ||
74 | // Use a renewing substitution to remove any non-parameter variables and avoid clashed between variables | 69 | // Use a renewing substitution to remove any non-parameter variables and avoid clashed between variables |
75 | // coming from different advice in the same clause. | 70 | // coming from different advice in the same clause. |
76 | var substitution = Substitutions.renewing(variableMap); | 71 | var substitution = Substitution.builder().putManyChecked(parameters, substituteParameters).renewing().build(); |
77 | return literals.stream().map(literal -> literal.substitute(substitution)).toList(); | 72 | return literals.stream().map(literal -> literal.substitute(substitution)).toList(); |
78 | } | 73 | } |
79 | 74 | ||