Chapter 1. Introduction to the Ecore MDK

The Model Development Kit for Kermeta contains various kind of codes that work with Ecore models: some helper classes and some transformations.

[Tip]Tip

To use them you simply have to add the corresponding require statement to your kermeta code. Then, the outline and the KermetaDoc views should help you to use its content.

1.1. Short description of the available require

Ecore MDK available files

Currently, the MDK provides the following files :

require "http://www.eclipse.org/emf/2002/Ecore"
This is the Ecore metamodel itself, without behavior. All other files have a direct or indirect dependency to that one.
require "platform:/plugin/fr.irisa.triskell.kermeta.ecore/src/kermeta/ecore_behavior.kmt"
This file adds the behavior on all metaclasses of Ecore metamodel.
require "platform:/plugin/fr.irisa.triskell.kermeta.ecore/src/kermeta/helpers/EcoreHelper.kmt"
This file contains some helper classes for loading Ecore models, retreiving elements in the Ecore model (by name for example), adding EAnnotation to the model, ...
require "platform:/plugin/fr.irisa.triskell.kermeta.ecore/src/kermeta/helpers/EPackageHelper.kmt"
This file contains some helper operations for manipulating EPackage. Ex: obtaining the root package, obtaining the qualified name of the package, ....
require "platform:/plugin/fr.irisa.triskell.kermeta.ecore/src/kermeta/transformations/Patterns4Ecore.kmt"
This file contains a transformation class that allows to transform your Ecore model and apply Design Patterns to it. Provided Design Pattern (and variants) are : Visitor, Command, Builder and Observer.
require "platform:/plugin/fr.irisa.triskell.kermeta.ecore/src/kermeta/transformations/ContainmentBasedActionPerformerGenerator.kmt"
This file contains a transformation class that allows to generate a visitor to traverse the EReferences that are isComposite by using the Aspect way. The result is a kmt file containing the architecture to perform actions (function type passed in parameter) during the traverse of a model.
require "platform:/plugin/fr.irisa.triskell.kermeta.ecore/src/kermeta/transformations/CleanEcoreKMAnnotations.kmt"
This file contains a transformation class that allows to remove all EAnnotation in the ecore model that may have been introduced by kermeta2ecore transformation.
require "platform:/plugin/fr.irisa.triskell.kermeta.ecore/src/kermeta/ecore2dot/ecore2dot.kmt"
This file contains an experimental transformation class that allows to produce the text of a dot file for producing a graphical representation of the ecore model.
require "platform:/plugin/fr.irisa.triskell.kermeta.ecore/src/kermeta/persistence/EcoreResource.kmt"
This file adds some capabilities to the EMFRepository in order to support RegisteredEcoreResource. This kind of Resource allows to load an ecore model from Eclipse registry. Note that his resource is readonly, changes in this won't be saved.

1.2. Using Ecore behavior aspect

Kermeta Ecore MDK main part consist of the implementation of Ecore behavior in kermeta. Almost all operations and derived properties are available.

To use it, you simply have to add this require statement to your kermeta code :

require "platform:/plugin/fr.irisa.triskell.kermeta.ecore/src/kermeta/ecore_behavior.kmt"
		
[Note]Note
In the current implementation of the derived properties with a multiplicity greater than 1, you'll get a new collection with the desired content. However, even if you can modify the elements themselves, these collections aren't the real container of the elements, if you modify it (adding or removing elements) the real attributes (from which the derived properties are calculated) won't be changed.