OpenEmbeDD basic demo
A demonstration of the OpenEmbeDD platform
metamodeling chain tool.
Fabien Fillion
Vincent Mahe
Copyright © 2007 OpenEmbeDD project (openembedd.org)
Licence
TODO July 2007
Abstract
A presentation and some explanations about the OpenEmbeDD demonstration of platform basic tools.
Introduction 1. Preamble
1. Installation of prerequisites and demo 2. Prerequisite
3. Goal of the demo
3.1. Schema of the demo 3.2. Specifications
2. Run the Demo
1. FIRST STEP : UML diagram (with TOPCASED)
2. SECOND STEP : transformation from UML to CWM (with ATL) 3. THIRD STEP : CWM simulator (with Kermeta)
4. Beyond the present demo
4.1. Play with the demo
4.2. Some possible extensions of the chain
A. Technical data
Introduction
OpenEmbeDD platform contains open tools to design real time softwares. The particularity is that each of them are integrated into the platform by an architecture based on model, that is called model driven engineering. To do this work the OpenEmbeDD platform integrate basic tools of metamodel like Topcased, ATL and Kermeta, these are the base of all development tools. This is why for the first basic demo of the platform the region of interest is an example use of the three tools.
So the goal of the demo is to show you an use case of OpenEmbeDD metamodelling tools suite, by using three very important components : one of the Topcased model graphic editors, the ATL transformation language and the Kermeta interpreter.
Chapter 1. Preamble
1. Installation of prerequisites and demo
The easiest manner to install the basic demonstration of OpenEmbeDD is to import it by downloading the demonstration "OpenEmbeDD basic demo" in the wizard site update and by using the menu File->New->Example… in which one can then choose the “OpenEmbeDD basic demo” which moves automatically into your working area.
Method to install prerequisites and demo :
1. Check if UML graphic editor of Topcased is installed in your OpenEmbeDD configuration, go on the menu File->New->Other then check if the folder "Topcased/Topcased Diagrams" exists and then if you can select "UML Diagram" inside. If not you have to install it by using the
OpenEmbeDD site update.
2. Check if the ATL tools are installed in your OpenEmbeDD configuration, go on the menu File->New->Project... then check if the folder "ATL" exists and then if you can select the two items
"ATL Project" and "ATL file" inside. If not you have to install them by using the OpenEmbeDD site update.
3. Check if the Kermeta workbench is installed in your OpenEmbeDD configuration, go on the menu
File->New->Project... then check if the folder "Kermeta" exists and then if you can select the two items "New Kermeta file" and "New Kermeta Project" inside. If not you have to install them by using the OpenEmbeDD site update.
To install OpenEmbeDD features you may use OpenEmbeDD Site Update by selecting "Search for new features to install" in the Update Manager wizard. You will find all the explanations here :
4. Install the demo "OpenEmbeDD basic demo" if it is not yet among your plugins. To know if it is yes or not yet installed in your working area, click ont he menu File->New->Example… that open the wizard and look if it exists the folder "OpenEmbeDD demo" with the "OpenEmbeDD basic demo" item inside. If it exists, launch it by selecting the item, that results in to install the project of demonstration named "org.openembedd.basic.uml2cwm.demo" directly in your workspace; then you can start to work with and pass to the first part of TOPCASED.
If it doesn't exist, you have to download the plugin by using the site update of OpenEmbeDD like below:
Once the plugin demo is in your environment, you can restart Eclipse and select the menu File->New->Example… then open the folder "OpenEmbeDD demo" and select the item
"OpenEmbeDD basic demo" and finally click on Finish. The demo is a project named
"org.openembedd.basic.uml2cwm.demo" which install itself in your workspace, so you can at once use it and pass to the first step of the Demo (use of Topcased UML2 editor).
5. Now you have installed the plugin, you will be able to reach it when you want and as many once as necessary.
2. Prerequisite
First, before beginning with this basic demo of OpenembeDD, you have to be familiar with the
metamodels and Eclipse tools which manage and drive them. We will not lay on the matter because there are many documentation to understand how to drive the metamodels with Topcased, ATL and Kermeta; we can give some links :
EMF : it is the base of almost all metamodel tools in Eclipse platform
http://www.eclipse.org/modeling/emf/?project=emf
or inside the online Eclipse help (menu Help-> Help Contents) you can get simple tutorials at the entry
"EMF Developer Guide",
Topcased : it provides many tools and model services of which graphic editors
http://www.topcased.org
or inside the online Eclipse help (menu Help-> Help Contents) you can get tutorials at the entry
"Topcased Developer Guide" then "Getting Started"
ATL : it provides a virtual machine which allows you to make model transformations declarative between metamodels conforms has MOF
or inside the online Eclipse help (menu Help-> Help Contents) you can get developer and user guides at the entries "ADT Plug-in Developer Guide" and "ADT Plug-in User Guide"
Kermeta : it provides a kernel which allows you to make transformations in an imperative way and to process also simulation of model
http://www.kermeta.org
or inside the online Eclipse help (menu Help-> Help Contents) you can get many documentation and references at the entry "KerMeta documentation" and after the help splits on developer and user documentation : "User documentation" , "Developer documentation"
You may also have a look on the GEF documentation and GMF documentation, which are modelling tools but more technical and internal of the platform. Developper could need to refer on them.
During along the article, we will speak of metamodels and in particular, we will describe them with the semantic of UML : http://www.uml.org ; moreover the metamodel used as source of the demo is precisely the static part of UML, so we advise you to have a look on that too, if you want understand the whole process we are presenting.
We speak also about ecore format, which is a xml format to manage metadata and metamodel. In the demo each metamodel get its own ecore file.
UML : Class diagram of UML2 is used for the model in input, and you may find a lot of links which introduce this diagram. Here is the link of official UML site :
http://www.uml.org
CWM : Common Wharehouse Metamodel is used as output after the ATL transformation of the UML model. Here are some links for CWM :
http://www.omg.org/technology/cwm http://www.cwmforum.org
3. Goal of the demo
The goal of the demo is to show you an application of OpenEmbeDD tools suite, by using three very important components : the platform is based on a model graphic editor, a model transformation and a model simulation. The implementation order of the demo is arbitrary, you can use each of three tools as standalone or in another order and another way according to your process.
The example is based on 2 rather known metamodels which UML2 and CWM (for Common Warehouse Metamodel). We choose them to offer you a vision of the OpenEmbeDD ability to deal with industrial metamodels when other platforms use academic unrealistic metamodels.
However, for a quickly understable presentation, we have considered only a few part of each metamodel, using only basics of the UML2 class diagram and the relational package of CWM metamodel (which contains basic concepts of data like table, key, index,…).
3.1. Schema of the demo
3.2. Specifications
1. First, we wish to be able to build a simple model with diagram of class of UML2. Of course we are aware that we have to limit our target because the demo would become very complex and less speaking if there are many concepts from the metamodel. However we wish to manage multi-property for the class and two association types : 0.1 - * and * - *, in order to be able to simulate (simple) queries.
We also wish to make easy each UML model with the graphic editor provided by Topcased. UML2 sampling:
management of the data type
management of the multiple properties for a class management of the class type multiple
management of associations 0.1 - * and with one composite management of associations * - *
2. Second, we would like to take the model UML above as input and transform it into a relational model for which we know one metamodel : the CWM (Common Wharehouse Metamodel). We are choose a simple example for the mapping between two reduced parts of the metamodels:
the UML static model is mapped as the CWM root Catalog the container Package corresponds to a Schema
a Class corresponds to a Table
a Data Type corresponds to a SQLStructuredType
a property corresponds to a set of Table and ForeignKey according to its multiplicity and
its type
an association corresponds to a set of Table and ForeignKey according to its multiplicity
and its composite
3. Third, we would like to simulate the result of CWM model by inserting in the Tables; that
corresponds to a simulation of an instance of the model CWM. We only implemented the simplest functions:
print a table content add a row
delete a row
select rows in a table, on a foreign key
Chapter 2. Run the Demo
1. FIRST STEP : UML diagram (with TOPCASED)
If you wish to use the graphic editor of topcased to design the UML models input, you must initially you ensure that it is well installed in your OpenEmbeDD platform.
We are beginning the demo by creating a model UML with the diagram class editor of Topcased. You can use the model file provided in the demonstration for more simplicity, or build it you even by launching a graphic editor UML in the way File->New->Other then select "UML Diagram" in the
"Topcased/Topcased Diagrams" directory.
The name of the given file is SalesRDB.umldi for the diagram and SalesRDB.uml for the underlying UML model. You can find them in the directory named "model" at the root of the project
org.openembedd.basic.uml2cwm.demo. The file SalesRDB.uml is the input model for second step transformation towards a CWM model. After studying this built example we encourage you to build your own models by the same mechanism and to test them in the second step.
SalesRDB.umldi in the UML2 static diagram editor
As soon as you modify the diagram SalesRDB.umldi and you save it, the modification is effective in the SalesRDB.uml model file; on the other hand the opposite is not true. Also note that if you remove graphic objects on the *.umldi diagram, you should choice the "shift+delete" action in order to also remove them in the *.uml model itself.
You can edit the model SalesRDB.uml with the reflexive editor of EMF : in this way it looks like a tree.
2. SECOND STEP : transformation from UML to CWM (with
ATL)
The second stage of the demo is to transform the UML SalesRDB.uml model seen previously into a CWM relational model following our specification seen in 2.1.
The file's name of ATL transformation is umlclass2cwmrelational.atl and you can find it in the folder named "atl". An ATL file has the *.atl extension, and contains a set of rules and helpers which correspond to the mapping of the transformation of 2 metamodels source (UML) and destination (CWM). The ATL transformation file exists in the demonstration plugin. You can modify it for your tests, after keeping a copy somewhere in your project (in any way you will be able to always reinstall the demonstration where necessary).
The first thing to do is to set up the ATL launch configurator to allow the transformation to run.
You may launch the run dialog on the menu Run->Run... In the treeview on the left you can see a set of application type, of which ATL transformation. It should exist one ATL configuration named by "uml2cwm" like in the screenshot below:
Select it and run it to get the SalesRDB.relational out file. If you meet some problems then see has the following address :
http://www.eclipse.org/m2m/atl/doc/ATL_Starter_Guide.pdf where there is a starter guide which works step by step with a lot of details.
The result of the transformation is a CWM relational model which one can publish with the reflexive editor EMF because its plugin is provided with the demo. The result of the transformation of
Output model from SalesRDB.uml
You may modify the names of the input and output model files of the demo in order to use your own models, but you must then modify in the same way the configurator parameters. On the other hand, the URI of the metamodels do not to be changed.
3. THIRD STEP : CWM simulator (with Kermeta)
Now, the last stage is to simulate an instance of the model CWM resulting from transformation ATL with the Kermeta workbench. The transformation generated before becomes the input of our CWM simulator. A prerequisite is the name of the *.relational input file : that must be “out.relational”. If you want used an other name, then you must change the code which load the model file in the Kermeta source cwm.kmt : at the line loadCatalog("../model/out.relational").
There are four source files for the Kermeta part. You can find them in the directory “kermeta” which is at the root of the org.openembedd.basic.uml2cwm.demo project. The files are as follows :
simulator.kmt : generic simulator textual UI
cwm_simulator.kmt : (very simple) CWM simulator for the demo which creates and manipulates
an instance of the given CWM model
rdb_utils.kmt : classes and methods utilities for the CWM simulator cwm.kmt : launcher of the CWM simulator
To launch the simulator, right-click on the "cwm.kmt" file within the "kermeta" file and select the sub-menu "Run As..." in the contextual sub-menu:
to launch Kermata application
Then choose the item "Kermeta App" what causes launching of Kermeta application on our model "CWM relational" (You can alos use the predefined launch configuration, like for the ATL transformation).
After the simulator started you can follow the instructions which appear on the console view and interact with that console to add, remove and print rows of the model tables. Here is an example suite:
For the purpose of the simulation, you should create some other products:
XT16, "another modelling tool", 002
ZB32, "low power models transformer", 003 add customers
"5, Place Vaucanson", Durand, 000002 "18, Rue des Carmes", Duchemin, 000003 add orders
Like for other tables, you are encourage to add some orders:
3 / .F. / 000001/ 001 / 000000000001 (3 XB28 to be delivered to Dupont) 1 / .T. / 000002 / 003 / 000000000002 (1 ZB32 delivered to Durand) 5 / .F. / 000001 / 003 / 000000000003 (5 ZB32 to be delivered to Dupont) select Dupont's orders
Now that you are familiarized with the basic demo, you can look at the code to understand how the tools work, and make your own transformation of model, as declaratory or imperative way, as well as
simulations, or UML and Ecore diagrams with the editors of Topcased.
4. Beyond the present demo
We encourage you go further this basic presentation of OpenEmbeDD platform abilities.
4.1. Play with the demo
The input UML2 model of the demo is a common situation, designed to present in a simple and
understandable way the concepts. You may use the Topcased UML2 graphical editor to draft more complex models about your own domain and see the results.
The ATL transformation embodies only few elements of UML2 and Common Warehouse
Metamodel. You may try to enhance the transformation to give more realism to the database output model.
The database management simulator has been writen to give a first and tight access to the tables.
As the Kermeta code of the simulator is given, feel free to extends its functionnalities and test the ease you could use OpenEmbeDD for your own goals.
4.2. Some possible extensions of the chain
For the purpose of incoming points, imagine the demo tool chain is complete, with deep treatment of constraints and a powerful database simulator. Then the data processed in this chain can be use for other works looking forehead the aimed information system.
Once the input UML2 model relevance has been validate through the database simulator, it could
be use to generate the application code, giving the core part of the system.
It can be possible to embed database technical skills about structures and indexation to optimize
performances of the targetted RDBMS, processing the CWM model in order to produce the SQL code for create the real database in the most efficient way.
A more sophisticated modelling chain
Appendix A. Technical data
1. ATL launch parameters
If the ATL launcher is not configured, you must do it by following the steps below :
firstly verify your basic demo project is open in the workspace
double-click in the right on the ATL Transformation in order to add a new transformation
configurator named by default "New_configuration (1)", and select it
in the top, rename "New_configuration (1)" by "uml2cwm" for the transformation configurator in the first TabFolder "ATL Configuration" side "Project" select the Project name :
"org.openembedd.basic.uml2cwm.demo" in the combo
in the first TabFolder "ATL Configuration" side "Project" select the ATL file which appears :
"org.openembedd.basic.uml2cwm.demo/atl/umlclass2cwmrelational.atl" in the combo
in the first TabFolder "ATL Configuration" side "Metamodels" you have to enter the 2
metamodels of the transformation, the first one uml and the second one cwm (relational part only) :
select the line where Model is uml and click on button "EMF Registry...", a list of
metamodel registry appears, check if URI http://www.eclipse.org/uml2/2.1.0/UML exists and select it and finish by clicking OK; if it doesn't exist, you must install the UML2 prerequisite plugin as seen in 2.3)
select the line where Model is cwm and click on button "EMF Registry...", a list of
metamodel registry appears, check if URI http:///orgomg/cwm/resource/relational.ecore
exists and select it and finish by clicking OK; if it doesn't exist, you must install the demo prerequisite plugin as seen in 2.3)
in the first TabFolder "ATL Configuration" in the sides "Source Models" and "Target Models"
you have to enter the 2 models IN and OUT used in the transformation :
select the IN source model button "Workspace...", a list of projects from your workspace
appears, select in the project org.openembedd.basic.uml2cwm.demo the entry model "SalesRDB.uml" which is in the "model" folder, and finish by clicking OK
select the OUT target model button "Workspace...", a list of projects from your workspace
appears, select in the project org.openembedd.basic.uml2cwm.demo the folder "model" and then write the name of the out model "out.relational" or "SalesRDB.relational" (in case you want keep the same name) in the zone of text in bottom, and finish by clicking OK
finish the configuration of the ATL launcher by clicking on the button "Apply" then on the button
"Run" to run the ATL transformation, normally the file result “out.relational” or
"SalesRDB.relational" is created or updated in the folder “model” project and you can then open it with the refexif editor of CWM
You should obtain the configuration like below: