diff options
author | 2021-11-06 16:02:37 +0100 | |
---|---|---|
committer | 2021-11-06 16:34:01 +0100 | |
commit | 68e8c8ea4091482c43d810fdaa2fd6ddd6316d07 (patch) | |
tree | 00208f2337327d975e073a752133e30edabaede1 /language-model | |
parent | Merge pull request #11 from kris7t/unique-to-individual (diff) | |
download | refinery-68e8c8ea4091482c43d810fdaa2fd6ddd6316d07.tar.gz refinery-68e8c8ea4091482c43d810fdaa2fd6ddd6316d07.tar.zst refinery-68e8c8ea4091482c43d810fdaa2fd6ddd6316d07.zip |
fix(lang): mark transient references
Xtext fails to serialize non-transient references that have no
corresponding assignment in the grammar. Therefore, we mark
* Problem.nodes
* ClassDeclaration.newNode
* ExistentialQualifier.implicitVariables
* VariableOrNodeArgument.singletonVariable
as transient.
This will allow serializing Problem instances using the textual concrete
syntax for display.
Diffstat (limited to 'language-model')
4 files changed, 9 insertions, 8 deletions
diff --git a/language-model/META-INF/MANIFEST.MF b/language-model/META-INF/MANIFEST.MF index 88725730..96617f85 100644 --- a/language-model/META-INF/MANIFEST.MF +++ b/language-model/META-INF/MANIFEST.MF | |||
@@ -12,5 +12,6 @@ Export-Package: tools.refinery.language.model.problem, | |||
12 | tools.refinery.language.model.problem.impl, | 12 | tools.refinery.language.model.problem.impl, |
13 | tools.refinery.language.model.problem.util | 13 | tools.refinery.language.model.problem.util |
14 | Require-Bundle: org.eclipse.emf.ecore;visibility:=reexport, | 14 | Require-Bundle: org.eclipse.emf.ecore;visibility:=reexport, |
15 | org.eclipse.emf.ecore.xmi;visibility:=reexport, | ||
15 | org.eclipse.core.runtime | 16 | org.eclipse.core.runtime |
16 | Bundle-ActivationPolicy: lazy | 17 | Bundle-ActivationPolicy: lazy |
diff --git a/language-model/src/main/java/tools/refinery/language/model/GenerateProblemModel.mwe2 b/language-model/src/main/java/tools/refinery/language/model/GenerateProblemModel.mwe2 index 7f998448..c1518b4d 100644 --- a/language-model/src/main/java/tools/refinery/language/model/GenerateProblemModel.mwe2 +++ b/language-model/src/main/java/tools/refinery/language/model/GenerateProblemModel.mwe2 | |||
@@ -3,7 +3,7 @@ module tools.refinery.language.model.GenerateProblemModel | |||
3 | Workflow { | 3 | Workflow { |
4 | bean = org.eclipse.emf.mwe.utils.StandaloneSetup { | 4 | bean = org.eclipse.emf.mwe.utils.StandaloneSetup { |
5 | projectMapping = { | 5 | projectMapping = { |
6 | projectName = "language-model" | 6 | projectName = "refinery-language-model" |
7 | path = "." | 7 | path = "." |
8 | } | 8 | } |
9 | } | 9 | } |
@@ -14,7 +14,7 @@ Workflow { | |||
14 | 14 | ||
15 | component = org.eclipse.emf.mwe2.ecore.EcoreGenerator { | 15 | component = org.eclipse.emf.mwe2.ecore.EcoreGenerator { |
16 | generateCustomClasses = false | 16 | generateCustomClasses = false |
17 | genModel = "platform:/resource/language-model/src/main/resources/model/problem.genmodel" | 17 | genModel = "platform:/resource/refinery-language-model/src/main/resources/model/problem.genmodel" |
18 | srcPath = "platform:/resource/language-model/src/main/emf-gen" | 18 | srcPath = "platform:/resource/refinery-language-model/src/main/emf-gen" |
19 | } | 19 | } |
20 | } | 20 | } |
diff --git a/language-model/src/main/resources/model/problem.ecore b/language-model/src/main/resources/model/problem.ecore index 77211b66..582f67c8 100644 --- a/language-model/src/main/resources/model/problem.ecore +++ b/language-model/src/main/resources/model/problem.ecore | |||
@@ -3,7 +3,7 @@ | |||
3 | xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="problem" nsURI="https://refinery.tools/emf/2021/Problem" nsPrefix="problem"> | 3 | xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="problem" nsURI="https://refinery.tools/emf/2021/Problem" nsPrefix="problem"> |
4 | <eClassifiers xsi:type="ecore:EClass" name="Problem" eSuperTypes="#//NamedElement"> | 4 | <eClassifiers xsi:type="ecore:EClass" name="Problem" eSuperTypes="#//NamedElement"> |
5 | <eStructuralFeatures xsi:type="ecore:EReference" name="nodes" upperBound="-1" | 5 | <eStructuralFeatures xsi:type="ecore:EReference" name="nodes" upperBound="-1" |
6 | eType="#//Node" containment="true"/> | 6 | eType="#//Node" transient="true" containment="true"/> |
7 | <eStructuralFeatures xsi:type="ecore:EReference" name="statements" upperBound="-1" | 7 | <eStructuralFeatures xsi:type="ecore:EReference" name="statements" upperBound="-1" |
8 | eType="#//Statement" containment="true"/> | 8 | eType="#//Statement" containment="true"/> |
9 | </eClassifiers> | 9 | </eClassifiers> |
@@ -15,7 +15,7 @@ | |||
15 | <eStructuralFeatures xsi:type="ecore:EReference" name="referenceDeclarations" | 15 | <eStructuralFeatures xsi:type="ecore:EReference" name="referenceDeclarations" |
16 | upperBound="-1" eType="#//ReferenceDeclaration" containment="true"/> | 16 | upperBound="-1" eType="#//ReferenceDeclaration" containment="true"/> |
17 | <eStructuralFeatures xsi:type="ecore:EReference" name="newNode" eType="#//Node" | 17 | <eStructuralFeatures xsi:type="ecore:EReference" name="newNode" eType="#//Node" |
18 | containment="true"/> | 18 | transient="true" containment="true"/> |
19 | </eClassifiers> | 19 | </eClassifiers> |
20 | <eClassifiers xsi:type="ecore:EClass" name="ReferenceDeclaration" eSuperTypes="#//Relation"> | 20 | <eClassifiers xsi:type="ecore:EClass" name="ReferenceDeclaration" eSuperTypes="#//Relation"> |
21 | <eStructuralFeatures xsi:type="ecore:EReference" name="referenceType" eType="#//Relation"/> | 21 | <eStructuralFeatures xsi:type="ecore:EReference" name="referenceType" eType="#//Relation"/> |
@@ -52,7 +52,7 @@ | |||
52 | <eClassifiers xsi:type="ecore:EClass" name="ExistentialQuantifier" abstract="true" | 52 | <eClassifiers xsi:type="ecore:EClass" name="ExistentialQuantifier" abstract="true" |
53 | interface="true"> | 53 | interface="true"> |
54 | <eStructuralFeatures xsi:type="ecore:EReference" name="implicitVariables" upperBound="-1" | 54 | <eStructuralFeatures xsi:type="ecore:EReference" name="implicitVariables" upperBound="-1" |
55 | eType="#//ImplicitVariable" containment="true"/> | 55 | eType="#//ImplicitVariable" transient="true" containment="true"/> |
56 | </eClassifiers> | 56 | </eClassifiers> |
57 | <eClassifiers xsi:type="ecore:EClass" name="Assertion" eSuperTypes="#//Statement"> | 57 | <eClassifiers xsi:type="ecore:EClass" name="Assertion" eSuperTypes="#//Statement"> |
58 | <eStructuralFeatures xsi:type="ecore:EReference" name="relation" eType="#//Relation"/> | 58 | <eStructuralFeatures xsi:type="ecore:EReference" name="relation" eType="#//Relation"/> |
@@ -95,7 +95,7 @@ | |||
95 | <eClassifiers xsi:type="ecore:EClass" name="VariableOrNodeArgument" eSuperTypes="#//Argument"> | 95 | <eClassifiers xsi:type="ecore:EClass" name="VariableOrNodeArgument" eSuperTypes="#//Argument"> |
96 | <eStructuralFeatures xsi:type="ecore:EReference" name="variableOrNode" eType="#//VariableOrNode"/> | 96 | <eStructuralFeatures xsi:type="ecore:EReference" name="variableOrNode" eType="#//VariableOrNode"/> |
97 | <eStructuralFeatures xsi:type="ecore:EReference" name="singletonVariable" eType="#//ImplicitVariable" | 97 | <eStructuralFeatures xsi:type="ecore:EReference" name="singletonVariable" eType="#//ImplicitVariable" |
98 | containment="true"/> | 98 | transient="true" containment="true"/> |
99 | </eClassifiers> | 99 | </eClassifiers> |
100 | <eClassifiers xsi:type="ecore:EClass" name="EnumDeclaration" eSuperTypes="#//Relation #//Statement"> | 100 | <eClassifiers xsi:type="ecore:EClass" name="EnumDeclaration" eSuperTypes="#//Relation #//Statement"> |
101 | <eStructuralFeatures xsi:type="ecore:EReference" name="literals" upperBound="-1" | 101 | <eStructuralFeatures xsi:type="ecore:EReference" name="literals" upperBound="-1" |
diff --git a/language-model/src/main/resources/model/problem.genmodel b/language-model/src/main/resources/model/problem.genmodel index 094533e7..3e0ee35e 100644 --- a/language-model/src/main/resources/model/problem.genmodel +++ b/language-model/src/main/resources/model/problem.genmodel | |||
@@ -1,7 +1,7 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | 2 | <genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
3 | xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" | 3 | xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" |
4 | modelDirectory="/language-model/src/main/emf-gen" creationIcons="false" | 4 | modelDirectory="/refinery-language-model/src/main/emf-gen" creationIcons="false" |
5 | editDirectory="/language-edit/src/main/emf-gen" editorDirectory="/org.eclipse.viatra.solver.language.model.editor/src-gen" | 5 | editDirectory="/language-edit/src/main/emf-gen" editorDirectory="/org.eclipse.viatra.solver.language.model.editor/src-gen" |
6 | modelPluginID="language-model" modelName="Problem" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container" | 6 | modelPluginID="language-model" modelName="Problem" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container" |
7 | codeFormatting="true" importerID="org.eclipse.emf.importer.ecore" complianceLevel="5.0" | 7 | codeFormatting="true" importerID="org.eclipse.emf.importer.ecore" complianceLevel="5.0" |