This repository contains usage examples of tools from or based on the Eclipse Modeling Framework (EMF) [1], and UML examples. The usage examples show
- the implementation of an abstract and concrete syntax for a textual language for modeling simple data structures (used tools: Xcore and Xtext [2,3]).
- implementation of a model-to-text transformation that derives Java POJOs from models constructed with the aforementioned Data Structure Modeling Language (used tool: Acceleo [4]).
- implementation of a model-to-model transformation that derives UML class diagrams from data structure models (used tool: ATL [5]).
- models that represent different views on a microservice architecture and which are expressed with the Language Ecosystem for Modeling Microservice Architectures (LEMMA) [8].
- UML diagrams for different viewpoints in Microservice Architecture (MSA) [9].
To play around with the provided examples, follow these steps:
-
Download one of the predefined Eclipse packages depending on your OS:
-
Clone/Download this repository to your harddrive.
-
Run the
eclipse
executable in the package you downloaded in step 1, create a workspace as requested by the IDE, and import the projects you cloned/downloaded in step 2. Projects can be imported in Eclipse by hittingFile > Open Projects from File System...
, then choosing the parent folder of the cloned/downloaded projects asImport source
, and after the projects were loaded hittingFinish
. -
Download Visual Paradigm 15.2 Community Edition for your OS and install it.
Now that you have imported all projects into your workspace, you can try out the usage examples. The execution of the examples is technology-specific.
To try out the Xcore and Xtext examples, you have to do the following:
-
Right click on the project
de.fhdo.ewks.ml_example.xtext
which you imported into your workspace in step 3 above and from the context menu chooseRun As > Eclipse Application
. A new runtime Eclipse instance is opened. -
In the runtime Eclipse instance switch to the workbench and create a new
Java Project
entitled, e.g.,Test
. -
In the new
Test
project create a file with the extension.struct
and the nameMyStructure
, i.e., the file's full name isMyStructure.struct
. Confirm any subsequent dialogs withYes
. -
In the open editor showing the empty file
MyStructure.struct
, enter the following piece of code that conforms to the syntax of the Data Structure Modeling Language:context Accounting { structure ParkingSpace { string name, string description, boolean isOpen, double longitude, double latitude } }
The editor highlights the code according to what you have seen in MDE Part I.
To try out the Acceleo example, you have to do the following:
- If you still have the runtime Eclipse instance, which you started in step (a) of the previous Xcore and Xtext instruction, close it. Switch to the Eclipse instance that you started in step 3 of the general introducton (see above).
-
In the project
de.fhdo.ewks.acceleo_example
navigate to the filemain.mtl
, which is located in the project folder/src/de/fhdo/ewks/acceleo_example
. -
Right click on the
main.mtl
file and chooseRun As > Launch Acceleo Application
. In the newly opened window enter the following values:- Project:
de.fhdo.ewks.acceleo_example
- Main class:
de.fhdo.ewks.acceleo_example.Main
(this is the Java-based runner for the Acceleo transformation) - Model:
/de.fhdo.ewks.acceleo_example/model/MetamodelInstance.xmi
(this a predefined instance of the Xcore metamodel for the Data Structure Modeling Language that reflects the model you created in step (d) in the previous section; if you want to create a new metamodel instance, i.e., a new model, with custom values (i) double click on the project file/de.fhdo.ewks.acceleo_example/model/ml_example.ecore
, (ii) in the opened tree right click onContext
and hitCreate Dynamic Instance...
, (iii) after that, follow the guide "Editing Ecore model instances" [6] to create new model elements with custom values) - Target:
/de.fhdo.ewks.acceleo_example/output
(this is the output folder of the Java code resulting from executing the transformation)
- Project:
- Make sure you selected
Java Application
as "Runner" and hitRun
. The transformation will produce a file calledParkingSpace.java
in the project folderoutput
. It corresponds to the model you created in step (d) of the previous section.
To try out the ATL example, you have to do the following:
- If you still have the runtime Eclipse instance, which you started in step (a) of the previous Xcore and Xtext instruction, close it. Switch to the Eclipse instance that you started in step 3 of the general introducton (see above).
-
In the project
ATL-example
navigate to the fileDS2UML.atl
, which is located in the project folder/src
. -
Right click on the
DS2UML.atl
file and chooseRun As > ATL transformation
. In the newly opened window enter the following values:- DataStructureModel:
/ATL-example/model/ml_example.ecore
(this is the Ecore representation of the Xcore metamodel of the Data Structure Modeling Language) - UML:
uri:http://www.eclipse.org/uml2/5.0.0/UML
(this represents the current UML metamodel [7]) - IN:
/ATL-example/model/MetamodelInstance.xmi
(this a predefined instance of the Xcore metamodel for the Data Structure Modeling Language that reflects the model you created in step (d) in the previous section; if you want to create a new metamodel instance, i.e., a new model, with custom values (i) double click on the project file/ATL-example/model/ml_example.ecore
, (ii) in the opened tree right click onContext
and hitCreate Dynamic Instance...
, (iii) after that, follow the guide "Editing Ecore model instances" [6] to create new model elements with custom values) - TYPES:
/ATL-example/model/UMLPrimitiveTypes.library.uml
(this a definition of UML's primitive types, which is needed to create UMLPrimitiveType
instances) - OUT:
/ATL-example/output/out.xmi
(this is the output file, which contains the UML target instance in the XMI format)
- DataStructureModel:
-
Switch to the "Advanced" tab and activate the checkbox
Allow inter-model references
. -
Hit
Run
. The transformation will produce a file calledout.xmi
in the project folderoutput
. It corresponds to the model you created in step (d) of the previous section, but is a UML class diagram instance.
To try out the LEMMA examples, you have to do the following:
-
Open the project
LEMMA-examples
which you imported into your workspace in step 3 above. -
Within the project you will find different different folders.
- The
domain models
folder comprises the domain modelsBanking.data
andStudent.data
expressed in LEMMA's Domain Data Modeling Language. - The
microservices
folder comprises the service modelsBanking.services
andStudent.services
expressed in LEMMA's Service Modeling Language. - The
operation
folder comprises the operation modelArchitecture.operation
expressed in LEMMA's Operation Modeling Language. - The
technology
folder comprises the Java technology model (filejava.technology
) used throughout the lectures. You are invited to explore and play around with it, in case you are curious.
- The
To try out the UML examples, you have to do the following:
- Start Visual Paradigm which you installed in step 4 (see above).
-
In the dash panel, click on
Project > Open
. Select theUML-examples.vpp
that you cloned from the repository in step 2 (see above) from the file chooser and open it.
The file contains three different diagrams (class, component, and deployment). You can switch between them in Visual Paradigm via the Project Browser.
[1] https://wiki.eclipse.org/EMF
[2] https://wiki.eclipse.org/Xcore
[3] https://www.eclipse.org/Xtext
[4] https://wiki.eclipse.org/Acceleo
[5] https://www.eclipse.org/atl
[6] https://www.ntnu.no/wiki/display/tdt4250/Editing+Ecore+model+instances
[7] https://www.omg.org/spec/UML/2.5/PDF
[8] https://github.com/SeelabFhdo/ddmm
[9] Rademacher, F., Sorgalla, J., Sachweh, S.: Challenges of domain-driven microservice design:
A model-driven perspective. IEEE Software 35(3), 36–43 (2018)