diff options
Diffstat (limited to 'subprojects/store-reasoning')
2 files changed, 10 insertions, 2 deletions
diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/multiobject/MultiObjectInitializer.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/multiobject/MultiObjectInitializer.java index 084bf6f9..fb84631d 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/multiobject/MultiObjectInitializer.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/multiobject/MultiObjectInitializer.java | |||
@@ -17,6 +17,8 @@ import tools.refinery.store.representation.cardinality.CardinalityIntervals; | |||
17 | import tools.refinery.store.tuple.Tuple; | 17 | import tools.refinery.store.tuple.Tuple; |
18 | 18 | ||
19 | import java.util.Arrays; | 19 | import java.util.Arrays; |
20 | import java.util.HashMap; | ||
21 | import java.util.function.Function; | ||
20 | 22 | ||
21 | class MultiObjectInitializer implements PartialModelInitializer { | 23 | class MultiObjectInitializer implements PartialModelInitializer { |
22 | private final Symbol<CardinalityInterval> countSymbol; | 24 | private final Symbol<CardinalityInterval> countSymbol; |
@@ -31,12 +33,14 @@ class MultiObjectInitializer implements PartialModelInitializer { | |||
31 | initializeExists(intervals, modelSeed); | 33 | initializeExists(intervals, modelSeed); |
32 | initializeEquals(intervals, modelSeed); | 34 | initializeEquals(intervals, modelSeed); |
33 | var countInterpretation = model.getInterpretation(countSymbol); | 35 | var countInterpretation = model.getInterpretation(countSymbol); |
36 | var uniqueTable = new HashMap<CardinalityInterval, CardinalityInterval>(); | ||
34 | for (int i = 0; i < intervals.length; i++) { | 37 | for (int i = 0; i < intervals.length; i++) { |
35 | var interval = intervals[i]; | 38 | var interval = intervals[i]; |
36 | if (interval.isEmpty()) { | 39 | if (interval.isEmpty()) { |
37 | throw new IllegalArgumentException("Inconsistent existence or equality for node " + i); | 40 | throw new IllegalArgumentException("Inconsistent existence or equality for node " + i); |
38 | } | 41 | } |
39 | countInterpretation.put(Tuple.of(i), intervals[i]); | 42 | var uniqueInterval = uniqueTable.computeIfAbsent(intervals[i], Function.identity()); |
43 | countInterpretation.put(Tuple.of(i), uniqueInterval); | ||
40 | } | 44 | } |
41 | } | 45 | } |
42 | 46 | ||
diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeHierarchyInitializer.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeHierarchyInitializer.java index 6648a454..c74f1e78 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeHierarchyInitializer.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeHierarchyInitializer.java | |||
@@ -14,6 +14,8 @@ import tools.refinery.store.representation.TruthValue; | |||
14 | import tools.refinery.store.tuple.Tuple; | 14 | import tools.refinery.store.tuple.Tuple; |
15 | 15 | ||
16 | import java.util.Arrays; | 16 | import java.util.Arrays; |
17 | import java.util.HashMap; | ||
18 | import java.util.function.Function; | ||
17 | 19 | ||
18 | public class TypeHierarchyInitializer implements PartialModelInitializer { | 20 | public class TypeHierarchyInitializer implements PartialModelInitializer { |
19 | private final TypeHierarchy typeHierarchy; | 21 | private final TypeHierarchy typeHierarchy; |
@@ -32,8 +34,10 @@ public class TypeHierarchyInitializer implements PartialModelInitializer { | |||
32 | initializeType(type, inferredTypes, modelSeed); | 34 | initializeType(type, inferredTypes, modelSeed); |
33 | } | 35 | } |
34 | var typeInterpretation = model.getInterpretation(typeSymbol); | 36 | var typeInterpretation = model.getInterpretation(typeSymbol); |
37 | var uniqueTable = new HashMap<InferredType, InferredType>(); | ||
35 | for (int i = 0; i < inferredTypes.length; i++) { | 38 | for (int i = 0; i < inferredTypes.length; i++) { |
36 | typeInterpretation.put(Tuple.of(i), inferredTypes[i]); | 39 | var uniqueType = uniqueTable.computeIfAbsent(inferredTypes[i], Function.identity()); |
40 | typeInterpretation.put(Tuple.of(i), uniqueType); | ||
37 | } | 41 | } |
38 | } | 42 | } |
39 | 43 | ||