aboutsummaryrefslogtreecommitdiffstats
path: root/language-model
diff options
context:
space:
mode:
authorLibravatar Garami Bence <85867500+garamibence@users.noreply.github.com>2021-10-13 20:59:35 +0200
committerLibravatar Garami Bence <85867500+garamibence@users.noreply.github.com>2021-10-20 21:12:33 +0200
commitb98bb0df11fb8bc9748247da004321ab94e954c5 (patch)
treeff128c03cfa0a1459de4e928f78f150484fdd269 /language-model
parentAdd syntax for direct rules and direct predicates (diff)
downloadrefinery-b98bb0df11fb8bc9748247da004321ab94e954c5.tar.gz
refinery-b98bb0df11fb8bc9748247da004321ab94e954c5.tar.zst
refinery-b98bb0df11fb8bc9748247da004321ab94e954c5.zip
Add scope for new and delete with tests
Diffstat (limited to 'language-model')
-rw-r--r--language-model/problem.aird14
-rw-r--r--language-model/src/testFixtures/java/tools/refinery/language/model/tests/ProblemTestUtil.java47
2 files changed, 52 insertions, 9 deletions
diff --git a/language-model/problem.aird b/language-model/problem.aird
index 52f96061..c5652fe4 100644
--- a/language-model/problem.aird
+++ b/language-model/problem.aird
@@ -7,7 +7,7 @@
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="problem" repPath="#_CsUwgKA4EeuqkpDnuik1sg" changeId="317aa0da-1457-4006-8f53-eb42e5a6b580"> 10 <ownedRepresentationDescriptors xmi:type="viewpoint:DRepresentationDescriptor" uid="_CsYa4KA4EeuqkpDnuik1sg" name="problem" repPath="#_CsUwgKA4EeuqkpDnuik1sg" changeId="120b195a-6ef2-4a18-9c1a-33913025087f">
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>
@@ -765,8 +765,8 @@
765 </children> 765 </children>
766 <styles xmi:type="notation:ConnectorStyle" xmi:id="_yCqSwaA7EeuqkpDnuik1sg" routing="Tree"/> 766 <styles xmi:type="notation:ConnectorStyle" xmi:id="_yCqSwaA7EeuqkpDnuik1sg" routing="Tree"/>
767 <styles xmi:type="notation:FontStyle" xmi:id="_yCqSwqA7EeuqkpDnuik1sg" fontName="Noto Sans" fontHeight="8"/> 767 <styles xmi:type="notation:FontStyle" xmi:id="_yCqSwqA7EeuqkpDnuik1sg" fontName="Noto Sans" fontHeight="8"/>
768 <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_yCqSw6A7EeuqkpDnuik1sg" points="[0, -5, -55, 683]$[0, -527, -55, 161]$[25, -527, -30, 161]$[25, -639, -30, 49]"/> 768 <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_yCqSw6A7EeuqkpDnuik1sg" points="[-1, -5, -56, 683]$[-1, -527, -56, 161]$[25, -527, -30, 161]$[25, -639, -30, 49]"/>
769 <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_yCqSyqA7EeuqkpDnuik1sg" id="(0.7711864406779662,0.05102040816326531)"/> 769 <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_yCqSyqA7EeuqkpDnuik1sg" id="(0.7288135593220338,0.030612244897959183)"/>
770 <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_yCqSy6A7EeuqkpDnuik1sg" id="(0.5,0.5)"/> 770 <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_yCqSy6A7EeuqkpDnuik1sg" id="(0.5,0.5)"/>
771 </edges> 771 </edges>
772 <edges xmi:type="notation:Edge" xmi:id="_0U2-4KA7EeuqkpDnuik1sg" type="4001" element="_0UtN5qA7EeuqkpDnuik1sg" source="_rRhWIKA7EeuqkpDnuik1sg" target="_-O-UEKA6EeuqkpDnuik1sg"> 772 <edges xmi:type="notation:Edge" xmi:id="_0U2-4KA7EeuqkpDnuik1sg" type="4001" element="_0UtN5qA7EeuqkpDnuik1sg" source="_rRhWIKA7EeuqkpDnuik1sg" target="_-O-UEKA6EeuqkpDnuik1sg">
@@ -1731,17 +1731,17 @@
1731 </edges> 1731 </edges>
1732 <edges xmi:type="notation:Edge" xmi:id="_teMnUCrbEeyyC-O0_LlY9w" type="4001" element="_td_zEirbEeyyC-O0_LlY9w" source="_jjhjYCraEeyyC-O0_LlY9w" target="_q-1B4CrbEeyyC-O0_LlY9w"> 1732 <edges xmi:type="notation:Edge" xmi:id="_teMnUCrbEeyyC-O0_LlY9w" type="4001" element="_td_zEirbEeyyC-O0_LlY9w" source="_jjhjYCraEeyyC-O0_LlY9w" target="_q-1B4CrbEeyyC-O0_LlY9w">
1733 <children xmi:type="notation:Node" xmi:id="_teNOYCrbEeyyC-O0_LlY9w" type="6001"> 1733 <children xmi:type="notation:Node" xmi:id="_teNOYCrbEeyyC-O0_LlY9w" type="6001">
1734 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_teNOYSrbEeyyC-O0_LlY9w" x="-218" y="-13"/> 1734 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_teNOYSrbEeyyC-O0_LlY9w" x="-226" y="-13"/>
1735 </children> 1735 </children>
1736 <children xmi:type="notation:Node" xmi:id="_teN1cCrbEeyyC-O0_LlY9w" type="6002"> 1736 <children xmi:type="notation:Node" xmi:id="_teN1cCrbEeyyC-O0_LlY9w" type="6002">
1737 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_teN1cSrbEeyyC-O0_LlY9w" x="98" y="10"/> 1737 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_teN1cSrbEeyyC-O0_LlY9w" x="84" y="10"/>
1738 </children> 1738 </children>
1739 <children xmi:type="notation:Node" xmi:id="_teOcgCrbEeyyC-O0_LlY9w" type="6003"> 1739 <children xmi:type="notation:Node" xmi:id="_teOcgCrbEeyyC-O0_LlY9w" type="6003">
1740 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_teOcgSrbEeyyC-O0_LlY9w" x="16"/> 1740 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_teOcgSrbEeyyC-O0_LlY9w" x="13"/>
1741 </children> 1741 </children>
1742 <styles xmi:type="notation:ConnectorStyle" xmi:id="_teMnUSrbEeyyC-O0_LlY9w" routing="Rectilinear"/> 1742 <styles xmi:type="notation:ConnectorStyle" xmi:id="_teMnUSrbEeyyC-O0_LlY9w" routing="Rectilinear"/>
1743 <styles xmi:type="notation:FontStyle" xmi:id="_teMnUirbEeyyC-O0_LlY9w" fontColor="7490599" fontName="Segoe UI" fontHeight="8"/> 1743 <styles xmi:type="notation:FontStyle" xmi:id="_teMnUirbEeyyC-O0_LlY9w" fontColor="7490599" fontName="Segoe UI" fontHeight="8"/>
1744 <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_teMnUyrbEeyyC-O0_LlY9w" points="[-58, 49, -398, -220]$[-58, 83, -398, -186]$[397, 83, 57, -186]$[397, 250, 57, -19]"/> 1744 <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_teMnUyrbEeyyC-O0_LlY9w" points="[-42, 49, -382, -220]$[-42, 83, -382, -186]$[397, 83, 57, -186]$[397, 250, 57, -19]"/>
1745 <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_teOcgirbEeyyC-O0_LlY9w" id="(1.0,0.5)"/> 1745 <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_teOcgirbEeyyC-O0_LlY9w" id="(1.0,0.5)"/>
1746 <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_teOcgyrbEeyyC-O0_LlY9w" id="(0.0,0.19387755102040816)"/> 1746 <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_teOcgyrbEeyyC-O0_LlY9w" id="(0.0,0.19387755102040816)"/>
1747 </edges> 1747 </edges>
diff --git a/language-model/src/testFixtures/java/tools/refinery/language/model/tests/ProblemTestUtil.java b/language-model/src/testFixtures/java/tools/refinery/language/model/tests/ProblemTestUtil.java
index b412ed1f..dadc5330 100644
--- a/language-model/src/testFixtures/java/tools/refinery/language/model/tests/ProblemTestUtil.java
+++ b/language-model/src/testFixtures/java/tools/refinery/language/model/tests/ProblemTestUtil.java
@@ -7,26 +7,33 @@ import org.eclipse.emf.ecore.resource.Resource.Diagnostic;
7import org.eclipse.emf.ecore.util.EcoreUtil; 7import org.eclipse.emf.ecore.util.EcoreUtil;
8 8
9import tools.refinery.language.model.ProblemUtil; 9import tools.refinery.language.model.ProblemUtil;
10import tools.refinery.language.model.problem.ActionLiteral;
10import tools.refinery.language.model.problem.Argument; 11import tools.refinery.language.model.problem.Argument;
11import tools.refinery.language.model.problem.Assertion; 12import tools.refinery.language.model.problem.Assertion;
12import tools.refinery.language.model.problem.AssertionArgument; 13import tools.refinery.language.model.problem.AssertionArgument;
13import tools.refinery.language.model.problem.Atom; 14import tools.refinery.language.model.problem.Atom;
14import tools.refinery.language.model.problem.ClassDeclaration; 15import tools.refinery.language.model.problem.ClassDeclaration;
15import tools.refinery.language.model.problem.Conjunction; 16import tools.refinery.language.model.problem.Conjunction;
17import tools.refinery.language.model.problem.DeleteActionLiteral;
16import tools.refinery.language.model.problem.EnumDeclaration; 18import tools.refinery.language.model.problem.EnumDeclaration;
17import tools.refinery.language.model.problem.Literal; 19import tools.refinery.language.model.problem.Literal;
18import tools.refinery.language.model.problem.NamedElement; 20import tools.refinery.language.model.problem.NamedElement;
19import tools.refinery.language.model.problem.NegativeLiteral; 21import tools.refinery.language.model.problem.NegativeLiteral;
22import tools.refinery.language.model.problem.NewActionLiteral;
20import tools.refinery.language.model.problem.Node; 23import tools.refinery.language.model.problem.Node;
21import tools.refinery.language.model.problem.NodeAssertionArgument; 24import tools.refinery.language.model.problem.NodeAssertionArgument;
22import tools.refinery.language.model.problem.NodeValueAssertion; 25import tools.refinery.language.model.problem.NodeValueAssertion;
23import tools.refinery.language.model.problem.Parameter; 26import tools.refinery.language.model.problem.Parameter;
27import tools.refinery.language.model.problem.ParametricDefinition;
24import tools.refinery.language.model.problem.PredicateDefinition; 28import tools.refinery.language.model.problem.PredicateDefinition;
25import tools.refinery.language.model.problem.Problem; 29import tools.refinery.language.model.problem.Problem;
26import tools.refinery.language.model.problem.ReferenceDeclaration; 30import tools.refinery.language.model.problem.ReferenceDeclaration;
27import tools.refinery.language.model.problem.Relation; 31import tools.refinery.language.model.problem.Relation;
32import tools.refinery.language.model.problem.RuleDefinition;
28import tools.refinery.language.model.problem.Statement; 33import tools.refinery.language.model.problem.Statement;
29import tools.refinery.language.model.problem.UniqueDeclaration; 34import tools.refinery.language.model.problem.UniqueDeclaration;
35import tools.refinery.language.model.problem.ValueActionLiteral;
36import tools.refinery.language.model.problem.ValueLiteral;
30import tools.refinery.language.model.problem.Variable; 37import tools.refinery.language.model.problem.Variable;
31import tools.refinery.language.model.problem.VariableOrNode; 38import tools.refinery.language.model.problem.VariableOrNode;
32import tools.refinery.language.model.problem.VariableOrNodeArgument; 39import tools.refinery.language.model.problem.VariableOrNodeArgument;
@@ -49,17 +56,29 @@ public class ProblemTestUtil {
49 return namedStatementOfType(problem, PredicateDefinition.class, name); 56 return namedStatementOfType(problem, PredicateDefinition.class, name);
50 } 57 }
51 58
52 public Parameter param(PredicateDefinition definition, int i) { 59 public RuleDefinition rule(Problem problem, String name) {
60 return namedStatementOfType(problem, RuleDefinition.class, name);
61 }
62
63 public Parameter param(ParametricDefinition definition, int i) {
53 return definition.getParameters().get(i); 64 return definition.getParameters().get(i);
54 } 65 }
55 66
56 public Conjunction conj(PredicateDefinition definition, int i) { 67 public Conjunction conj(ParametricDefinition definition, int i) {
57 return definition.getBodies().get(i); 68 return definition.getBodies().get(i);
58 } 69 }
59 70
60 public Literal lit(Conjunction conjunction, int i) { 71 public Literal lit(Conjunction conjunction, int i) {
61 return conjunction.getLiterals().get(i); 72 return conjunction.getLiterals().get(i);
62 } 73 }
74
75 public ActionLiteral actionLit(RuleDefinition rule, int i) {
76 return rule.getAction().getActionLiterals().get(i);
77 }
78
79 public Atom valueAtom(Literal literal) {
80 return ((ValueLiteral) literal).getAtom();
81 }
63 82
64 public Atom negated(Literal literal) { 83 public Atom negated(Literal literal) {
65 return ((NegativeLiteral) literal).getAtom(); 84 return ((NegativeLiteral) literal).getAtom();
@@ -85,6 +104,30 @@ public class ProblemTestUtil {
85 return (Variable) variableOrNode(argument); 104 return (Variable) variableOrNode(argument);
86 } 105 }
87 106
107 public Variable variable(ValueActionLiteral valueActionLiteral, int i) {
108 return variable(arg(valueActionLiteral.getAtom(), i));
109 }
110
111 public Variable variable(NewActionLiteral newActionLiteral) {
112 return newActionLiteral.getVariable();
113 }
114
115 public VariableOrNode deleteVar(ActionLiteral actionLiteral) {
116 return ((DeleteActionLiteral) actionLiteral).getVariableOrNode();
117 }
118
119 public VariableOrNode newVar(ActionLiteral actionLiteral) {
120 return ((NewActionLiteral) actionLiteral).getVariable();
121 }
122
123 public Atom valueAtom(ActionLiteral actionLiteral) {
124 return ((ValueActionLiteral) actionLiteral).getAtom();
125 }
126
127 public Variable variable(DeleteActionLiteral deleteActionLiteral) {
128 return (Variable) deleteActionLiteral.getVariableOrNode();
129 }
130
88 public Node node(Argument argument) { 131 public Node node(Argument argument) {
89 return (Node) variableOrNode(argument); 132 return (Node) variableOrNode(argument);
90 } 133 }