blob: e2cb24b54d9f6dd56957121e81481778e36917ea [file] [log] [blame]
Ed Willinkc57e4822014-11-01 21:04:00 +00001/*******************************************************************************
Ed Willink52e3d062015-05-19 10:14:44 +01002 * Copyright (c) 2014 Willink Transformations and others.
Ed Willinkc57e4822014-11-01 21:04:00 +00003 * All rights reserved. This program and the accompanying materials
Ed Willink2b4d8be2018-06-13 11:53:02 +01004 * are made available under the terms of the Eclipse Public License v2.0
Ed Willinkc57e4822014-11-01 21:04:00 +00005 * which accompanies this distribution, and is available at
Ed Willink2b4d8be2018-06-13 11:53:02 +01006 * http://www.eclipse.org/legal/epl-v20.html
Ed Willinkc57e4822014-11-01 21:04:00 +00007 *
8 * Contributors:
9 * E.D.Willink - initial API and implementation
10 * Adolfo Sanchez-Barbudo Herrera (University of York) - bug397429"
11 *
12 * Run As->MWE2 Workflow to regenerate the Xtest CS models.
13 *******************************************************************************/
14module GenerateCSModelsFromUML
15
16import org.eclipse.ocl.examples.build.*
17import org.eclipse.ocl.examples.build.utilities.*
18import org.eclipse.ocl.examples.build.xtend.*
19import org.eclipse.emf.mwe.utils.*
20import org.eclipse.emf.mwe.utils.*
21import org.eclipse.emf.ecore.resource.impl.*
22
Ed Willink443b3a32014-12-04 18:41:44 +000023var resourcesProjectName = "org.eclipse.ocl.examples.build" //"org.eclipse.ocl.resources"
Ed Willinkc57e4822014-11-01 21:04:00 +000024var projectName = "org.eclipse.ocl.examples.build"
Ed Willinkc57e4822014-11-01 21:04:00 +000025
26/**
Ed Willink443b3a32014-12-04 18:41:44 +000027 * Migrate the CS models from their OMG UML representation to their Eclipse Ecore representation.
Ed Willinkc57e4822014-11-01 21:04:00 +000028 */
29Workflow {
30 bean = ResourceSetImpl : resourceSet {}
31 bean = StandaloneSetup { resourceSet = resourceSet
32// uriMap = Mapping {
33// from = "http://www.omg.org/spec/UML/20131001/PrimitiveTypes.xmi"
34// to = "platform:/resource/${projectName}/model/PrimitiveTypes.xmi"
35// }
36// platformUri = ".."
37// scanClassPath = true
38// registerGeneratedEPackage = "org.eclipse.xtext.common.types.TypesPackage"
39 }
40 bean = ProjectMapSetup { resourceSet = resourceSet }
41 bean = UMLStandaloneSetup { resourceSet = resourceSet }
42 bean = OCLStandaloneSetup { resourceSet = resourceSet
43 dynamicPackage = Mapping {
44 from = "http://www.eclipse.org/ocl/2012/UML2EcoreControl"
45 to = "platform:/resource/${projectName}/model/UML2EcoreControl.ecore#/"
46 }
47 dynamicPackage = Mapping {
48 from = "http://www.eclipse.org/ocl/2012/UML2EcoreMapping"
49 to = "platform:/resource/${projectName}/model/UML2EcoreMapping.ecore#/"
50 }
51 }
52 bean = OCLDelegateSetup { resourceSet = resourceSet }
53 bean = GenModelSetup { resourceSet = resourceSet }
54 bean = UMLGenModelSetup { resourceSet = resourceSet }
55
56
57 component = IdAssigner { resourceSet = resourceSet skipOnErrors = true
58 assignFlatIds = false
Ed Willink443b3a32014-12-04 18:41:44 +000059 normalizeEcore = true
60// normalizePrimitives = "/${resourcesProjectName}/model/pivot.uml"
61 alphabeticize = true
62 removeEcoreStereotypes = true
63 removeProfileApplications = true
Ed Willinkc57e4822014-11-01 21:04:00 +000064// mapping = Mapping {
65// from = "/${projectName}/model/ecore.uml"
66// to = "/${projectName}/model-gen/CSEcore.uml"
67// }
68 mapping = Mapping {
Ed Willink443b3a32014-12-04 18:41:44 +000069 from = "/${resourcesProjectName}/model/pivot.uml"
Ed Willinkc57e4822014-11-01 21:04:00 +000070 to = "/${projectName}/model-gen/CSPivot.uml"
71 }
72 mapping = Mapping {
Ed Willink443b3a32014-12-04 18:41:44 +000073 from = "/${resourcesProjectName}/model/basecs.uml"
Ed Willinkc57e4822014-11-01 21:04:00 +000074 to = "/${projectName}/model-gen/BaseCS.uml"
75 }
76 mapping = Mapping {
Ed Willink443b3a32014-12-04 18:41:44 +000077 from = "/${resourcesProjectName}/model/essentialoclcs.uml"
Ed Willinkc57e4822014-11-01 21:04:00 +000078 to = "/${projectName}/model-gen/EssentialOCLCS.uml"
79 }
80 mapping = Mapping {
Ed Willink443b3a32014-12-04 18:41:44 +000081 from = "/${resourcesProjectName}/model/completeoclcs.uml"
Ed Willinkc57e4822014-11-01 21:04:00 +000082 to = "/${projectName}/model-gen/CompleteOCLCS.uml"
83 }
Ed Willink443b3a32014-12-04 18:41:44 +000084 mapping = Mapping {
85 from = "/${resourcesProjectName}/model/oclstdlibcs.uml"
86 to = "/${projectName}/model-gen/OCLstdlibCS.uml"
87 }
88 mapping = Mapping {
89 from = "/${resourcesProjectName}/model/oclinecorecs.uml"
90 to = "/${projectName}/model-gen/OCLinEcoreCS.uml"
91 }
Ed Willinkc57e4822014-11-01 21:04:00 +000092 }
93
94 component = QVToTransformationExecutor { resourceSet = resourceSet skipOnErrors = true validate = false
Ed Willink443b3a32014-12-04 18:41:44 +000095 uri = "platform:/resource/${projectName}/src/org/eclipse/ocl/examples/build/qvto/UML2EcoreMerger.qvto"
Ed Willinkc729bc02014-11-01 22:04:27 +000096 in = "platform:/resource/${projectName}/model/CS2ASinEcore.xmi"
Ed Willink443b3a32014-12-04 18:41:44 +000097 out = "platform:/resource/${projectName}/model-gen/CS2ASinEcore.xmi"
98 }
99 component = QVToTransformationExecutor { resourceSet = resourceSet skipOnErrors = true validate = false
100 uri = "platform:/resource/${projectName}/src/org/eclipse/ocl/examples/build/qvto/UML2EcoreAnalyzer.qvto"
101 in = "platform:/resource/${projectName}/model-gen/CS2ASinEcore.xmi"
Ed Willinkc729bc02014-11-01 22:04:27 +0000102 out = "platform:/resource/${projectName}/model-gen/CS2ASAnalysis.xmi"
Ed Willinkc57e4822014-11-01 21:04:00 +0000103 }
104 component = QVToTransformationExecutor { resourceSet = resourceSet skipOnErrors = true validate = false
105 uri = "platform:/resource/${projectName}/src/org/eclipse/ocl/examples/build/qvto/UML2EcoreSynthesizer.qvto"
Ed Willinkc729bc02014-11-01 22:04:27 +0000106 in = "platform:/resource/${projectName}/model-gen/CS2ASAnalysis.xmi"
Ed Willink443b3a32014-12-04 18:41:44 +0000107 in = "platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore"
108 out = "platform:/resource/${projectName}/model-gen/CS2AS.ecore"
109 blackbox = "${projectName}.qvto.BlackBoxLibrary"
Ed Willinkc57e4822014-11-01 21:04:00 +0000110 }
Ed Willink443b3a32014-12-04 18:41:44 +0000111 component = CSSplitter { resourceSet = resourceSet skipOnErrors = true
Ed Willinkc729bc02014-11-01 22:04:27 +0000112 in = "platform:/resource/${projectName}/model-gen/CS2AS.ecore"
Ed Willinkc57e4822014-11-01 21:04:00 +0000113 exclude = Mapping {
Ed Willink443b3a32014-12-04 18:41:44 +0000114 from = "csecore"
115 to = "http://www.eclipse.org/emf/2002/Ecore"
116 }
117 exclude = Mapping {
Ed Willinkc57e4822014-11-01 21:04:00 +0000118 from = "cspivot"
Ed Willink30414ed2014-12-28 13:01:28 +0000119// to = "platform:/resource/org.eclipse.ocl.pivot/model/Pivot.ecore"
Ed Willink443b3a32014-12-04 18:41:44 +0000120 to = "Pivot.ecore"
Ed Willinkc57e4822014-11-01 21:04:00 +0000121 }
122 include = Mapping {
123 from = "basecs"
124 to = "platform:/resource/${projectName}/model-gen/BaseCS.ecore"
125 }
126 include = Mapping {
127 from = "essentialoclcs"
128 to = "platform:/resource/${projectName}/model-gen/EssentialOCLCS.ecore"
129 }
130 include = Mapping {
131 from = "completeoclcs"
132 to = "platform:/resource/${projectName}/model-gen/CompleteOCLCS.ecore"
133 }
Ed Willink443b3a32014-12-04 18:41:44 +0000134 include = Mapping {
135 from = "oclstdlibcs"
136 to = "platform:/resource/${projectName}/model-gen/OCLstdlibCS.ecore"
137 }
138 include = Mapping {
139 from = "oclinecorecs"
140 to = "platform:/resource/${projectName}/model-gen/OCLinEcoreCS.ecore"
141 }
Ed Willinkc57e4822014-11-01 21:04:00 +0000142 }
143
144/* component = ResourceReader { resourceSet = resourceSet skipOnErrors = true
145 modelSlot = "${umlSlot}"
146 uri = "/${projectName}/model/basecs.uml"
147 }
148 component = PackageAlphabetizer { skipOnErrors = true
149 modelSlot = "${umlSlot}"
150 }
151 component = ConstraintRemover { skipOnErrors = true
152 modelSlot = "${umlSlot}"
153 }
154 component = CommentNormalizer { skipOnErrors = true
155 modelSlot = "${umlSlot}"
156 }
157 component = UMLIDAssigner { skipOnErrors = true
158 modelSlot = "${umlSlot}"
159 }
160 component = ResourceWriter { resourceSet = resourceSet skipOnErrors = true
161 modelSlot = "${umlSlot}"
162 uri = "/${projectName}/model-gen/BaseCS.merged.uml"
163 contentTypeIdentifier = "org.eclipse.uml2.uml_5_0_0" // UMLResource.UML_CONTENT_TYPE_IDENTIFIER
164 } */
165}