diff options
Diffstat (limited to 'subprojects')
-rw-r--r-- | subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/ClausePostProcessor.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/ClausePostProcessor.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/ClausePostProcessor.java index 7a56145c..72bc06a1 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/ClausePostProcessor.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/dnf/ClausePostProcessor.java | |||
@@ -11,6 +11,7 @@ import tools.refinery.store.query.literal.Literal; | |||
11 | import tools.refinery.store.query.literal.VariableDirection; | 11 | import tools.refinery.store.query.literal.VariableDirection; |
12 | import tools.refinery.store.query.substitution.MapBasedSubstitution; | 12 | import tools.refinery.store.query.substitution.MapBasedSubstitution; |
13 | import tools.refinery.store.query.substitution.StatelessSubstitution; | 13 | import tools.refinery.store.query.substitution.StatelessSubstitution; |
14 | import tools.refinery.store.query.substitution.Substitution; | ||
14 | import tools.refinery.store.query.term.NodeVariable; | 15 | import tools.refinery.store.query.term.NodeVariable; |
15 | import tools.refinery.store.query.term.Variable; | 16 | import tools.refinery.store.query.term.Variable; |
16 | 17 | ||
@@ -135,15 +136,20 @@ class ClausePostProcessor { | |||
135 | } | 136 | } |
136 | 137 | ||
137 | private void substituteLiterals() { | 138 | private void substituteLiterals() { |
138 | var substitution = new MapBasedSubstitution(Collections.unmodifiableMap(representatives), | 139 | Substitution substitution; |
139 | StatelessSubstitution.IDENTITY); | 140 | if (representatives.isEmpty()) { |
141 | substitution = null; | ||
142 | } else { | ||
143 | substitution = new MapBasedSubstitution(Collections.unmodifiableMap(representatives), | ||
144 | StatelessSubstitution.IDENTITY); | ||
145 | } | ||
140 | for (var literal : literals) { | 146 | for (var literal : literals) { |
141 | if (isPositiveEquivalence(literal)) { | 147 | if (isPositiveEquivalence(literal)) { |
142 | // We already retained all equivalences that cannot be replaced with substitutions in | 148 | // We already retained all equivalences that cannot be replaced with substitutions in |
143 | // {@link#keepParameterEquivalences()}. | 149 | // {@link#keepParameterEquivalences()}. |
144 | continue; | 150 | continue; |
145 | } | 151 | } |
146 | var substitutedLiteral = literal.substitute(substitution); | 152 | var substitutedLiteral = substitution == null ? literal : literal.substitute(substitution); |
147 | substitutedLiterals.add(substitutedLiteral); | 153 | substitutedLiterals.add(substitutedLiteral); |
148 | } | 154 | } |
149 | } | 155 | } |