Chapter 7. Transformations

The workbench provides several additional tools available directly on the files using the popup menu.

[Important]Important

Several of the wizards provided are multipages wizards. This means that several advanced options are available only after clicking on "Next" instead of clicking on "Finish". So if you get an error while transforming a file, make sure that none of the options (on the main page or on the "Next" pages) fix the default behavior for your special need.

7.1. Actions for Ecore files

  • Export functions: On ecore file you can export it into a KM (kermeta program in xmi format) or in kmt (Kermeta program using its textual syntax). As the ecore model may not be valid, the wizard provides some quick fixes. Those quick fixes will for example detect and propose a default solution for multiple operations with the same name.

Ecore to Km transformation

Figure 7.1. Ecore to Km transformation


Ecore to Kmt transformation

Figure 7.2. Ecore to Kmt transformation


  • Merge function: You can merge several ecore files, simply select them and click "merge". Its algorithm is base on the names of the packages and classes.

  • Register/Unregister EPackages function: You can register or unregister in the EMF registry the EPackages defined in an Ecore model, simply select them and right-click "Register" or "Unregister".

Actions on ecore model

Figure 7.3. Actions on ecore model


7.2. Actions for kmt files

  • From a kmt files you can export it to an ecore file. Each of the kermeta notion that don't have a specific representation in ecore are stored into ecore annotations that will allow to roundtrip back to kermeta.

Kmt to Ecore transformation

Figure 7.4. Kmt to Ecore transformation


  • The kmt file can also be exported into its model version (ie. Into a XMI file conformant to kermeta metamodel). This is useful as this process also typecheck the model and thus allow to save some time when loading other file which rely on the km version rather than the kmt version.

Kmt to Km transformation

Figure 7.5. Kmt to Km transformation


7.3. Actions for km files

  • From a km files you can export it to an ecore file. Each of the kermeta notion that don't have a specific representation in ecore are stored into ecore annotations that will allow to roundtrip back to kermeta.

Km to Ecore transformation

Figure 7.6. Km to Ecore transformation


  • You can also prettyprint this model representation of a kermeta program into the textual representation of this program.

Km to Kmt transformation

Figure 7.7. Km to Kmt transformation


7.4. Traceability

For many of those transformations, the wizard will propose you to store the traceability informations.

This is a special metamodel that stores a link between the sources elements and the target element so you can reuse it later. For example, it will help the debugger to retrieve the correct line in the text version of the source file even if you are running the km version.

This metamodel is very generic and can be used for any model.