diff options
Diffstat (limited to 'subprojects/language-semantics/src/main/java/tools')
11 files changed, 84 insertions, 80 deletions
diff --git a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/ModelInitializer.java b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/ModelInitializer.java index c2bca2a5..ccfb630f 100644 --- a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/ModelInitializer.java +++ b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/ModelInitializer.java | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | 2 | * SPDX-FileCopyrightText: 2021-2024 The Refinery Authors <https://refinery.tools/> |
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
@@ -8,20 +8,24 @@ package tools.refinery.language.semantics; | |||
8 | import com.google.inject.Inject; | 8 | import com.google.inject.Inject; |
9 | import tools.refinery.language.library.BuiltinLibrary; | 9 | import tools.refinery.language.library.BuiltinLibrary; |
10 | import tools.refinery.language.model.problem.*; | 10 | import tools.refinery.language.model.problem.*; |
11 | import tools.refinery.language.scoping.imports.ImportAdapterProvider; | ||
11 | import tools.refinery.language.scoping.imports.ImportCollector; | 12 | import tools.refinery.language.scoping.imports.ImportCollector; |
12 | import tools.refinery.language.semantics.internal.MutableSeed; | 13 | import tools.refinery.language.semantics.internal.MutableSeed; |
13 | import tools.refinery.language.utils.BuiltinSymbols; | 14 | import tools.refinery.language.utils.BuiltinSymbols; |
14 | import tools.refinery.language.utils.ProblemDesugarer; | ||
15 | import tools.refinery.language.utils.ProblemUtil; | 15 | import tools.refinery.language.utils.ProblemUtil; |
16 | import tools.refinery.logic.Constraint; | ||
17 | import tools.refinery.logic.dnf.InvalidClauseException; | ||
18 | import tools.refinery.logic.dnf.Query; | ||
19 | import tools.refinery.logic.dnf.RelationalQuery; | ||
20 | import tools.refinery.logic.literal.*; | ||
21 | import tools.refinery.logic.term.NodeVariable; | ||
22 | import tools.refinery.logic.term.Variable; | ||
23 | import tools.refinery.logic.term.cardinalityinterval.CardinalityInterval; | ||
24 | import tools.refinery.logic.term.cardinalityinterval.CardinalityIntervals; | ||
25 | import tools.refinery.logic.term.truthvalue.TruthValue; | ||
26 | import tools.refinery.logic.term.uppercardinality.UpperCardinalities; | ||
16 | import tools.refinery.store.dse.propagation.PropagationBuilder; | 27 | import tools.refinery.store.dse.propagation.PropagationBuilder; |
17 | import tools.refinery.store.model.ModelStoreBuilder; | 28 | import tools.refinery.store.model.ModelStoreBuilder; |
18 | import tools.refinery.store.query.Constraint; | ||
19 | import tools.refinery.store.query.dnf.InvalidClauseException; | ||
20 | import tools.refinery.store.query.dnf.Query; | ||
21 | import tools.refinery.store.query.dnf.RelationalQuery; | ||
22 | import tools.refinery.store.query.literal.*; | ||
23 | import tools.refinery.store.query.term.NodeVariable; | ||
24 | import tools.refinery.store.query.term.Variable; | ||
25 | import tools.refinery.store.reasoning.ReasoningAdapter; | 29 | import tools.refinery.store.reasoning.ReasoningAdapter; |
26 | import tools.refinery.store.reasoning.representation.PartialRelation; | 30 | import tools.refinery.store.reasoning.representation.PartialRelation; |
27 | import tools.refinery.store.reasoning.scope.ScopePropagator; | 31 | import tools.refinery.store.reasoning.scope.ScopePropagator; |
@@ -29,25 +33,21 @@ import tools.refinery.store.reasoning.seed.ModelSeed; | |||
29 | import tools.refinery.store.reasoning.seed.Seed; | 33 | import tools.refinery.store.reasoning.seed.Seed; |
30 | import tools.refinery.store.reasoning.translator.TranslationException; | 34 | import tools.refinery.store.reasoning.translator.TranslationException; |
31 | import tools.refinery.store.reasoning.translator.containment.ContainmentHierarchyTranslator; | 35 | import tools.refinery.store.reasoning.translator.containment.ContainmentHierarchyTranslator; |
32 | import tools.refinery.store.reasoning.translator.metamodel.*; | 36 | import tools.refinery.store.reasoning.translator.metamodel.Metamodel; |
37 | import tools.refinery.store.reasoning.translator.metamodel.MetamodelBuilder; | ||
38 | import tools.refinery.store.reasoning.translator.metamodel.MetamodelTranslator; | ||
39 | import tools.refinery.store.reasoning.translator.metamodel.ReferenceInfo; | ||
33 | import tools.refinery.store.reasoning.translator.multiobject.MultiObjectTranslator; | 40 | import tools.refinery.store.reasoning.translator.multiobject.MultiObjectTranslator; |
34 | import tools.refinery.store.reasoning.translator.multiplicity.ConstrainedMultiplicity; | 41 | import tools.refinery.store.reasoning.translator.multiplicity.ConstrainedMultiplicity; |
35 | import tools.refinery.store.reasoning.translator.multiplicity.Multiplicity; | 42 | import tools.refinery.store.reasoning.translator.multiplicity.Multiplicity; |
36 | import tools.refinery.store.reasoning.translator.multiplicity.UnconstrainedMultiplicity; | 43 | import tools.refinery.store.reasoning.translator.multiplicity.UnconstrainedMultiplicity; |
37 | import tools.refinery.store.reasoning.translator.predicate.PredicateTranslator; | 44 | import tools.refinery.store.reasoning.translator.predicate.PredicateTranslator; |
38 | import tools.refinery.store.representation.TruthValue; | ||
39 | import tools.refinery.store.representation.cardinality.CardinalityInterval; | ||
40 | import tools.refinery.store.representation.cardinality.CardinalityIntervals; | ||
41 | import tools.refinery.store.representation.cardinality.UpperCardinalities; | ||
42 | import tools.refinery.store.tuple.Tuple; | 45 | import tools.refinery.store.tuple.Tuple; |
43 | 46 | ||
44 | import java.util.*; | 47 | import java.util.*; |
45 | 48 | ||
46 | public class ModelInitializer { | 49 | public class ModelInitializer { |
47 | @Inject | 50 | @Inject |
48 | private ProblemDesugarer desugarer; | ||
49 | |||
50 | @Inject | ||
51 | private SemanticsUtils semanticsUtils; | 51 | private SemanticsUtils semanticsUtils; |
52 | 52 | ||
53 | @Inject | 53 | @Inject |
@@ -56,6 +56,9 @@ public class ModelInitializer { | |||
56 | @Inject | 56 | @Inject |
57 | private ImportCollector importCollector; | 57 | private ImportCollector importCollector; |
58 | 58 | ||
59 | @Inject | ||
60 | private ImportAdapterProvider importAdapterProvider; | ||
61 | |||
59 | private Problem problem; | 62 | private Problem problem; |
60 | 63 | ||
61 | private final Set<Problem> importedProblems = new HashSet<>(); | 64 | private final Set<Problem> importedProblems = new HashSet<>(); |
@@ -93,8 +96,7 @@ public class ModelInitializer { | |||
93 | importedProblems.add(problem); | 96 | importedProblems.add(problem); |
94 | problemTrace.setProblem(problem); | 97 | problemTrace.setProblem(problem); |
95 | try { | 98 | try { |
96 | builtinSymbols = desugarer.getBuiltinSymbols(problem).orElseThrow(() -> new IllegalArgumentException( | 99 | builtinSymbols = importAdapterProvider.getBuiltinSymbols(problem); |
97 | "Problem has no builtin library")); | ||
98 | var nodeInfo = collectPartialRelation(builtinSymbols.node(), 1, TruthValue.TRUE, TruthValue.TRUE); | 100 | var nodeInfo = collectPartialRelation(builtinSymbols.node(), 1, TruthValue.TRUE, TruthValue.TRUE); |
99 | nodeRelation = nodeInfo.partialRelation(); | 101 | nodeRelation = nodeInfo.partialRelation(); |
100 | metamodelBuilder.type(nodeRelation); | 102 | metamodelBuilder.type(nodeRelation); |
@@ -202,20 +204,7 @@ public class ModelInitializer { | |||
202 | private void collectNodes() { | 204 | private void collectNodes() { |
203 | for (var importedProblem : importedProblems) { | 205 | for (var importedProblem : importedProblems) { |
204 | for (var statement : importedProblem.getStatements()) { | 206 | for (var statement : importedProblem.getStatements()) { |
205 | if (statement instanceof NodeDeclaration nodeDeclaration) { | 207 | collectNodes(statement); |
206 | for (var node : nodeDeclaration.getNodes()) { | ||
207 | collectNode(node); | ||
208 | } | ||
209 | } else if (statement instanceof ClassDeclaration classDeclaration) { | ||
210 | var newNode = classDeclaration.getNewNode(); | ||
211 | if (newNode != null) { | ||
212 | collectNode(newNode); | ||
213 | } | ||
214 | } else if (statement instanceof EnumDeclaration enumDeclaration) { | ||
215 | for (var literal : enumDeclaration.getLiterals()) { | ||
216 | collectNode(literal); | ||
217 | } | ||
218 | } | ||
219 | } | 208 | } |
220 | } | 209 | } |
221 | for (var node : problem.getNodes()) { | 210 | for (var node : problem.getNodes()) { |
@@ -223,6 +212,23 @@ public class ModelInitializer { | |||
223 | } | 212 | } |
224 | } | 213 | } |
225 | 214 | ||
215 | private void collectNodes(Statement statement) { | ||
216 | if (statement instanceof NodeDeclaration nodeDeclaration) { | ||
217 | for (var node : nodeDeclaration.getNodes()) { | ||
218 | collectNode(node); | ||
219 | } | ||
220 | } else if (statement instanceof ClassDeclaration classDeclaration) { | ||
221 | var newNode = classDeclaration.getNewNode(); | ||
222 | if (newNode != null) { | ||
223 | collectNode(newNode); | ||
224 | } | ||
225 | } else if (statement instanceof EnumDeclaration enumDeclaration) { | ||
226 | for (var literal : enumDeclaration.getLiterals()) { | ||
227 | collectNode(literal); | ||
228 | } | ||
229 | } | ||
230 | } | ||
231 | |||
226 | private void collectNode(Node node) { | 232 | private void collectNode(Node node) { |
227 | problemTrace.collectNode(node); | 233 | problemTrace.collectNode(node); |
228 | } | 234 | } |
@@ -243,15 +249,14 @@ public class ModelInitializer { | |||
243 | 249 | ||
244 | private void collectClassDeclarationSymbols(ClassDeclaration classDeclaration) { | 250 | private void collectClassDeclarationSymbols(ClassDeclaration classDeclaration) { |
245 | collectPartialRelation(classDeclaration, 1, null, TruthValue.UNKNOWN); | 251 | collectPartialRelation(classDeclaration, 1, null, TruthValue.UNKNOWN); |
246 | for (var featureDeclaration : classDeclaration.getFeatureDeclarations()) { | 252 | for (var referenceDeclaration : classDeclaration.getFeatureDeclarations()) { |
247 | if (featureDeclaration instanceof ReferenceDeclaration referenceDeclaration) { | 253 | if (referenceDeclaration.getReferenceType() instanceof DatatypeDeclaration) { |
248 | collectPartialRelation(referenceDeclaration, 2, null, TruthValue.UNKNOWN); | 254 | throw new TracedException(referenceDeclaration, "Attributes are not yet supported"); |
249 | var invalidMultiplicityConstraint = referenceDeclaration.getInvalidMultiplicity(); | 255 | } |
250 | if (invalidMultiplicityConstraint != null) { | 256 | collectPartialRelation(referenceDeclaration, 2, null, TruthValue.UNKNOWN); |
251 | collectPartialRelation(invalidMultiplicityConstraint, 1, TruthValue.FALSE, TruthValue.FALSE); | 257 | var invalidMultiplicityConstraint = referenceDeclaration.getInvalidMultiplicity(); |
252 | } | 258 | if (invalidMultiplicityConstraint != null) { |
253 | } else { | 259 | collectPartialRelation(invalidMultiplicityConstraint, 1, TruthValue.FALSE, TruthValue.FALSE); |
254 | throw new TracedException(featureDeclaration, "Unknown feature declaration"); | ||
255 | } | 260 | } |
256 | } | 261 | } |
257 | } | 262 | } |
@@ -319,10 +324,8 @@ public class ModelInitializer { | |||
319 | } catch (RuntimeException e) { | 324 | } catch (RuntimeException e) { |
320 | throw TracedException.addTrace(classDeclaration, e); | 325 | throw TracedException.addTrace(classDeclaration, e); |
321 | } | 326 | } |
322 | for (var featureDeclaration : classDeclaration.getFeatureDeclarations()) { | 327 | for (var referenceDeclaration : classDeclaration.getFeatureDeclarations()) { |
323 | if (featureDeclaration instanceof ReferenceDeclaration referenceDeclaration) { | 328 | collectReferenceDeclarationMetamodel(classDeclaration, referenceDeclaration); |
324 | collectReferenceDeclarationMetamodel(classDeclaration, referenceDeclaration); | ||
325 | } | ||
326 | } | 329 | } |
327 | } | 330 | } |
328 | 331 | ||
@@ -681,8 +684,8 @@ public class ModelInitializer { | |||
681 | var argumentList = toArgumentList(List.of(comparisonExpr.getLeft(), comparisonExpr.getRight()), | 684 | var argumentList = toArgumentList(List.of(comparisonExpr.getLeft(), comparisonExpr.getRight()), |
682 | localScope, literals); | 685 | localScope, literals); |
683 | boolean positive = switch (comparisonExpr.getOp()) { | 686 | boolean positive = switch (comparisonExpr.getOp()) { |
684 | case EQ -> true; | 687 | case NODE_EQ -> true; |
685 | case NOT_EQ -> false; | 688 | case NODE_NOT_EQ -> false; |
686 | default -> throw new TracedException( | 689 | default -> throw new TracedException( |
687 | comparisonExpr, "Unsupported operator"); | 690 | comparisonExpr, "Unsupported operator"); |
688 | }; | 691 | }; |
@@ -726,14 +729,18 @@ public class ModelInitializer { | |||
726 | private void collectScopes() { | 729 | private void collectScopes() { |
727 | for (var importedProblem : importedProblems) { | 730 | for (var importedProblem : importedProblems) { |
728 | for (var statement : importedProblem.getStatements()) { | 731 | for (var statement : importedProblem.getStatements()) { |
729 | if (statement instanceof ScopeDeclaration scopeDeclaration) { | 732 | collectScopes(statement); |
730 | for (var typeScope : scopeDeclaration.getTypeScopes()) { | 733 | } |
731 | if (typeScope.isIncrement()) { | 734 | } |
732 | collectTypeScopeIncrement(typeScope); | 735 | } |
733 | } else { | 736 | |
734 | collectTypeScope(typeScope); | 737 | private void collectScopes(Statement statement) { |
735 | } | 738 | if (statement instanceof ScopeDeclaration scopeDeclaration) { |
736 | } | 739 | for (var typeScope : scopeDeclaration.getTypeScopes()) { |
740 | if (typeScope.isIncrement()) { | ||
741 | collectTypeScopeIncrement(typeScope); | ||
742 | } else { | ||
743 | collectTypeScope(typeScope); | ||
737 | } | 744 | } |
738 | } | 745 | } |
739 | } | 746 | } |
diff --git a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/SemanticsUtils.java b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/SemanticsUtils.java index 9c40e6df..5e0526bc 100644 --- a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/SemanticsUtils.java +++ b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/SemanticsUtils.java | |||
@@ -7,7 +7,6 @@ package tools.refinery.language.semantics; | |||
7 | 7 | ||
8 | import com.google.inject.Inject; | 8 | import com.google.inject.Inject; |
9 | import com.google.inject.Singleton; | 9 | import com.google.inject.Singleton; |
10 | import com.google.inject.name.Named; | ||
11 | import org.eclipse.emf.ecore.EClass; | 10 | import org.eclipse.emf.ecore.EClass; |
12 | import org.eclipse.emf.ecore.EObject; | 11 | import org.eclipse.emf.ecore.EObject; |
13 | import org.eclipse.emf.ecore.util.EcoreUtil; | 12 | import org.eclipse.emf.ecore.util.EcoreUtil; |
@@ -20,7 +19,6 @@ import org.eclipse.xtext.scoping.IScope; | |||
20 | import org.jetbrains.annotations.NotNull; | 19 | import org.jetbrains.annotations.NotNull; |
21 | import org.jetbrains.annotations.Nullable; | 20 | import org.jetbrains.annotations.Nullable; |
22 | import tools.refinery.language.model.problem.Problem; | 21 | import tools.refinery.language.model.problem.Problem; |
23 | import tools.refinery.language.naming.ProblemQualifiedNameProvider; | ||
24 | 22 | ||
25 | import java.util.Optional; | 23 | import java.util.Optional; |
26 | 24 | ||
@@ -30,17 +28,13 @@ public class SemanticsUtils { | |||
30 | private IQualifiedNameProvider qualifiedNameProvider; | 28 | private IQualifiedNameProvider qualifiedNameProvider; |
31 | 29 | ||
32 | @Inject | 30 | @Inject |
33 | @Named(ProblemQualifiedNameProvider.NAMED_DELEGATE) | ||
34 | private IQualifiedNameProvider delegateQualifiedNameProvider; | ||
35 | |||
36 | @Inject | ||
37 | private IQualifiedNameConverter qualifiedNameConverter; | 31 | private IQualifiedNameConverter qualifiedNameConverter; |
38 | 32 | ||
39 | @Inject | 33 | @Inject |
40 | private IResourceDescriptionsProvider resourceDescriptionsProvider; | 34 | private IResourceDescriptionsProvider resourceDescriptionsProvider; |
41 | 35 | ||
42 | public Optional<String> getNameWithoutRootPrefix(EObject eObject) { | 36 | public Optional<String> getNameWithoutRootPrefix(EObject eObject) { |
43 | var qualifiedName = delegateQualifiedNameProvider.getFullyQualifiedName(eObject); | 37 | var qualifiedName = qualifiedNameProvider.getFullyQualifiedName(eObject); |
44 | if (qualifiedName == null) { | 38 | if (qualifiedName == null) { |
45 | return Optional.empty(); | 39 | return Optional.empty(); |
46 | } | 40 | } |
diff --git a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/SolutionSerializer.java b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/SolutionSerializer.java index 377a66f3..f097143f 100644 --- a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/SolutionSerializer.java +++ b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/SolutionSerializer.java | |||
@@ -21,7 +21,8 @@ import org.eclipse.xtext.resource.XtextResourceSet; | |||
21 | import org.eclipse.xtext.scoping.IScopeProvider; | 21 | import org.eclipse.xtext.scoping.IScopeProvider; |
22 | import tools.refinery.language.model.problem.*; | 22 | import tools.refinery.language.model.problem.*; |
23 | import tools.refinery.language.naming.NamingUtil; | 23 | import tools.refinery.language.naming.NamingUtil; |
24 | import tools.refinery.language.utils.ProblemDesugarer; | 24 | import tools.refinery.language.scoping.imports.ImportAdapterProvider; |
25 | import tools.refinery.language.typesystem.SignatureProvider; | ||
25 | import tools.refinery.language.utils.ProblemUtil; | 26 | import tools.refinery.language.utils.ProblemUtil; |
26 | import tools.refinery.store.model.Model; | 27 | import tools.refinery.store.model.Model; |
27 | import tools.refinery.store.reasoning.ReasoningAdapter; | 28 | import tools.refinery.store.reasoning.ReasoningAdapter; |
@@ -30,7 +31,7 @@ import tools.refinery.store.reasoning.literal.Concreteness; | |||
30 | import tools.refinery.store.reasoning.representation.PartialRelation; | 31 | import tools.refinery.store.reasoning.representation.PartialRelation; |
31 | import tools.refinery.store.reasoning.translator.typehierarchy.InferredType; | 32 | import tools.refinery.store.reasoning.translator.typehierarchy.InferredType; |
32 | import tools.refinery.store.reasoning.translator.typehierarchy.TypeHierarchyTranslator; | 33 | import tools.refinery.store.reasoning.translator.typehierarchy.TypeHierarchyTranslator; |
33 | import tools.refinery.store.representation.TruthValue; | 34 | import tools.refinery.logic.term.truthvalue.TruthValue; |
34 | import tools.refinery.store.tuple.Tuple; | 35 | import tools.refinery.store.tuple.Tuple; |
35 | 36 | ||
36 | import java.io.ByteArrayInputStream; | 37 | import java.io.ByteArrayInputStream; |
@@ -57,10 +58,13 @@ public class SolutionSerializer { | |||
57 | private IScopeProvider scopeProvider; | 58 | private IScopeProvider scopeProvider; |
58 | 59 | ||
59 | @Inject | 60 | @Inject |
60 | private ProblemDesugarer desugarer; | 61 | private NodeNameProvider nameProvider; |
61 | 62 | ||
62 | @Inject | 63 | @Inject |
63 | private NodeNameProvider nameProvider; | 64 | private ImportAdapterProvider importAdapterProvider; |
65 | |||
66 | @Inject | ||
67 | private SignatureProvider signatureProvider; | ||
64 | 68 | ||
65 | private ProblemTrace trace; | 69 | private ProblemTrace trace; |
66 | private Model model; | 70 | private Model model; |
@@ -223,8 +227,7 @@ public class SolutionSerializer { | |||
223 | } | 227 | } |
224 | 228 | ||
225 | private void addExistsAssertions() { | 229 | private void addExistsAssertions() { |
226 | var builtinSymbols = desugarer.getBuiltinSymbols(problem).orElseThrow(() -> new IllegalStateException("No " + | 230 | var builtinSymbols = importAdapterProvider.getBuiltinSymbols(problem); |
227 | "builtin library in copied problem")); | ||
228 | // Make sure to output exists assertions in a deterministic order. | 231 | // Make sure to output exists assertions in a deterministic order. |
229 | var sortedNewNodes = new TreeMap<Integer, Node>(); | 232 | var sortedNewNodes = new TreeMap<Integer, Node>(); |
230 | for (var pair : trace.getNodeTrace().keyValuesView()) { | 233 | for (var pair : trace.getNodeTrace().keyValuesView()) { |
@@ -336,7 +339,7 @@ public class SolutionSerializer { | |||
336 | var assertion = ProblemFactory.eINSTANCE.createAssertion(); | 339 | var assertion = ProblemFactory.eINSTANCE.createAssertion(); |
337 | assertion.setDefault(true); | 340 | assertion.setDefault(true); |
338 | assertion.setRelation(relation); | 341 | assertion.setRelation(relation); |
339 | int arity = ProblemUtil.getArity(relation); | 342 | int arity = signatureProvider.getArity(relation); |
340 | for (int i = 0; i < arity; i++) { | 343 | for (int i = 0; i < arity; i++) { |
341 | var argument = ProblemFactory.eINSTANCE.createWildcardAssertionArgument(); | 344 | var argument = ProblemFactory.eINSTANCE.createWildcardAssertionArgument(); |
342 | assertion.getArguments().add(argument); | 345 | assertion.getArguments().add(argument); |
diff --git a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/DecisionTree.java b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/DecisionTree.java index 5d25f148..8aa1af28 100644 --- a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/DecisionTree.java +++ b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/DecisionTree.java | |||
@@ -7,7 +7,7 @@ package tools.refinery.language.semantics.internal; | |||
7 | 7 | ||
8 | import org.eclipse.collections.api.factory.primitive.IntObjectMaps; | 8 | import org.eclipse.collections.api.factory.primitive.IntObjectMaps; |
9 | import tools.refinery.store.map.Cursor; | 9 | import tools.refinery.store.map.Cursor; |
10 | import tools.refinery.store.representation.TruthValue; | 10 | import tools.refinery.logic.term.truthvalue.TruthValue; |
11 | import tools.refinery.store.tuple.Tuple; | 11 | import tools.refinery.store.tuple.Tuple; |
12 | 12 | ||
13 | class DecisionTree implements MutableSeed<TruthValue> { | 13 | class DecisionTree implements MutableSeed<TruthValue> { |
diff --git a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/DecisionTreeCursor.java b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/DecisionTreeCursor.java index 71b54cbd..8b8fed36 100644 --- a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/DecisionTreeCursor.java +++ b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/DecisionTreeCursor.java | |||
@@ -6,7 +6,7 @@ | |||
6 | package tools.refinery.language.semantics.internal; | 6 | package tools.refinery.language.semantics.internal; |
7 | 7 | ||
8 | import tools.refinery.store.map.Cursor; | 8 | import tools.refinery.store.map.Cursor; |
9 | import tools.refinery.store.representation.TruthValue; | 9 | import tools.refinery.logic.term.truthvalue.TruthValue; |
10 | import tools.refinery.store.tuple.Tuple; | 10 | import tools.refinery.store.tuple.Tuple; |
11 | 11 | ||
12 | import java.util.ArrayDeque; | 12 | import java.util.ArrayDeque; |
diff --git a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/DecisionTreeNode.java b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/DecisionTreeNode.java index 31d6fc78..eb79e0c8 100644 --- a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/DecisionTreeNode.java +++ b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/DecisionTreeNode.java | |||
@@ -7,7 +7,7 @@ package tools.refinery.language.semantics.internal; | |||
7 | 7 | ||
8 | import org.eclipse.collections.api.LazyIntIterable; | 8 | import org.eclipse.collections.api.LazyIntIterable; |
9 | import tools.refinery.store.tuple.Tuple; | 9 | import tools.refinery.store.tuple.Tuple; |
10 | import tools.refinery.store.representation.TruthValue; | 10 | import tools.refinery.logic.term.truthvalue.TruthValue; |
11 | 11 | ||
12 | abstract class DecisionTreeNode { | 12 | abstract class DecisionTreeNode { |
13 | public DecisionTreeValue getReducedValue() { | 13 | public DecisionTreeValue getReducedValue() { |
diff --git a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/DecisionTreeValue.java b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/DecisionTreeValue.java index 5053e7ac..a6b55989 100644 --- a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/DecisionTreeValue.java +++ b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/DecisionTreeValue.java | |||
@@ -5,7 +5,7 @@ | |||
5 | */ | 5 | */ |
6 | package tools.refinery.language.semantics.internal; | 6 | package tools.refinery.language.semantics.internal; |
7 | 7 | ||
8 | import tools.refinery.store.representation.TruthValue; | 8 | import tools.refinery.logic.term.truthvalue.TruthValue; |
9 | 9 | ||
10 | public enum DecisionTreeValue { | 10 | public enum DecisionTreeValue { |
11 | UNSET(null), | 11 | UNSET(null), |
@@ -25,7 +25,7 @@ public enum DecisionTreeValue { | |||
25 | } | 25 | } |
26 | 26 | ||
27 | public TruthValue merge(TruthValue other) { | 27 | public TruthValue merge(TruthValue other) { |
28 | return truthValue == null ? other : truthValue.merge(other); | 28 | return truthValue == null ? other : truthValue.meet(other); |
29 | } | 29 | } |
30 | 30 | ||
31 | public DecisionTreeValue overwrite(DecisionTreeValue other) { | 31 | public DecisionTreeValue overwrite(DecisionTreeValue other) { |
diff --git a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/IntermediateNode.java b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/IntermediateNode.java index 2ad216ce..8942068c 100644 --- a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/IntermediateNode.java +++ b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/IntermediateNode.java | |||
@@ -10,7 +10,7 @@ import org.eclipse.collections.api.factory.primitive.IntObjectMaps; | |||
10 | import org.eclipse.collections.api.map.primitive.MutableIntObjectMap; | 10 | import org.eclipse.collections.api.map.primitive.MutableIntObjectMap; |
11 | import org.eclipse.collections.api.tuple.primitive.IntObjectPair; | 11 | import org.eclipse.collections.api.tuple.primitive.IntObjectPair; |
12 | import tools.refinery.store.tuple.Tuple; | 12 | import tools.refinery.store.tuple.Tuple; |
13 | import tools.refinery.store.representation.TruthValue; | 13 | import tools.refinery.logic.term.truthvalue.TruthValue; |
14 | 14 | ||
15 | final class IntermediateNode extends DecisionTreeNode { | 15 | final class IntermediateNode extends DecisionTreeNode { |
16 | private final MutableIntObjectMap<DecisionTreeNode> children; | 16 | private final MutableIntObjectMap<DecisionTreeNode> children; |
diff --git a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/MutableSeed.java b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/MutableSeed.java index 693b9e1f..85611059 100644 --- a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/MutableSeed.java +++ b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/MutableSeed.java | |||
@@ -6,7 +6,7 @@ | |||
6 | package tools.refinery.language.semantics.internal; | 6 | package tools.refinery.language.semantics.internal; |
7 | 7 | ||
8 | import tools.refinery.store.reasoning.seed.Seed; | 8 | import tools.refinery.store.reasoning.seed.Seed; |
9 | import tools.refinery.store.representation.TruthValue; | 9 | import tools.refinery.logic.term.truthvalue.TruthValue; |
10 | import tools.refinery.store.tuple.Tuple; | 10 | import tools.refinery.store.tuple.Tuple; |
11 | 11 | ||
12 | public interface MutableSeed<T> extends Seed<T> { | 12 | public interface MutableSeed<T> extends Seed<T> { |
diff --git a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/NullaryMutableSeed.java b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/NullaryMutableSeed.java index f100c5a6..09107a37 100644 --- a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/NullaryMutableSeed.java +++ b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/NullaryMutableSeed.java | |||
@@ -7,7 +7,7 @@ package tools.refinery.language.semantics.internal; | |||
7 | 7 | ||
8 | import tools.refinery.store.map.Cursor; | 8 | import tools.refinery.store.map.Cursor; |
9 | import tools.refinery.store.map.Cursors; | 9 | import tools.refinery.store.map.Cursors; |
10 | import tools.refinery.store.representation.TruthValue; | 10 | import tools.refinery.logic.term.truthvalue.TruthValue; |
11 | import tools.refinery.store.tuple.Tuple; | 11 | import tools.refinery.store.tuple.Tuple; |
12 | 12 | ||
13 | class NullaryMutableSeed implements MutableSeed<TruthValue> { | 13 | class NullaryMutableSeed implements MutableSeed<TruthValue> { |
diff --git a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/TerminalNode.java b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/TerminalNode.java index dc501479..75933fe4 100644 --- a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/TerminalNode.java +++ b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/internal/TerminalNode.java | |||
@@ -10,7 +10,7 @@ import org.eclipse.collections.api.factory.primitive.IntObjectMaps; | |||
10 | import org.eclipse.collections.api.map.primitive.MutableIntObjectMap; | 10 | import org.eclipse.collections.api.map.primitive.MutableIntObjectMap; |
11 | import org.eclipse.collections.api.tuple.primitive.IntObjectPair; | 11 | import org.eclipse.collections.api.tuple.primitive.IntObjectPair; |
12 | import tools.refinery.store.tuple.Tuple; | 12 | import tools.refinery.store.tuple.Tuple; |
13 | import tools.refinery.store.representation.TruthValue; | 13 | import tools.refinery.logic.term.truthvalue.TruthValue; |
14 | 14 | ||
15 | class TerminalNode extends DecisionTreeNode { | 15 | class TerminalNode extends DecisionTreeNode { |
16 | private MutableIntObjectMap<TruthValue> children; | 16 | private MutableIntObjectMap<TruthValue> children; |
@@ -48,7 +48,7 @@ class TerminalNode extends DecisionTreeNode { | |||
48 | protected void mergeAllValues(int nextLevel, Tuple tuple, TruthValue value) { | 48 | protected void mergeAllValues(int nextLevel, Tuple tuple, TruthValue value) { |
49 | otherwise = DecisionTreeValue.fromTruthValue(otherwise.merge(value)); | 49 | otherwise = DecisionTreeValue.fromTruthValue(otherwise.merge(value)); |
50 | children = IntObjectMaps.mutable.from(children.keyValuesView(), IntObjectPair::getOne, | 50 | children = IntObjectMaps.mutable.from(children.keyValuesView(), IntObjectPair::getOne, |
51 | pair -> pair.getTwo().merge(value)); | 51 | pair -> pair.getTwo().meet(value)); |
52 | reduceChildren(); | 52 | reduceChildren(); |
53 | } | 53 | } |
54 | 54 | ||