summaryrefslogtreecommitdiffstats
path: root/subprojects
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects')
-rw-r--r--subprojects/frontend/src/language/problem.grammar10
-rw-r--r--subprojects/frontend/src/language/problemLanguageSupport.ts3
-rw-r--r--subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/ProblemCrossrefProposalProvider.java7
-rw-r--r--subprojects/language-ide/src/main/java/tools/refinery/language/ide/syntaxcoloring/ProblemSemanticHighlightingCalculator.java3
-rw-r--r--subprojects/language-model/problem.aird71
-rw-r--r--subprojects/language-model/src/main/resources/model/problem.ecore4
-rw-r--r--subprojects/language-model/src/main/resources/model/problem.genmodel3
-rw-r--r--subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/ModelInitializer.java34
-rw-r--r--subprojects/language/src/main/java/tools/refinery/language/Problem.xtext4
-rw-r--r--subprojects/language/src/main/java/tools/refinery/language/parser/antlr/ProblemTokenSource.java9
-rw-r--r--subprojects/language/src/main/java/tools/refinery/language/resource/ProblemResourceDescriptionStrategy.java11
-rw-r--r--subprojects/language/src/main/java/tools/refinery/language/resource/state/ProblemDerivedStateComputer.java49
-rw-r--r--subprojects/language/src/main/java/tools/refinery/language/utils/ProblemUtil.java17
-rw-r--r--subprojects/language/src/main/java/tools/refinery/language/validation/ProblemValidator.java16
-rw-r--r--subprojects/language/src/test/java/tools/refinery/language/tests/parser/antlr/ProblemTokenSourceTest.java4
-rw-r--r--subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/literal/ComputedConstraint.java2
16 files changed, 154 insertions, 93 deletions
diff --git a/subprojects/frontend/src/language/problem.grammar b/subprojects/frontend/src/language/problem.grammar
index a4cb7135..860ed045 100644
--- a/subprojects/frontend/src/language/problem.grammar
+++ b/subprojects/frontend/src/language/problem.grammar
@@ -52,10 +52,8 @@ statement {
52 kw<"extern"> ckw<"aggregator"> AggregatorName "." 52 kw<"extern"> ckw<"aggregator"> AggregatorName "."
53 } | 53 } |
54 PredicateDefinition { 54 PredicateDefinition {
55 ( 55 ckw<"shadow">?
56 (kw<"error"> | ckw<"contained"> | kw<"containment">)? kw<"pred"> | 56 (kw<"error">? kw<"pred"> | kw<"error">)
57 kw<"error">
58 )
59 RelationName ParameterList<Parameter>? 57 RelationName ParameterList<Parameter>?
60 PredicateBody { ("<->" sep<OrOp, Conjunction>)? "." } 58 PredicateBody { ("<->" sep<OrOp, Conjunction>)? "." }
61 } | 59 } |
@@ -144,7 +142,7 @@ Aggregation {
144 AggregatorName "{" Expr "|" Expr "}" 142 AggregatorName "{" Expr "|" Expr "}"
145} 143}
146 144
147Atom { RelationName ComputedValue? "+"? ParameterList<Expr> } 145Atom { RelationName "+"? ParameterList<Expr> }
148 146
149Consequent { ("," | Action)+ } 147Consequent { ("," | Action)+ }
150 148
@@ -263,7 +261,5 @@ sep1<separator, content> { content (separator content)* }
263 261
264 AndBinding { "&" } 262 AndBinding { "&" }
265 263
266 ComputedValue { "$" }
267
268 "{" "}" "(" ")" "[" "]" "." ".." "," ";" ":" "->" "<->" "==>" "+" "-" "**" "=" "+=" 264 "{" "}" "(" ")" "[" "]" "." ".." "," ";" ":" "->" "<->" "==>" "+" "-" "**" "=" "+="
269} 265}
diff --git a/subprojects/frontend/src/language/problemLanguageSupport.ts b/subprojects/frontend/src/language/problemLanguageSupport.ts
index 064e2825..aeb93357 100644
--- a/subprojects/frontend/src/language/problemLanguageSupport.ts
+++ b/subprojects/frontend/src/language/problemLanguageSupport.ts
@@ -38,7 +38,7 @@ const parserWithMetadata = parser.configure({
38 rule: t.definitionKeyword, 38 rule: t.definitionKeyword,
39 'abstract extends refers contains container partial opposite': t.modifier, 39 'abstract extends refers contains container partial opposite': t.modifier,
40 default: t.modifier, 40 default: t.modifier,
41 'propagation decision': t.modifier, 41 'shadow propagation decision': t.modifier,
42 'true false unknown error': t.keyword, 42 'true false unknown error': t.keyword,
43 'candidate may must': t.operatorKeyword, 43 'candidate may must': t.operatorKeyword,
44 'count in is': t.operatorKeyword, 44 'count in is': t.operatorKeyword,
@@ -61,7 +61,6 @@ const parserWithMetadata = parser.configure({
61 '[ ]': t.squareBracket, 61 '[ ]': t.squareBracket,
62 '. .. , ; :': t.separator, 62 '. .. , ; :': t.separator,
63 '<-> = += -> ==>': t.definitionOperator, 63 '<-> = += -> ==>': t.definitionOperator,
64 ComputedValue: t.operator,
65 }), 64 }),
66 indentNodeProp.add({ 65 indentNodeProp.add({
67 ProblemDeclaration: indentDeclaration, 66 ProblemDeclaration: indentDeclaration,
diff --git a/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/ProblemCrossrefProposalProvider.java b/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/ProblemCrossrefProposalProvider.java
index 963e69c3..e9318b5f 100644
--- a/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/ProblemCrossrefProposalProvider.java
+++ b/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/ProblemCrossrefProposalProvider.java
@@ -104,14 +104,9 @@ public class ProblemCrossrefProposalProvider extends IdeCrossrefProposalProvider
104 // Do not propose names with a root prefix unless explicitly asked for. 104 // Do not propose names with a root prefix unless explicitly asked for.
105 return false; 105 return false;
106 } 106 }
107
107 var errorPredicate = candidate.getUserData(ProblemResourceDescriptionStrategy.ERROR_PREDICATE); 108 var errorPredicate = candidate.getUserData(ProblemResourceDescriptionStrategy.ERROR_PREDICATE);
108 if (ProblemResourceDescriptionStrategy.ERROR_PREDICATE_TRUE.equals(errorPredicate)) { 109 if (ProblemResourceDescriptionStrategy.ERROR_PREDICATE_TRUE.equals(errorPredicate)) {
109 var definitionContext = EcoreUtil2.getContainerOfType(context.getCurrentModel(),
110 ParametricDefinition.class);
111 if (definitionContext instanceof RuleDefinition) {
112 var computedValue = candidate.getUserData(ProblemResourceDescriptionStrategy.COMPUTED_VALUE);
113 return ProblemResourceDescriptionStrategy.COMPUTED_VALUE_TRUE.equals(computedValue);
114 }
115 return false; 110 return false;
116 } 111 }
117 112
diff --git a/subprojects/language-ide/src/main/java/tools/refinery/language/ide/syntaxcoloring/ProblemSemanticHighlightingCalculator.java b/subprojects/language-ide/src/main/java/tools/refinery/language/ide/syntaxcoloring/ProblemSemanticHighlightingCalculator.java
index 7f37ed66..c68462dd 100644
--- a/subprojects/language-ide/src/main/java/tools/refinery/language/ide/syntaxcoloring/ProblemSemanticHighlightingCalculator.java
+++ b/subprojects/language-ide/src/main/java/tools/refinery/language/ide/syntaxcoloring/ProblemSemanticHighlightingCalculator.java
@@ -98,8 +98,7 @@ public class ProblemSemanticHighlightingCalculator extends DefaultSemanticHighli
98 protected String[] getHighlightClass(EObject eObject, EObject owner, EReference reference) { 98 protected String[] getHighlightClass(EObject eObject, EObject owner, EReference reference) {
99 // References to error patterns should be highlighted as errors, but error pattern definitions and 99 // References to error patterns should be highlighted as errors, but error pattern definitions and
100 // references to the computed values of error patterns shouldn't. 100 // references to the computed values of error patterns shouldn't.
101 boolean isError = ProblemUtil.isError(eObject) && reference != null && 101 boolean isError = ProblemUtil.isError(eObject) && reference != null;
102 !(owner instanceof Atom atom && atom.isComputed());
103 if (ProblemUtil.isBuiltIn(eObject) && !(eObject instanceof Problem)) { 102 if (ProblemUtil.isBuiltIn(eObject) && !(eObject instanceof Problem)) {
104 var className = isError ? ERROR_CLASS : BUILTIN_CLASS; 103 var className = isError ? ERROR_CLASS : BUILTIN_CLASS;
105 return new String[]{className}; 104 return new String[]{className};
diff --git a/subprojects/language-model/problem.aird b/subprojects/language-model/problem.aird
index 9de9b792..88e976cd 100644
--- a/subprojects/language-model/problem.aird
+++ b/subprojects/language-model/problem.aird
@@ -7,11 +7,11 @@
7 <semanticResources>build/resources/main/model/problem.genmodel</semanticResources> 7 <semanticResources>build/resources/main/model/problem.genmodel</semanticResources>
8 <ownedViews xmi:type="viewpoint:DView" uid="_CsAAYKA4EeuqkpDnuik1sg"> 8 <ownedViews xmi:type="viewpoint:DView" uid="_CsAAYKA4EeuqkpDnuik1sg">
9 <viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']"/> 9 <viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']"/>
10 <ownedRepresentationDescriptors xmi:type="viewpoint:DRepresentationDescriptor" uid="_CsYa4KA4EeuqkpDnuik1sg" name="declarations" repPath="#_CsUwgKA4EeuqkpDnuik1sg" changeId="1719661998016"> 10 <ownedRepresentationDescriptors xmi:type="viewpoint:DRepresentationDescriptor" uid="_CsYa4KA4EeuqkpDnuik1sg" name="declarations" repPath="#_CsUwgKA4EeuqkpDnuik1sg" changeId="1719856829302">
11 <description xmi:type="description_1:DiagramDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']"/> 11 <description xmi:type="description_1:DiagramDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']"/>
12 <target xmi:type="ecore:EPackage" href="src/main/resources/model/problem.ecore#/"/> 12 <target xmi:type="ecore:EPackage" href="src/main/resources/model/problem.ecore#/"/>
13 </ownedRepresentationDescriptors> 13 </ownedRepresentationDescriptors>
14 <ownedRepresentationDescriptors xmi:type="viewpoint:DRepresentationDescriptor" uid="_z1bOYF3lEe2LuOZzJ_LhLg" name="expressions" repPath="#_z1YyIF3lEe2LuOZzJ_LhLg" changeId="1719662018735"> 14 <ownedRepresentationDescriptors xmi:type="viewpoint:DRepresentationDescriptor" uid="_z1bOYF3lEe2LuOZzJ_LhLg" name="expressions" repPath="#_z1YyIF3lEe2LuOZzJ_LhLg" changeId="1719854700644">
15 <description xmi:type="description_1:DiagramDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']"/> 15 <description xmi:type="description_1:DiagramDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']"/>
16 <target xmi:type="ecore:EPackage" href="src/main/resources/model/problem.ecore#/"/> 16 <target xmi:type="ecore:EPackage" href="src/main/resources/model/problem.ecore#/"/>
17 </ownedRepresentationDescriptors> 17 </ownedRepresentationDescriptors>
@@ -91,6 +91,10 @@
91 <styles xmi:type="notation:FontStyle" xmi:id="_bmoagTrQEe62Q_vL_UTCsA" fontColor="2697711" fontName="Noto Sans" fontHeight="8"/> 91 <styles xmi:type="notation:FontStyle" xmi:id="_bmoagTrQEe62Q_vL_UTCsA" fontColor="2697711" fontName="Noto Sans" fontHeight="8"/>
92 <layoutConstraint xmi:type="notation:Location" xmi:id="_bmoagjrQEe62Q_vL_UTCsA"/> 92 <layoutConstraint xmi:type="notation:Location" xmi:id="_bmoagjrQEe62Q_vL_UTCsA"/>
93 </children> 93 </children>
94 <children xmi:type="notation:Node" xmi:id="_7PR4kDfOEe-Iy-tQWPZJFQ" type="3010" element="_7N28QDfOEe-Iy-tQWPZJFQ">
95 <styles xmi:type="notation:FontStyle" xmi:id="_7PR4kTfOEe-Iy-tQWPZJFQ" fontColor="2697711" fontName="Noto Sans" fontHeight="8"/>
96 <layoutConstraint xmi:type="notation:Location" xmi:id="_7PR4kjfOEe-Iy-tQWPZJFQ"/>
97 </children>
94 <styles xmi:type="notation:SortingStyle" xmi:id="_fit3laA5EeuqkpDnuik1sg"/> 98 <styles xmi:type="notation:SortingStyle" xmi:id="_fit3laA5EeuqkpDnuik1sg"/>
95 <styles xmi:type="notation:FilteringStyle" xmi:id="_fit3lqA5EeuqkpDnuik1sg"/> 99 <styles xmi:type="notation:FilteringStyle" xmi:id="_fit3lqA5EeuqkpDnuik1sg"/>
96 </children> 100 </children>
@@ -1442,6 +1446,22 @@
1442 <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_EJd5dtsWEe6c9ehqpe3s7A" id="(0.6068965517241379,0.030612244897959183)"/> 1446 <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_EJd5dtsWEe6c9ehqpe3s7A" id="(0.6068965517241379,0.030612244897959183)"/>
1443 <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_EJd5d9sWEe6c9ehqpe3s7A" id="(0.5,0.5)"/> 1447 <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_EJd5d9sWEe6c9ehqpe3s7A" id="(0.5,0.5)"/>
1444 </edges> 1448 </edges>
1449 <edges xmi:type="notation:Edge" xmi:id="_r2kP4DfTEe-Iy-tQWPZJFQ" type="4001" element="_r1sGLDfTEe-Iy-tQWPZJFQ" source="_fit3kKA5EeuqkpDnuik1sg" target="_fit3kKA5EeuqkpDnuik1sg">
1450 <children xmi:type="notation:Node" xmi:id="_r2ohUDfTEe-Iy-tQWPZJFQ" type="6001">
1451 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_r2ohUTfTEe-Iy-tQWPZJFQ" x="37" y="6"/>
1452 </children>
1453 <children xmi:type="notation:Node" xmi:id="_r2pIYDfTEe-Iy-tQWPZJFQ" type="6002">
1454 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_r2pIYTfTEe-Iy-tQWPZJFQ" x="-16" y="-50"/>
1455 </children>
1456 <children xmi:type="notation:Node" xmi:id="_r2pIYjfTEe-Iy-tQWPZJFQ" type="6003">
1457 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_r2pIYzfTEe-Iy-tQWPZJFQ" x="2" y="10"/>
1458 </children>
1459 <styles xmi:type="notation:ConnectorStyle" xmi:id="_r2kP4TfTEe-Iy-tQWPZJFQ" routing="Rectilinear"/>
1460 <styles xmi:type="notation:FontStyle" xmi:id="_r2kP4jfTEe-Iy-tQWPZJFQ" fontColor="7490599" fontName="Noto Sans" fontHeight="8"/>
1461 <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_r2kP4zfTEe-Iy-tQWPZJFQ" points="[-60, -70, -32, 28]$[-120, -70, -92, 28]$[-120, -22, -92, 76]$[-60, -22, -32, 76]"/>
1462 <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_r2q9kDfTEe-Iy-tQWPZJFQ" id="(0.40540540540540543,1.0)"/>
1463 <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_r2q9kTfTEe-Iy-tQWPZJFQ" id="(0.21621621621621623,0.0)"/>
1464 </edges>
1445 </data> 1465 </data>
1446 </ownedAnnotationEntries> 1466 </ownedAnnotationEntries>
1447 <ownedAnnotationEntries xmi:type="description:AnnotationEntry" uid="_Csiy8KA4EeuqkpDnuik1sg" source="DANNOTATION_CUSTOMIZATION_KEY"> 1467 <ownedAnnotationEntries xmi:type="description:AnnotationEntry" uid="_Csiy8KA4EeuqkpDnuik1sg" source="DANNOTATION_CUSTOMIZATION_KEY">
@@ -1569,13 +1589,13 @@
1569 <actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']"/> 1589 <actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']"/>
1570 </ownedElements> 1590 </ownedElements>
1571 </ownedDiagramElements> 1591 </ownedDiagramElements>
1572 <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_fihqUKA5EeuqkpDnuik1sg" name="PredicateDefinition" tooltipText="" outgoingEdges="_ddmjcCrZEeyyC-O0_LlY9w _Y9Sm0F9wEe2rXNsIDUvqhw _p-1uSmTvEe2qdtyPWAtoxA" width="12" height="10"> 1592 <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_fihqUKA5EeuqkpDnuik1sg" name="PredicateDefinition" tooltipText="" outgoingEdges="_ddmjcCrZEeyyC-O0_LlY9w _Y9Sm0F9wEe2rXNsIDUvqhw _p-1uSmTvEe2qdtyPWAtoxA _r1sGLDfTEe-Iy-tQWPZJFQ" incomingEdges="_r1sGLDfTEe-Iy-tQWPZJFQ" width="12" height="10">
1573 <target xmi:type="ecore:EClass" href="src/main/resources/model/problem.ecore#//PredicateDefinition"/> 1593 <target xmi:type="ecore:EClass" href="src/main/resources/model/problem.ecore#//PredicateDefinition"/>
1574 <semanticElements xmi:type="ecore:EClass" href="src/main/resources/model/problem.ecore#//PredicateDefinition"/> 1594 <semanticElements xmi:type="ecore:EClass" href="src/main/resources/model/problem.ecore#//PredicateDefinition"/>
1575 <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> 1595 <arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
1576 <arrangeConstraints>KEEP_SIZE</arrangeConstraints> 1596 <arrangeConstraints>KEEP_SIZE</arrangeConstraints>
1577 <arrangeConstraints>KEEP_RATIO</arrangeConstraints> 1597 <arrangeConstraints>KEEP_RATIO</arrangeConstraints>
1578 <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_dFvc0DrQEe62Q_vL_UTCsA" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216"> 1598 <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_t8gJATfQEe-Iy-tQWPZJFQ" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216">
1579 <description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/> 1599 <description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/>
1580 </ownedStyle> 1600 </ownedStyle>
1581 <actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/> 1601 <actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
@@ -1587,6 +1607,14 @@
1587 </ownedStyle> 1607 </ownedStyle>
1588 <actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']"/> 1608 <actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']"/>
1589 </ownedElements> 1609 </ownedElements>
1610 <ownedElements xmi:type="diagram:DNodeListElement" uid="_7N28QDfOEe-Iy-tQWPZJFQ" name="shadow : EBoolean = false" tooltipText="">
1611 <target xmi:type="ecore:EAttribute" href="src/main/resources/model/problem.ecore#//PredicateDefinition/shadow"/>
1612 <semanticElements xmi:type="ecore:EAttribute" href="src/main/resources/model/problem.ecore#//PredicateDefinition/shadow"/>
1613 <ownedStyle xmi:type="diagram:BundledImage" uid="_t8lBgTfQEe-Iy-tQWPZJFQ" labelAlignment="LEFT">
1614 <description xmi:type="style:BundledImageDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']/@style"/>
1615 </ownedStyle>
1616 <actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']"/>
1617 </ownedElements>
1590 </ownedDiagramElements> 1618 </ownedDiagramElements>
1591 <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_QKD2EKA6EeuqkpDnuik1sg" name="Parameter" tooltipText="" outgoingEdges="_oni4rKA6EeuqkpDnuik1sg _iWzpAmTzEe2qdtyPWAtoxA" incomingEdges="_Uy4bWaA6EeuqkpDnuik1sg" width="12" height="10"> 1619 <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_QKD2EKA6EeuqkpDnuik1sg" name="Parameter" tooltipText="" outgoingEdges="_oni4rKA6EeuqkpDnuik1sg _iWzpAmTzEe2qdtyPWAtoxA" incomingEdges="_Uy4bWaA6EeuqkpDnuik1sg" width="12" height="10">
1592 <target xmi:type="ecore:EClass" href="src/main/resources/model/problem.ecore#//Parameter"/> 1620 <target xmi:type="ecore:EClass" href="src/main/resources/model/problem.ecore#//Parameter"/>
@@ -2106,12 +2134,12 @@
2106 <ownedDiagramElements xmi:type="diagram:DEdge" uid="_ddmjcCrZEeyyC-O0_LlY9w" sourceNode="_fihqUKA5EeuqkpDnuik1sg" targetNode="_A8hIkCrZEeyyC-O0_LlY9w"> 2134 <ownedDiagramElements xmi:type="diagram:DEdge" uid="_ddmjcCrZEeyyC-O0_LlY9w" sourceNode="_fihqUKA5EeuqkpDnuik1sg" targetNode="_A8hIkCrZEeyyC-O0_LlY9w">
2107 <target xmi:type="ecore:EClass" href="src/main/resources/model/problem.ecore#//PredicateDefinition"/> 2135 <target xmi:type="ecore:EClass" href="src/main/resources/model/problem.ecore#//PredicateDefinition"/>
2108 <semanticElements xmi:type="ecore:EClass" href="src/main/resources/model/problem.ecore#//PredicateDefinition"/> 2136 <semanticElements xmi:type="ecore:EClass" href="src/main/resources/model/problem.ecore#//PredicateDefinition"/>
2109 <ownedStyle xmi:type="diagram:EdgeStyle" uid="_dF7qIjrQEe62Q_vL_UTCsA" lineStyle="dash" targetArrow="InputClosedArrow" routingStyle="tree"> 2137 <ownedStyle xmi:type="diagram:EdgeStyle" uid="_t8yc-DfQEe-Iy-tQWPZJFQ" lineStyle="dash" targetArrow="InputClosedArrow" routingStyle="tree">
2110 <description xmi:type="style:EdgeStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']/@conditionnalStyles.0/@style"/> 2138 <description xmi:type="style:EdgeStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']/@conditionnalStyles.0/@style"/>
2111 <beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_dF7qIzrQEe62Q_vL_UTCsA" showIcon="false"> 2139 <beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_t8yc-TfQEe-Iy-tQWPZJFQ" showIcon="false">
2112 <labelFormat>italic</labelFormat> 2140 <labelFormat>italic</labelFormat>
2113 </beginLabelStyle> 2141 </beginLabelStyle>
2114 <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_dF7qJDrQEe62Q_vL_UTCsA" showIcon="false"/> 2142 <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_t8yc-jfQEe-Iy-tQWPZJFQ" showIcon="false"/>
2115 </ownedStyle> 2143 </ownedStyle>
2116 <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']"/> 2144 <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']"/>
2117 </ownedDiagramElements> 2145 </ownedDiagramElements>
@@ -2488,12 +2516,12 @@
2488 <ownedDiagramElements xmi:type="diagram:DEdge" uid="_p-1uSmTvEe2qdtyPWAtoxA" sourceNode="_fihqUKA5EeuqkpDnuik1sg" targetNode="_dzVaYGTvEe2qdtyPWAtoxA"> 2516 <ownedDiagramElements xmi:type="diagram:DEdge" uid="_p-1uSmTvEe2qdtyPWAtoxA" sourceNode="_fihqUKA5EeuqkpDnuik1sg" targetNode="_dzVaYGTvEe2qdtyPWAtoxA">
2489 <target xmi:type="ecore:EClass" href="src/main/resources/model/problem.ecore#//PredicateDefinition"/> 2517 <target xmi:type="ecore:EClass" href="src/main/resources/model/problem.ecore#//PredicateDefinition"/>
2490 <semanticElements xmi:type="ecore:EClass" href="src/main/resources/model/problem.ecore#//PredicateDefinition"/> 2518 <semanticElements xmi:type="ecore:EClass" href="src/main/resources/model/problem.ecore#//PredicateDefinition"/>
2491 <ownedStyle xmi:type="diagram:EdgeStyle" uid="_dF7qKDrQEe62Q_vL_UTCsA" targetArrow="InputClosedArrow" routingStyle="tree"> 2519 <ownedStyle xmi:type="diagram:EdgeStyle" uid="_t8yc_jfQEe-Iy-tQWPZJFQ" targetArrow="InputClosedArrow" routingStyle="tree">
2492 <description xmi:type="style:EdgeStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']/@style"/> 2520 <description xmi:type="style:EdgeStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']/@style"/>
2493 <beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_dF7qKTrQEe62Q_vL_UTCsA" showIcon="false"> 2521 <beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_t8yc_zfQEe-Iy-tQWPZJFQ" showIcon="false">
2494 <labelFormat>italic</labelFormat> 2522 <labelFormat>italic</labelFormat>
2495 </beginLabelStyle> 2523 </beginLabelStyle>
2496 <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_dF7qKjrQEe62Q_vL_UTCsA" showIcon="false"/> 2524 <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_t8ydADfQEe-Iy-tQWPZJFQ" showIcon="false"/>
2497 </ownedStyle> 2525 </ownedStyle>
2498 <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']"/> 2526 <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']"/>
2499 </ownedDiagramElements> 2527 </ownedDiagramElements>
@@ -2852,6 +2880,15 @@
2852 <actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EEnum']/@subNodeMappings[name='EC%20EEnumLiteral']"/> 2880 <actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EEnum']/@subNodeMappings[name='EC%20EEnumLiteral']"/>
2853 </ownedElements> 2881 </ownedElements>
2854 </ownedDiagramElements> 2882 </ownedDiagramElements>
2883 <ownedDiagramElements xmi:type="diagram:DEdge" uid="_r1sGLDfTEe-Iy-tQWPZJFQ" name="[0..1] computedValue" sourceNode="_fihqUKA5EeuqkpDnuik1sg" targetNode="_fihqUKA5EeuqkpDnuik1sg">
2884 <target xmi:type="ecore:EReference" href="src/main/resources/model/problem.ecore#//PredicateDefinition/computedValue"/>
2885 <semanticElements xmi:type="ecore:EReference" href="src/main/resources/model/problem.ecore#//PredicateDefinition/computedValue"/>
2886 <ownedStyle xmi:type="diagram:EdgeStyle" uid="_r1stMDfTEe-Iy-tQWPZJFQ" description="_L-JhMKA4EeuqkpDnuik1sg" sourceArrow="FillDiamond" routingStyle="manhattan" strokeColor="0,0,0">
2887 <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_r1stMjfTEe-Iy-tQWPZJFQ" showIcon="false"/>
2888 <endLabelStyle xmi:type="diagram:EndLabelStyle" uid="_r1stMTfTEe-Iy-tQWPZJFQ" labelSize="6" showIcon="false" labelColor="39,76,114"/>
2889 </ownedStyle>
2890 <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC_EReference']"/>
2891 </ownedDiagramElements>
2855 <description xmi:type="description_1:DiagramDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']"/> 2892 <description xmi:type="description_1:DiagramDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']"/>
2856 <filterVariableHistory xmi:type="diagram:FilterVariableHistory" uid="_CsWlsKA4EeuqkpDnuik1sg"/> 2893 <filterVariableHistory xmi:type="diagram:FilterVariableHistory" uid="_CsWlsKA4EeuqkpDnuik1sg"/>
2857 <activatedLayers xmi:type="description_1:Layer" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer"/> 2894 <activatedLayers xmi:type="description_1:Layer" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer"/>
@@ -3167,10 +3204,6 @@
3167 <styles xmi:type="notation:FontStyle" xmi:id="_LC6oWGTvEe2qdtyPWAtoxA" fontName="Noto Sans" fontHeight="8"/> 3204 <styles xmi:type="notation:FontStyle" xmi:id="_LC6oWGTvEe2qdtyPWAtoxA" fontName="Noto Sans" fontHeight="8"/>
3168 <layoutConstraint xmi:type="notation:Location" xmi:id="_LC6oWWTvEe2qdtyPWAtoxA"/> 3205 <layoutConstraint xmi:type="notation:Location" xmi:id="_LC6oWWTvEe2qdtyPWAtoxA"/>
3169 </children> 3206 </children>
3170 <children xmi:type="notation:Node" xmi:id="_NlqKADYOEe-BkNBopcINhQ" type="3010" element="_NkiIoDYOEe-BkNBopcINhQ">
3171 <styles xmi:type="notation:FontStyle" xmi:id="_NlqKATYOEe-BkNBopcINhQ" fontColor="2697711" fontName="Noto Sans" fontHeight="8"/>
3172 <layoutConstraint xmi:type="notation:Location" xmi:id="_NlqKAjYOEe-BkNBopcINhQ"/>
3173 </children>
3174 <styles xmi:type="notation:SortingStyle" xmi:id="_LC6oVWTvEe2qdtyPWAtoxA"/> 3207 <styles xmi:type="notation:SortingStyle" xmi:id="_LC6oVWTvEe2qdtyPWAtoxA"/>
3175 <styles xmi:type="notation:FilteringStyle" xmi:id="_LC6oVmTvEe2qdtyPWAtoxA"/> 3208 <styles xmi:type="notation:FilteringStyle" xmi:id="_LC6oVmTvEe2qdtyPWAtoxA"/>
3176 </children> 3209 </children>
@@ -4771,14 +4804,6 @@
4771 </ownedStyle> 4804 </ownedStyle>
4772 <actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']"/> 4805 <actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']"/>
4773 </ownedElements> 4806 </ownedElements>
4774 <ownedElements xmi:type="diagram:DNodeListElement" uid="_NkiIoDYOEe-BkNBopcINhQ" name="computed : EBoolean = false" tooltipText="">
4775 <target xmi:type="ecore:EAttribute" href="src/main/resources/model/problem.ecore#//Atom/computed"/>
4776 <semanticElements xmi:type="ecore:EAttribute" href="src/main/resources/model/problem.ecore#//Atom/computed"/>
4777 <ownedStyle xmi:type="diagram:BundledImage" uid="_ORZ1sTYOEe-BkNBopcINhQ" labelAlignment="LEFT">
4778 <description xmi:type="style:BundledImageDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']/@style"/>
4779 </ownedStyle>
4780 <actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']"/>
4781 </ownedElements>
4782 </ownedDiagramElements> 4807 </ownedDiagramElements>
4783 <ownedDiagramElements xmi:type="diagram:DEdge" uid="_LC4MOmTvEe2qdtyPWAtoxA" name="[0..*] arguments" sourceNode="_LCzTkGTvEe2qdtyPWAtoxA" targetNode="_3wvNYF3lEe2LuOZzJ_LhLg"> 4808 <ownedDiagramElements xmi:type="diagram:DEdge" uid="_LC4MOmTvEe2qdtyPWAtoxA" name="[0..*] arguments" sourceNode="_LCzTkGTvEe2qdtyPWAtoxA" targetNode="_3wvNYF3lEe2LuOZzJ_LhLg">
4784 <target xmi:type="ecore:EReference" href="src/main/resources/model/problem.ecore#//Atom/arguments"/> 4809 <target xmi:type="ecore:EReference" href="src/main/resources/model/problem.ecore#//Atom/arguments"/>
@@ -6010,8 +6035,6 @@
6010 <actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']"/> 6035 <actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']"/>
6011 </ownedElements> 6036 </ownedElements>
6012 <ownedElements xmi:type="diagram:DNodeListElement" uid="_NkzOZDYOEe-BkNBopcINhQ" name="computed : EBoolean = false" visible="false" tooltipText=""> 6037 <ownedElements xmi:type="diagram:DNodeListElement" uid="_NkzOZDYOEe-BkNBopcINhQ" name="computed : EBoolean = false" visible="false" tooltipText="">
6013 <target xmi:type="ecore:EAttribute" href="src/main/resources/model/problem.ecore#//Atom/computed"/>
6014 <semanticElements xmi:type="ecore:EAttribute" href="src/main/resources/model/problem.ecore#//Atom/computed"/>
6015 <ownedStyle xmi:type="diagram:BundledImage" uid="_OQxjmDYOEe-BkNBopcINhQ" labelAlignment="LEFT"> 6038 <ownedStyle xmi:type="diagram:BundledImage" uid="_OQxjmDYOEe-BkNBopcINhQ" labelAlignment="LEFT">
6016 <description xmi:type="style:BundledImageDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']/@style"/> 6039 <description xmi:type="style:BundledImageDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']/@style"/>
6017 </ownedStyle> 6040 </ownedStyle>
diff --git a/subprojects/language-model/src/main/resources/model/problem.ecore b/subprojects/language-model/src/main/resources/model/problem.ecore
index e42bf2df..291ee5d9 100644
--- a/subprojects/language-model/src/main/resources/model/problem.ecore
+++ b/subprojects/language-model/src/main/resources/model/problem.ecore
@@ -35,6 +35,9 @@
35 <eStructuralFeatures xsi:type="ecore:EReference" name="bodies" upperBound="-1" 35 <eStructuralFeatures xsi:type="ecore:EReference" name="bodies" upperBound="-1"
36 eType="#//Conjunction" containment="true"/> 36 eType="#//Conjunction" containment="true"/>
37 <eStructuralFeatures xsi:type="ecore:EAttribute" name="error" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> 37 <eStructuralFeatures xsi:type="ecore:EAttribute" name="error" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
38 <eStructuralFeatures xsi:type="ecore:EAttribute" name="shadow" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
39 <eStructuralFeatures xsi:type="ecore:EReference" name="computedValue" eType="#//PredicateDefinition"
40 transient="true" containment="true"/>
38 </eClassifiers> 41 </eClassifiers>
39 <eClassifiers xsi:type="ecore:EClass" name="Parameter" eSuperTypes="#//Variable"> 42 <eClassifiers xsi:type="ecore:EClass" name="Parameter" eSuperTypes="#//Variable">
40 <eStructuralFeatures xsi:type="ecore:EReference" name="parameterType" eType="#//Relation"/> 43 <eStructuralFeatures xsi:type="ecore:EReference" name="parameterType" eType="#//Relation"/>
@@ -48,7 +51,6 @@
48 <eStructuralFeatures xsi:type="ecore:EReference" name="arguments" upperBound="-1" 51 <eStructuralFeatures xsi:type="ecore:EReference" name="arguments" upperBound="-1"
49 eType="#//Expr" containment="true"/> 52 eType="#//Expr" containment="true"/>
50 <eStructuralFeatures xsi:type="ecore:EReference" name="relation" eType="#//Relation"/> 53 <eStructuralFeatures xsi:type="ecore:EReference" name="relation" eType="#//Relation"/>
51 <eStructuralFeatures xsi:type="ecore:EAttribute" name="computed" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
52 </eClassifiers> 54 </eClassifiers>
53 <eClassifiers xsi:type="ecore:EClass" name="ImplicitVariable" eSuperTypes="#//Variable"/> 55 <eClassifiers xsi:type="ecore:EClass" name="ImplicitVariable" eSuperTypes="#//Variable"/>
54 <eClassifiers xsi:type="ecore:EClass" name="ExistentialQuantifier" abstract="true" 56 <eClassifiers xsi:type="ecore:EClass" name="ExistentialQuantifier" abstract="true"
diff --git a/subprojects/language-model/src/main/resources/model/problem.genmodel b/subprojects/language-model/src/main/resources/model/problem.genmodel
index 8bc95a9f..adf17279 100644
--- a/subprojects/language-model/src/main/resources/model/problem.genmodel
+++ b/subprojects/language-model/src/main/resources/model/problem.genmodel
@@ -105,6 +105,8 @@
105 <genClasses ecoreClass="problem.ecore#//PredicateDefinition"> 105 <genClasses ecoreClass="problem.ecore#//PredicateDefinition">
106 <genFeatures children="true" createChild="true" propertySortChoices="true" ecoreFeature="ecore:EReference problem.ecore#//PredicateDefinition/bodies"/> 106 <genFeatures children="true" createChild="true" propertySortChoices="true" ecoreFeature="ecore:EReference problem.ecore#//PredicateDefinition/bodies"/>
107 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute problem.ecore#//PredicateDefinition/error"/> 107 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute problem.ecore#//PredicateDefinition/error"/>
108 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute problem.ecore#//PredicateDefinition/shadow"/>
109 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference problem.ecore#//PredicateDefinition/computedValue"/>
108 </genClasses> 110 </genClasses>
109 <genClasses ecoreClass="problem.ecore#//Parameter"> 111 <genClasses ecoreClass="problem.ecore#//Parameter">
110 <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference problem.ecore#//Parameter/parameterType"/> 112 <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference problem.ecore#//Parameter/parameterType"/>
@@ -117,7 +119,6 @@
117 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute problem.ecore#//Atom/transitiveClosure"/> 119 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute problem.ecore#//Atom/transitiveClosure"/>
118 <genFeatures children="true" createChild="true" propertySortChoices="true" ecoreFeature="ecore:EReference problem.ecore#//Atom/arguments"/> 120 <genFeatures children="true" createChild="true" propertySortChoices="true" ecoreFeature="ecore:EReference problem.ecore#//Atom/arguments"/>
119 <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference problem.ecore#//Atom/relation"/> 121 <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference problem.ecore#//Atom/relation"/>
120 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute problem.ecore#//Atom/computed"/>
121 </genClasses> 122 </genClasses>
122 <genClasses ecoreClass="problem.ecore#//ImplicitVariable"/> 123 <genClasses ecoreClass="problem.ecore#//ImplicitVariable"/>
123 <genClasses ecoreClass="problem.ecore#//ExistentialQuantifier"> 124 <genClasses ecoreClass="problem.ecore#//ExistentialQuantifier">
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 3400d9f4..fcae7890 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
@@ -607,16 +607,22 @@ public class ModelInitializer {
607 private void collectPredicateDefinition(PredicateDefinition predicateDefinition, ModelStoreBuilder storeBuilder) { 607 private void collectPredicateDefinition(PredicateDefinition predicateDefinition, ModelStoreBuilder storeBuilder) {
608 var partialRelation = getPartialRelation(predicateDefinition); 608 var partialRelation = getPartialRelation(predicateDefinition);
609 var query = toQuery(partialRelation.name(), predicateDefinition); 609 var query = toQuery(partialRelation.name(), predicateDefinition);
610 boolean mutable = targetTypes.contains(partialRelation) || isActionTarget(predicateDefinition); 610 boolean mutable;
611 TruthValue defaultValue; 611 TruthValue defaultValue;
612 if (predicateDefinition.isError()) { 612 if (predicateDefinition.isShadow()) {
613 defaultValue = TruthValue.FALSE; 613 mutable = false;
614 defaultValue = TruthValue.UNKNOWN;
614 } else { 615 } else {
615 var seed = modelSeed.getSeed(partialRelation); 616 mutable = targetTypes.contains(partialRelation) || isActionTarget(predicateDefinition);
616 defaultValue = seed.majorityValue() == TruthValue.FALSE ? TruthValue.FALSE : TruthValue.UNKNOWN; 617 if (predicateDefinition.isError()) {
617 var cursor = seed.getCursor(defaultValue, problemTrace.getNodeTrace().size()); 618 defaultValue = TruthValue.FALSE;
618 // The symbol should be mutable if there is at least one non-default entry in the seed. 619 } else {
619 mutable = mutable || cursor.move(); 620 var seed = modelSeed.getSeed(partialRelation);
621 defaultValue = seed.majorityValue() == TruthValue.FALSE ? TruthValue.FALSE : TruthValue.UNKNOWN;
622 var cursor = seed.getCursor(defaultValue, problemTrace.getNodeTrace().size());
623 // The symbol should be mutable if there is at least one non-default entry in the seed.
624 mutable = mutable || cursor.move();
625 }
620 } 626 }
621 var translator = new PredicateTranslator(partialRelation, query, mutable, defaultValue); 627 var translator = new PredicateTranslator(partialRelation, query, mutable, defaultValue);
622 storeBuilder.with(translator); 628 storeBuilder.with(translator);
@@ -743,9 +749,15 @@ public class ModelInitializer {
743 } 749 }
744 750
745 private Constraint getConstraint(Atom atom) { 751 private Constraint getConstraint(Atom atom) {
746 var target = getPartialRelation(atom.getRelation()); 752 var relation = atom.getRelation();
747 var computedTarget = atom.isComputed() ? new ComputedConstraint(target) : target; 753 Constraint target;
748 return atom.isTransitiveClosure() ? getTransitiveWrapper(computedTarget) : computedTarget; 754 if (ProblemUtil.isComputedValuePredicate(relation)) {
755 var originalTarget = getPartialRelation((PredicateDefinition) relation.eContainer());
756 target = new ComputedConstraint(originalTarget);
757 } else {
758 target = getPartialRelation(relation);
759 }
760 return atom.isTransitiveClosure() ? getTransitiveWrapper(target) : target;
749 } 761 }
750 762
751 private Constraint getTransitiveWrapper(Constraint target) { 763 private Constraint getTransitiveWrapper(Constraint target) {
diff --git a/subprojects/language/src/main/java/tools/refinery/language/Problem.xtext b/subprojects/language/src/main/java/tools/refinery/language/Problem.xtext
index 8d7d485b..cca94e66 100644
--- a/subprojects/language/src/main/java/tools/refinery/language/Problem.xtext
+++ b/subprojects/language/src/main/java/tools/refinery/language/Problem.xtext
@@ -58,6 +58,7 @@ ReferenceMultiplicity returns Multiplicity:
58 "[" Multiplicity "]"; 58 "[" Multiplicity "]";
59 59
60PredicateDefinition: 60PredicateDefinition:
61 shadow?="shadow"?
61 ("pred" | error?="error" "pred"?) 62 ("pred" | error?="error" "pred"?)
62 name=Identifier 63 name=Identifier
63 "(" (parameters+=Parameter ("," parameters+=Parameter)*)? ")" 64 "(" (parameters+=Parameter ("," parameters+=Parameter)*)? ")"
@@ -200,7 +201,6 @@ CastExprBody returns Expr:
200 201
201Atom: 202Atom:
202 relation=[Relation|QualifiedName] 203 relation=[Relation|QualifiedName]
203 computed?="$"?
204 transitiveClosure?=TRANSITIVE_CLOSURE? 204 transitiveClosure?=TRANSITIVE_CLOSURE?
205 "(" (arguments+=Expr ("," arguments+=Expr)*)? ")"; 205 "(" (arguments+=Expr ("," arguments+=Expr)*)? ")";
206 206
@@ -297,7 +297,7 @@ Identifier:
297 297
298NonContainmentIdentifier: 298NonContainmentIdentifier:
299 ID | "atom" | "multi" | "contained" | "problem" | "module" | 299 ID | "atom" | "multi" | "contained" | "problem" | "module" |
300 "datatype" | "aggregator" | "decision" | "propagation"; 300 "datatype" | "aggregator" | "decision" | "propagation" | "computed";
301 301
302Real returns ecore::EDouble: 302Real returns ecore::EDouble:
303 EXPONENTIAL | INT "." (INT | EXPONENTIAL); 303 EXPONENTIAL | INT "." (INT | EXPONENTIAL);
diff --git a/subprojects/language/src/main/java/tools/refinery/language/parser/antlr/ProblemTokenSource.java b/subprojects/language/src/main/java/tools/refinery/language/parser/antlr/ProblemTokenSource.java
index d47863da..487e4ceb 100644
--- a/subprojects/language/src/main/java/tools/refinery/language/parser/antlr/ProblemTokenSource.java
+++ b/subprojects/language/src/main/java/tools/refinery/language/parser/antlr/ProblemTokenSource.java
@@ -28,8 +28,6 @@ public class ProblemTokenSource implements TokenSource {
28 28
29 private boolean seenId; 29 private boolean seenId;
30 30
31 private boolean seenComputed;
32
33 private boolean lastVisible; 31 private boolean lastVisible;
34 32
35 public ProblemTokenSource(TokenSource delegate) { 33 public ProblemTokenSource(TokenSource delegate) {
@@ -59,13 +57,10 @@ public class ProblemTokenSource implements TokenSource {
59 } else if (lastVisible && isQualifiedNameSeparator(token)) { 57 } else if (lastVisible && isQualifiedNameSeparator(token)) {
60 token.setType(InternalProblemParser.RULE_QUALIFIED_NAME_SEPARATOR); 58 token.setType(InternalProblemParser.RULE_QUALIFIED_NAME_SEPARATOR);
61 } 59 }
62 } else if (seenComputed && isPlusOrTransitiveClosure(token) && peekForTransitiveClosure()) {
63 token.setType(InternalProblemParser.RULE_TRANSITIVE_CLOSURE);
64 } 60 }
65 lastVisible = isVisibleToken(token); 61 lastVisible = isVisibleToken(token);
66 if (lastVisible) { 62 if (lastVisible) {
67 seenId = isIdentifier(token); 63 seenId = isIdentifier(token);
68 seenComputed = isComputed(token);
69 } 64 }
70 return token; 65 return token;
71 } 66 }
@@ -87,10 +82,6 @@ public class ProblemTokenSource implements TokenSource {
87 return token.getType() == InternalProblemParser.ColonColon; 82 return token.getType() == InternalProblemParser.ColonColon;
88 } 83 }
89 84
90 protected boolean isComputed(Token token) {
91 return token.getType() == InternalProblemParser.DollarSign;
92 }
93
94 protected boolean isVisibleToken(Token token) { 85 protected boolean isVisibleToken(Token token) {
95 int tokenId = token.getType(); 86 int tokenId = token.getType();
96 return tokenId != InternalProblemParser.RULE_WS && tokenId != InternalProblemParser.RULE_SL_COMMENT && 87 return tokenId != InternalProblemParser.RULE_WS && tokenId != InternalProblemParser.RULE_SL_COMMENT &&
diff --git a/subprojects/language/src/main/java/tools/refinery/language/resource/ProblemResourceDescriptionStrategy.java b/subprojects/language/src/main/java/tools/refinery/language/resource/ProblemResourceDescriptionStrategy.java
index cad98d50..8ebd34a5 100644
--- a/subprojects/language/src/main/java/tools/refinery/language/resource/ProblemResourceDescriptionStrategy.java
+++ b/subprojects/language/src/main/java/tools/refinery/language/resource/ProblemResourceDescriptionStrategy.java
@@ -46,8 +46,8 @@ public class ProblemResourceDescriptionStrategy extends DefaultResourceDescripti
46 public static final String MODULE_KIND = DATA_PREFIX + "MODULE_KIND"; 46 public static final String MODULE_KIND = DATA_PREFIX + "MODULE_KIND";
47 public static final String COLOR_RELATION = DATA_PREFIX + "COLOR_RELATION"; 47 public static final String COLOR_RELATION = DATA_PREFIX + "COLOR_RELATION";
48 public static final String COLOR_RELATION_TRUE = "true"; 48 public static final String COLOR_RELATION_TRUE = "true";
49 public static final String COMPUTED_VALUE = DATA_PREFIX + "COMPUTED_VALUE"; 49 public static final String SHADOW_PREDICATE = DATA_PREFIX + "COMPUTED_VALUE";
50 public static final String COMPUTED_VALUE_TRUE = "true"; 50 public static final String SHADOW_PREDICATE_TRUE = "true";
51 51
52 @Inject 52 @Inject
53 private IQualifiedNameConverter qualifiedNameConverter; 53 private IQualifiedNameConverter qualifiedNameConverter;
@@ -165,8 +165,8 @@ public class ProblemResourceDescriptionStrategy extends DefaultResourceDescripti
165 if (ProblemUtil.isError(eObject)) { 165 if (ProblemUtil.isError(eObject)) {
166 builder.put(ERROR_PREDICATE, ERROR_PREDICATE_TRUE); 166 builder.put(ERROR_PREDICATE, ERROR_PREDICATE_TRUE);
167 } 167 }
168 if (ProblemUtil.isComputedValue(eObject)) { 168 if (ProblemUtil.isShadow(eObject)) {
169 builder.put(COMPUTED_VALUE, COMPUTED_VALUE_TRUE); 169 builder.put(SHADOW_PREDICATE, SHADOW_PREDICATE_TRUE);
170 } 170 }
171 var documentationMap = documentationCommentParser.parseDocumentation(eObject); 171 var documentationMap = documentationCommentParser.parseDocumentation(eObject);
172 builder.putAll(documentationMap); 172 builder.putAll(documentationMap);
@@ -178,7 +178,8 @@ public class ProblemResourceDescriptionStrategy extends DefaultResourceDescripti
178 return !ProblemUtil.isMultiNode(node); 178 return !ProblemUtil.isMultiNode(node);
179 } 179 }
180 if (eObject instanceof PredicateDefinition predicateDefinition) { 180 if (eObject instanceof PredicateDefinition predicateDefinition) {
181 return !ProblemUtil.isInvalidMultiplicityConstraint(predicateDefinition); 181 return !ProblemUtil.isInvalidMultiplicityConstraint(predicateDefinition) &&
182 !ProblemUtil.isComputedValuePredicate(predicateDefinition);
182 } 183 }
183 return true; 184 return true;
184 } 185 }
diff --git a/subprojects/language/src/main/java/tools/refinery/language/resource/state/ProblemDerivedStateComputer.java b/subprojects/language/src/main/java/tools/refinery/language/resource/state/ProblemDerivedStateComputer.java
index efa77c50..6b9b76d1 100644
--- a/subprojects/language/src/main/java/tools/refinery/language/resource/state/ProblemDerivedStateComputer.java
+++ b/subprojects/language/src/main/java/tools/refinery/language/resource/state/ProblemDerivedStateComputer.java
@@ -22,6 +22,7 @@ import tools.refinery.language.utils.ProblemUtil;
22 22
23import java.util.*; 23import java.util.*;
24import java.util.function.Function; 24import java.util.function.Function;
25import java.util.function.UnaryOperator;
25 26
26@Singleton 27@Singleton
27public class ProblemDerivedStateComputer implements IDerivedStateComputer { 28public class ProblemDerivedStateComputer implements IDerivedStateComputer {
@@ -59,7 +60,7 @@ public class ProblemDerivedStateComputer implements IDerivedStateComputer {
59 } 60 }
60 61
61 protected void installDerivedProblemState(Problem problem, Adapter adapter, boolean preLinkingPhase) { 62 protected void installDerivedProblemState(Problem problem, Adapter adapter, boolean preLinkingPhase) {
62 installDerivedClassDeclarationState(problem, adapter); 63 installDerivedDeclarationState(problem, adapter);
63 if (preLinkingPhase) { 64 if (preLinkingPhase) {
64 return; 65 return;
65 } 66 }
@@ -67,13 +68,15 @@ public class ProblemDerivedStateComputer implements IDerivedStateComputer {
67 derivedVariableComputer.installDerivedVariables(problem, nodeNames); 68 derivedVariableComputer.installDerivedVariables(problem, nodeNames);
68 } 69 }
69 70
70 protected void installDerivedClassDeclarationState(Problem problem, Adapter adapter) { 71 protected void installDerivedDeclarationState(Problem problem, Adapter adapter) {
71 for (var statement : problem.getStatements()) { 72 for (var statement : problem.getStatements()) {
72 if (statement instanceof ClassDeclaration classDeclaration) { 73 if (statement instanceof ClassDeclaration classDeclaration) {
73 installOrRemoveNewNode(adapter, classDeclaration); 74 installOrRemoveNewNode(adapter, classDeclaration);
74 for (var referenceDeclaration : classDeclaration.getFeatureDeclarations()) { 75 for (var referenceDeclaration : classDeclaration.getFeatureDeclarations()) {
75 installOrRemoveInvalidMultiplicityPredicate(adapter, classDeclaration, referenceDeclaration); 76 installOrRemoveInvalidMultiplicityPredicate(adapter, classDeclaration, referenceDeclaration);
76 } 77 }
78 } else if (statement instanceof PredicateDefinition predicateDefinition) {
79 installOrRemoveComputedValuePredicate(adapter, predicateDefinition);
77 } 80 }
78 } 81 }
79 } 82 }
@@ -118,6 +121,27 @@ public class ProblemDerivedStateComputer implements IDerivedStateComputer {
118 } 121 }
119 } 122 }
120 123
124 protected void installOrRemoveComputedValuePredicate(Adapter adapter, PredicateDefinition predicateDefinition) {
125 if (ProblemUtil.hasComputedValue(predicateDefinition)) {
126 var computedValue = adapter.createComputedValuePredicateIfAbsent(predicateDefinition, key -> {
127 var predicate = ProblemFactory.eINSTANCE.createPredicateDefinition();
128 predicate.setShadow(true);
129 predicate.setName("definition");
130 return predicate;
131 });
132 var parameters = computedValue.getParameters();
133 parameters.clear();
134 parameters.addAll(EcoreUtil.copyAll(predicateDefinition.getParameters()));
135 predicateDefinition.setComputedValue(computedValue);
136 } else {
137 var computedValue = predicateDefinition.getComputedValue();
138 if (computedValue != null) {
139 predicateDefinition.setComputedValue(null);
140 adapter.removeComputedValuePredicate(computedValue);
141 }
142 }
143 }
144
121 protected Set<String> installDerivedNodes(Problem problem) { 145 protected Set<String> installDerivedNodes(Problem problem) {
122 var collector = nodeNameCollectorProvider.get(); 146 var collector = nodeNameCollectorProvider.get();
123 collector.collectNodeNames(problem); 147 collector.collectNodeNames(problem);
@@ -148,6 +172,7 @@ public class ProblemDerivedStateComputer implements IDerivedStateComputer {
148 protected void discardDerivedProblemState(Problem problem, Adapter adapter) { 172 protected void discardDerivedProblemState(Problem problem, Adapter adapter) {
149 var abstractClassDeclarations = new HashSet<ClassDeclaration>(); 173 var abstractClassDeclarations = new HashSet<ClassDeclaration>();
150 var referenceDeclarationsWithMultiplicity = new HashSet<ReferenceDeclaration>(); 174 var referenceDeclarationsWithMultiplicity = new HashSet<ReferenceDeclaration>();
175 var predicateDefinitionsWithComputedValue = new HashSet<PredicateDefinition>();
151 problem.getNodes().clear(); 176 problem.getNodes().clear();
152 for (var statement : problem.getStatements()) { 177 for (var statement : problem.getStatements()) {
153 if (statement instanceof ClassDeclaration classDeclaration) { 178 if (statement instanceof ClassDeclaration classDeclaration) {
@@ -160,9 +185,13 @@ public class ProblemDerivedStateComputer implements IDerivedStateComputer {
160 referenceDeclarationsWithMultiplicity.add(referenceDeclaration); 185 referenceDeclarationsWithMultiplicity.add(referenceDeclaration);
161 } 186 }
162 } 187 }
188 } else if (statement instanceof PredicateDefinition predicateDefinition &&
189 ProblemUtil.hasComputedValue(predicateDefinition)) {
190 predicateDefinitionsWithComputedValue.add(predicateDefinition);
163 } 191 }
164 } 192 }
165 adapter.retainAll(abstractClassDeclarations, referenceDeclarationsWithMultiplicity); 193 adapter.retainAll(abstractClassDeclarations, referenceDeclarationsWithMultiplicity,
194 predicateDefinitionsWithComputedValue);
166 derivedVariableComputer.discardDerivedVariables(problem); 195 derivedVariableComputer.discardDerivedVariables(problem);
167 } 196 }
168 197
@@ -185,6 +214,7 @@ public class ProblemDerivedStateComputer implements IDerivedStateComputer {
185 protected static class Adapter extends AdapterImpl { 214 protected static class Adapter extends AdapterImpl {
186 private final Map<ClassDeclaration, Node> newNodes = new HashMap<>(); 215 private final Map<ClassDeclaration, Node> newNodes = new HashMap<>();
187 private final Map<ReferenceDeclaration, PredicateDefinition> invalidMultiplicityPredicates = new HashMap<>(); 216 private final Map<ReferenceDeclaration, PredicateDefinition> invalidMultiplicityPredicates = new HashMap<>();
217 private final Map<PredicateDefinition, PredicateDefinition> computedValuePredicates = new HashMap<>();
188 218
189 public Node createNewNodeIfAbsent(ClassDeclaration classDeclaration, 219 public Node createNewNodeIfAbsent(ClassDeclaration classDeclaration,
190 Function<ClassDeclaration, Node> createNode) { 220 Function<ClassDeclaration, Node> createNode) {
@@ -205,10 +235,21 @@ public class ProblemDerivedStateComputer implements IDerivedStateComputer {
205 invalidMultiplicityPredicates.remove(referenceDeclaration); 235 invalidMultiplicityPredicates.remove(referenceDeclaration);
206 } 236 }
207 237
238 public PredicateDefinition createComputedValuePredicateIfAbsent(
239 PredicateDefinition predicateDefinition, UnaryOperator<PredicateDefinition> createPredicate) {
240 return computedValuePredicates.computeIfAbsent(predicateDefinition, createPredicate);
241 }
242
243 public void removeComputedValuePredicate(PredicateDefinition predicateDefinition) {
244 computedValuePredicates.remove(predicateDefinition);
245 }
246
208 public void retainAll(Collection<ClassDeclaration> abstractClassDeclarations, 247 public void retainAll(Collection<ClassDeclaration> abstractClassDeclarations,
209 Collection<ReferenceDeclaration> referenceDeclarationsWithMultiplicity) { 248 Collection<ReferenceDeclaration> referenceDeclarationsWithMultiplicity,
249 Collection<PredicateDefinition> predicateDefinitionsWithComputedValue) {
210 newNodes.keySet().retainAll(abstractClassDeclarations); 250 newNodes.keySet().retainAll(abstractClassDeclarations);
211 invalidMultiplicityPredicates.keySet().retainAll(referenceDeclarationsWithMultiplicity); 251 invalidMultiplicityPredicates.keySet().retainAll(referenceDeclarationsWithMultiplicity);
252 computedValuePredicates.keySet().retainAll(predicateDefinitionsWithComputedValue);
212 } 253 }
213 254
214 @Override 255 @Override
diff --git a/subprojects/language/src/main/java/tools/refinery/language/utils/ProblemUtil.java b/subprojects/language/src/main/java/tools/refinery/language/utils/ProblemUtil.java
index 7e7de681..c2c19d74 100644
--- a/subprojects/language/src/main/java/tools/refinery/language/utils/ProblemUtil.java
+++ b/subprojects/language/src/main/java/tools/refinery/language/utils/ProblemUtil.java
@@ -53,8 +53,8 @@ public final class ProblemUtil {
53 return eObject instanceof PredicateDefinition predicateDefinition && predicateDefinition.isError(); 53 return eObject instanceof PredicateDefinition predicateDefinition && predicateDefinition.isError();
54 } 54 }
55 55
56 public static boolean isComputedValue(EObject eObject) { 56 public static boolean isShadow(EObject eObject) {
57 return eObject instanceof PredicateDefinition predicateDefinition && !predicateDefinition.getBodies().isEmpty(); 57 return eObject instanceof PredicateDefinition predicateDefinition && predicateDefinition.isShadow();
58 } 58 }
59 59
60 public static boolean isAtomNode(Node node) { 60 public static boolean isAtomNode(Node node) {
@@ -77,9 +77,12 @@ public final class ProblemUtil {
77 return node.eContainingFeature() == ProblemPackage.Literals.NODE_DECLARATION__NODES; 77 return node.eContainingFeature() == ProblemPackage.Literals.NODE_DECLARATION__NODES;
78 } 78 }
79 79
80 public static boolean isInvalidMultiplicityConstraint(PredicateDefinition predicateDefinition) { 80 public static boolean isInvalidMultiplicityConstraint(Relation relation) {
81 return predicateDefinition.eContainingFeature() == 81 return relation.eContainingFeature() == ProblemPackage.Literals.REFERENCE_DECLARATION__INVALID_MULTIPLICITY;
82 ProblemPackage.Literals.REFERENCE_DECLARATION__INVALID_MULTIPLICITY; 82 }
83
84 public static boolean isComputedValuePredicate(Relation relation) {
85 return relation.eContainingFeature() == ProblemPackage.Literals.PREDICATE_DEFINITION__COMPUTED_VALUE;
83 } 86 }
84 87
85 public static boolean hasMultiplicityConstraint(ReferenceDeclaration referenceDeclaration) { 88 public static boolean hasMultiplicityConstraint(ReferenceDeclaration referenceDeclaration) {
@@ -100,6 +103,10 @@ public final class ProblemUtil {
100 return true; 103 return true;
101 } 104 }
102 105
106 public static boolean hasComputedValue(PredicateDefinition predicateDefinition) {
107 return !predicateDefinition.isShadow() && !predicateDefinition.getBodies().isEmpty();
108 }
109
103 public static boolean isTypeLike(Relation relation) { 110 public static boolean isTypeLike(Relation relation) {
104 if (relation instanceof ClassDeclaration || relation instanceof EnumDeclaration || 111 if (relation instanceof ClassDeclaration || relation instanceof EnumDeclaration ||
105 relation instanceof DatatypeDeclaration) { 112 relation instanceof DatatypeDeclaration) {
diff --git a/subprojects/language/src/main/java/tools/refinery/language/validation/ProblemValidator.java b/subprojects/language/src/main/java/tools/refinery/language/validation/ProblemValidator.java
index 7114b693..58d86fa0 100644
--- a/subprojects/language/src/main/java/tools/refinery/language/validation/ProblemValidator.java
+++ b/subprojects/language/src/main/java/tools/refinery/language/validation/ProblemValidator.java
@@ -49,7 +49,7 @@ public class ProblemValidator extends AbstractProblemValidator {
49 public static final String INVALID_MODALITY_ISSUE = ISSUE_PREFIX + "INVALID_MODALITY"; 49 public static final String INVALID_MODALITY_ISSUE = ISSUE_PREFIX + "INVALID_MODALITY";
50 public static final String INVALID_RULE_ISSUE = ISSUE_PREFIX + "INVALID_RULE"; 50 public static final String INVALID_RULE_ISSUE = ISSUE_PREFIX + "INVALID_RULE";
51 public static final String INVALID_TRANSITIVE_CLOSURE_ISSUE = ISSUE_PREFIX + "INVALID_TRANSITIVE_CLOSURE"; 51 public static final String INVALID_TRANSITIVE_CLOSURE_ISSUE = ISSUE_PREFIX + "INVALID_TRANSITIVE_CLOSURE";
52 public static final String INVALID_COMPUTED_VALUE_ISSUE = ISSUE_PREFIX + "INVALID_COMPUTED_VALUE"; 52 public static final String SHADOW_RELATION_ISSUE = ISSUE_PREFIX + "SHADOW_RELATION";
53 public static final String UNSUPPORTED_ASSERTION_ISSUE = ISSUE_PREFIX + "UNSUPPORTED_ASSERTION"; 53 public static final String UNSUPPORTED_ASSERTION_ISSUE = ISSUE_PREFIX + "UNSUPPORTED_ASSERTION";
54 public static final String UNKNOWN_EXPRESSION_ISSUE = ISSUE_PREFIX + "UNKNOWN_EXPRESSION"; 54 public static final String UNKNOWN_EXPRESSION_ISSUE = ISSUE_PREFIX + "UNKNOWN_EXPRESSION";
55 public static final String INVALID_ASSIGNMENT_ISSUE = ISSUE_PREFIX + "INVALID_ASSIGNMENT"; 55 public static final String INVALID_ASSIGNMENT_ISSUE = ISSUE_PREFIX + "INVALID_ASSIGNMENT";
@@ -426,16 +426,12 @@ public class ProblemValidator extends AbstractProblemValidator {
426 acceptError(message, atom, ProblemPackage.Literals.ATOM__TRANSITIVE_CLOSURE, 0, 426 acceptError(message, atom, ProblemPackage.Literals.ATOM__TRANSITIVE_CLOSURE, 0,
427 INVALID_TRANSITIVE_CLOSURE_ISSUE); 427 INVALID_TRANSITIVE_CLOSURE_ISSUE);
428 } 428 }
429 if (atom.isComputed()) { 429 var target = atom.getRelation();
430 var target = atom.getRelation(); 430 if (target != null && !target.eIsProxy() && ProblemUtil.isShadow(target)) {
431 if (target != null && !target.eIsProxy() && !ProblemUtil.isComputedValue(target)) {
432 var message = "Relation '%s' has no computed value.".formatted(target.getName());
433 acceptError(message, atom, ProblemPackage.Literals.ATOM__COMPUTED, 0, INVALID_COMPUTED_VALUE_ISSUE);
434 }
435 var definitionContext = EcoreUtil2.getContainerOfType(atom, ParametricDefinition.class); 431 var definitionContext = EcoreUtil2.getContainerOfType(atom, ParametricDefinition.class);
436 if (!(definitionContext instanceof RuleDefinition)) { 432 if (!(definitionContext instanceof RuleDefinition)){
437 var message = "Computed value references may only appear in rule definitions."; 433 var message = "Shadow relation '%s' may only appear in rule definitions.".formatted(target.getName());
438 acceptError(message, atom, ProblemPackage.Literals.ATOM__COMPUTED, 0, INVALID_COMPUTED_VALUE_ISSUE); 434 acceptError(message, atom, ProblemPackage.Literals.ATOM__RELATION, 0, SHADOW_RELATION_ISSUE);
439 } 435 }
440 } 436 }
441 } 437 }
diff --git a/subprojects/language/src/test/java/tools/refinery/language/tests/parser/antlr/ProblemTokenSourceTest.java b/subprojects/language/src/test/java/tools/refinery/language/tests/parser/antlr/ProblemTokenSourceTest.java
index 02a31534..644744a0 100644
--- a/subprojects/language/src/test/java/tools/refinery/language/tests/parser/antlr/ProblemTokenSourceTest.java
+++ b/subprojects/language/src/test/java/tools/refinery/language/tests/parser/antlr/ProblemTokenSourceTest.java
@@ -66,9 +66,7 @@ class ProblemTokenSourceTest {
66 @ValueSource(strings = { 66 @ValueSource(strings = {
67 "equals+(a, b)", 67 "equals+(a, b)",
68 "equals + (a, b)", 68 "equals + (a, b)",
69 "equals+(a::x, b)", 69 "equals+(a::x, b)"
70 "equals$+(a, b)",
71 "equals$ + (a, b)"
72 }) 70 })
73 void transitiveClosureInTokenStreamTest(String text) { 71 void transitiveClosureInTokenStreamTest(String text) {
74 var tokenList = createTokenList(text); 72 var tokenList = createTokenList(text);
diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/literal/ComputedConstraint.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/literal/ComputedConstraint.java
index 7aaa6da7..d570211c 100644
--- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/literal/ComputedConstraint.java
+++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/literal/ComputedConstraint.java
@@ -51,6 +51,6 @@ public record ComputedConstraint(PartialRelation partialRelation) implements Con
51 } 51 }
52 52
53 private String formatName(String constraintName) { 53 private String formatName(String constraintName) {
54 return constraintName + "$"; 54 return "@Computed " + constraintName;
55 } 55 }
56} 56}