Tuesday, October 03, 2006

Model Transformation by Commands

sformation by Commands


Model Transformation by Commands
Pablo Tomas Borda
Pablote.20@gmail.com

Abstract


Editing model transformations is actually a hard task. There are still not ways to edit transformations without knowing the source and target meta-models. This is a job about that.
We provide a new point of view on models to abstract the model transformation engineer from meta-models. There are actually different techniques around for model transformations like, by example, or using graphs, or just by code, like QVT. The problem is that none of this techniques, abstract model transformation engineers from source and target meta-models. So editing
transformations is actually a difficult task. In this paper we present a new paradigm to make model transformation an easy job, so that any person being or not a programmer are able to edit their transformations so easy, that they do not need to know meta-models existed.

How to think about models

Most today’s model editors, view and store their meta-model instances structure in formats like XMI, or just XML. We see models by what they really are. Thus, when we wish to transform one model into another, we need to understand the source and target meta-models, there is no way. To separate model transformation engineers from meta-models and those difficult to process composite structures, we add a new layer, we see models as a set of sequential commands to an editor A.

Let’s suppose the following example:

Fig 1. An UML editor showing two classes and a relation between them.

Our today’s point of view says that we have a class ShoppingCart, a class Items, and there is a one to many relationship between them. The editor stores this sample model in that composite structure.
The point of view we introduce, sees our sample model as a set of commands to its editor, as follows:

Model Transformation by Commands Model Transformation by Commands Model Transformation by Commands

These three commands were executed by editor A when user clicked on the corresponding buttons. Thus, if we stored these sequential commands in a file in place of the model composite structure, when we open this model again, the editor is able to rebuild the model, sequentially running the stored commands, like in a log.
Now let’s suppose another example with a database diagram editor:













Fig 2. Sample Database Diagram
Editor

The corresponding database editor’s commands to create the sample model may be:

How do we think about transformations?

Think about the last two sample model editors, their diagrams are very similar, so we can derive from the UML diagram to the Database diagram by just establishing a correspondence between commands and not talking with difficult to understand meta-models.

Fig 3. Correspondences between commands generated
by both previous sample models.

Our transformation becomes a simple to understand correspondence between sequential commands and not difficult to understand meta-model elements. Let’s suppose we have the first UML sample diagram and we want to get the Database diagram. We open the transformation, that is a set of correspondences between commands and when ran with the UML diagram as input, generates the editor commands to build the Database diagram. To be able to generate this we may edit correspondences between commands as following:



Fig 4. This is a sample definitioin of a transformation rulo of a UML Class into an Entity from a Database diagram.

When user opens the transformation editor, selects from both input and output meta-model toolbars the commands they want to represent in the output meta-model's editor. The editor brings them up and allows user to click on one or more buttons from source, one or more buttons from target, drag and drop and perform operations on attributes, in order to define a transformation rule. When user considers transformation rule is done, adds it to the set of transformation rules that make up a single transformation
In that way we edit transformations without seeing anything of the meta-model.


Models and Transformation Meta/Models


What we get for free

We get the reverse transformation! For free! If we have a database diagram we can easily get back the UML diagram by just using the same transformation backwards.