Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "VIATRA2/Ecore2Genmodel"

(Description)
(Manual execution)
Line 31: Line 31:
 
=== Manual execution  ===
 
=== Manual execution  ===
  
Execute transformation step-by-step using the source files found under the models directory in the [[http://mit.bme.hu/~ujhelyiz/viatra/ttc10-site/plugins/hu.bme.mit.viatra2.genmodelexport_1.0.0.201006171404.jar hu.bme.mit.viatra2.genmodelexport]] plugin (included in the update site as well):
+
Execute transformation step-by-step using the source files found under the models directory in the [http://mit.bme.hu/~ujhelyiz/viatra/ttc10-site/plugins/hu.bme.mit.viatra2.genmodelexport_1.0.0.201006171404.jar hu.bme.mit.viatra2.genmodelexport] plugin (included in the update site as well):
  
 
0. Switch to VIATRA2 Perspective
 
0. Switch to VIATRA2 Perspective

Revision as of 05:50, 13 July 2010

Ecore2GenModel Transformation

This page is dedicated to the TTC 2010 Ecore2GenModel case study solution implemented in VIATRA2.

Description

The built-in EMF GenModel generator transformation is able to propagate changes of the source Ecore model to the generated GenModel, whoever in some cases (when the source model changes are too many) this consolidation fails and all previous data existing only in the GenModel are lost as a new GenModel is created. In the case study, EMF annotations are used in the source Ecore model for storing specific GenModel information and a new transformation is required that is able to generate a GenModel using the annotations from the Ecore model.

EMF annotations have a source and a details part, where the source is a character string describing the group of entries which are included in the details part. The details part contains an arbitrary number of entries (key-value pairs). In this case, annotations with "emf.gen" source are identified as GenModel information, while the key of an entry is equal to the name of the attribute in the GenModel metamodel (e.g. basePackage for GenModel).

For more details on the problem and solution, check the case study description and our short paper

Try it in SHARE

SHARE is a hosted demonstration platform where tools prepared in dedicated virtual machines can be accessed through remote desktop connection.

To try our solution in SHARE, go here.

Installation

The solution can be easily installed into an Eclipse (3.5+) using our dedicated update site. After selecting all the features, the plugin dependencies are automatically resolved, as long as you have the default Eclipse update site (Galileo/Helios) and have the "Contact all update sites..." enabled.

Fig. 1: Install Ecore2Genmodel from Eclipse Update Site

Execution

Select an arbitrary Ecore model (.ecore file) in the Navigator view, right-click to bring up the local menu and click on "Generate GenModel". The resulting .genmodel file is created and can be opened with the inbuilt EMF editors.

Fig. 1: Execute Ecore2Genmodel transformaton

Manual execution

Execute transformation step-by-step using the source files found under the models directory in the hu.bme.mit.viatra2.genmodelexport plugin (included in the update site as well):

0. Switch to VIATRA2 Perspective

1. Open nemf-meta.vpml

2. Drag and drop ecore2genmodel_cropped.vtcl file on the model space in the VIATRA2 Model spaces view (lower left corner)

3. Right-click on the model space in the same view and select "Native importers" and "Ecore Instance importer"

4. Select the desired Ecore file to import. The created model appears under nemf.resources in the model space.

5. Right-click ecore2genmodel below Program Models (VIATRA2 Model spaces view) and select "Run..."

6. Select the Ecore package to transform below nemf.resources and click "Select Model Element"

7. Enter additional properties (Model name and pluginID) then click OK. Use space or semicolon to separate parameters.

8. The GenModel model is created under nemf.resources using the model name and "_genmodel".

9. Right-click on the model space again, select "Contributions" and "Export GenModel"

10. Select the folder and name for the .genmodel file

11. Input the name of the created GenModel model and click OK.

Note: Export works only with the last imported model (due to a reqiured reference to the original Ecore resource)

Interesting points of the transformation

Metamodels

The solution uses 3 modeling levels which are:

  • Ecore metametamodel for defining the possible types and relations in Ecore metamodels
  • Ecore/GenModel metamodel for describing Ecore and GenModel models.
  • Ecore and GenModel model instances which are the inputs and outputs of the transformation.

Note that the metamodel of Ecore is Ecore as well, thus the metametamodel and the Ecore metamodel are identical apart from the fact that elements in the first have VPM types while in the second they are instances of the first.

Import/Export

Ecore models are instances of the Ecore metamodel and are imported into the model space using the generic EMF importer available from the extras update site. Export is done by a GenModel exporter plugin, though a generic EMF exporter is planned later.

Transformation

Back to the top