MOMENT2-MT: Model Transformations with EMF and Maude
MOMENT2-MT constitutes an extension of MOMENT2 that provides support for model-based transformations. The syntax for defining model patterns is
directly based on the QVT Relations language.
MOMENT2-MT reuses MOMENT2's core
functionality for model transformation purposes:
- MOMENT2-MT provides a textual QVT-based language for
defining production rules, where graph patterns are defined as in
the QVT Relations language and attribute values can be queried and
manipulated by means of OCL expressions.
- Support for textual concrete syntax. The grammar of the transformation
language itself is defined as an algebraic signature. A
transformation definition is a term, which is compiled into a Maude module.
Therefore, our framework can be extended with new concepts and
syntax easily.
- Definition of production rules either as equations, to specify
functional behavior, or as rewrite rules, to specify non-deterministic
and possibly concurrent behavior. A MOMENT2-MT transformation definition can
be viewed as a rewrite theory.
- EMF is reused as a metamodeling front-end so that graphical
editors and persistence can be customized easily. At
the time of writing this paper, the EMF concepts that are supported
are: class definition with attributes and references; abstract
classes; class specialization; multiplicity features on references
(but only one-bounded attributes), including ordering and
uniqueness; opposite references; and containment references.
- In MOMENT2-MT, edges are updated automatically when they are
defined as opposite references in the metamodel. On the one hand, if
one of two opposite references is removed, the other one is also
removed. On the other hand, if one of them is updated, the other
one is also updated. In addition, an object in an EMF model can be
the root of a subtree (taking into account containment references).
When an object of this kind is deleted,
all objects in the subtree are
deleted and dangling edges are removed as well. These actions are
carried out automatically by MOMENT2-MT in what we call
consistency checking. MOMENT2-MT permits disabling it when there are no dangling edges.
-
MOMENT2-MT Manual: provides a description of how to install the tool, how to define model transformations and how to execute them. The manual is not up-to-date. In case you need support, please email-me.
-
Short tutorial about the main features of the MOMENT2-MT language. II META Workshop. Cartagena, Spain. 24-25 January 2008.
MOMENT2 can also be executed as a standalone application so that model
transformations can be executed from applications that are external to Eclipse. The standalone version of MOMENT2 can be donwloaded from HERE.
To execute a model transformation, the following files have to be placed
somewhere in the filesystem: Maude binary, MOMENT2 kernel,
and files for the model transformation (including metamodels and
input models). The command to execute a model transformation is as follows:
Usage: jar Moment2CmdLauncher
--os <os> --maude <maude> --logPath <logPath> --logName <logName>
--kernelPath <kernelPath> --transformationName <transformationName>
--t <transformation>
--domainNames domainNames1,domainNames2,...,domainNamesN
--nsPrefixes nsPrefixes1,nsPrefixes2,...,nsPrefixesN
--mm metamodel1,metamodel2,...,metamodelN
--i input1,input2,...,inputN --o output1,output2,...,outputN
--os <os>
Operative system: win9x | winnt | linux | macosx .
--maude <maude>
Path to maude binary.
--logPath <logPath>
Path to log file (without name file).
--logName <logName>
Log file name. The file logPath + "/" + logName will contain a record
of all commands that are sent to Maude to execute the model
transformation.
--kernelPath <kernelPath>
Path to MOMENT2 kernel.
--transformationName <transformationName>
Transformation name.
--t <transformation>
Path to transformation to be executed (file with extension
.gt). This file should be the result of compiling a model
transformation .mgt into MOMENT2 internal format: in Eclipse, option
right click on model transformation file .mgt > MOMENT2 > as MOMENT2
Code (in Maude)
--domainNames domainNames1,domainNames2,...,domainNamesN
List of domains as they appear in the transformation signature.
--nsPrefixes nsPrefixes1,nsPrefixes2,...,nsPrefixesN
List of nsPrefixes as they appear in the transformation signature.
--mm metamodel1,metamodel2,...,metamodelN
Path to metamodels, as they appear in the signature of the model
transformation.
--i input1,input2,...,inputN
Path to input models as they appear in the signature of the model
transformation. Write "none" when no input model should be provided.
For instance, "--i none" for a model transformation with one domain and
no input model.
--o output1,output2,...,outputN
Path to output models as they appear in the signature of the model
transformation. Write "none" when no output model should be provided.
For instance, "--o none, output2" for a model transformation with two
domains, no output model for the first one and an output model for the
second one.
An example containing the files that are needed to execute a model transformation
in standalone mode can be downloaded from
HERE. This file contains:
a folder maude, with the Maude binaries for MAC OS (please download the corresponding
binaries from Maude's web page); a folder kernel,
with MOMENT2's Maude files; and a folder transformation, with an example.
To execute a model transformation with the following
declaration transformation uml2rdbms ( uml : SimpleCD ; rdbms : SimpleDB ) we
use the following command (in MAC OS):
java -jar $PATH/Moment2CmdLauncher.jar
--os macosx
--maude $PATH/maude/maude.intelDarwin
--kernelPath $PATH/kernel
--logPath $PATH/transformation
--logName moment2standalone.log
--t $PATH/transformation/uml2rdbms.gt
--transformationName uml2rdbms
--domainNames uml,rdbms
--nsPrefixes SimpleCD,SimpleDB
--mm $PATH/transformation/metamodels/SimpleCD.ecore,$PATH/transformation/metamodels/SimpleDB.ecore
--i $PATH/transformation/models/input-uml.xmi,none
--o none,$PATH/transformation/models/output-rs.xmi
where $PATH is the absolute path to the folder containing
the folders maude, kernel and transformation.
To run these examples, follow these steps
- Create a MOMENT2-MT project in your eclipse workspace.
- Create a folder within this project and copy the files of the corresponding example there.
- Update the path to the metamodels in the mgt file (right click > MOMENT2 > Add imports). Remove the old references.
- In the Java perspective: create a MOMENT2-MT launch configuration. Select the model transformation, input and output models.
- Run the transformation.
Sierpinski:
- Description of the case study.
- Files:
metamodel,
model transformation,
input model
- To run the Sierpinski transformation up to a certain iteration x, set the property "finalStep" of the "Container" object to x in the input model.
- Deactivate consistency checkings in the launcher configuration.
UML Activity Diagrams To CSP transformation:
Class2Table:
- Description of a very basic example of a model transformation from UML-like classes to relational tables:
- Files:
metamodel,
model transformation,
input model
-
Activate consistency checkings in the launcher configuration.
Class diagrams to relational schemas:
MOMENT2 Update Site
|
|