Information Technology Reference
In-Depth Information
the transformation is done in terms of cycles, conditionals, and
so on.
In imperative programming, computations are described
in terms of statements that change a program state.
Examples of model transformation languages applying
imperative programming are Xtend and Xpand [OAW 09].
Imperative transformation rules define sequences of
commands to perform on source models, and require a
detailed description of the algorithm to be run and the
scheduling of transformation rules. Listing 3.8 presents
an example of a detailed description of the algorithm
to be run and the scheduling of transformation rules to
transform a
Class
element and its
Property
elements.
In line 6, the rule
property2Attribute
is called for
each
Property
in the
Class
being transformed. The rule
property2Attribute
creates an
Attribute
and adds it
to the collection of attributes of the created
Table
element
(line 11).
1 import SimpleClassMetamodel;
2 import SimpleRDBMSMetamodel ;
3
4 create Table class2Table(Class c):
5
this.setName(c .name) −>
6
c . properties.property2Attribute(this) −>
7
this;
8
9 create Attribute property2Attribute(Table t , Property p):
10
this.setName(p.name)−>
11
t . attributes.add( this)−>
12
this;
Listing 3.8.
Example of an imperative model transformation rule
We selected imperative model transformation languages
in the implementation of the application examples we
used through this topic. These are the Xtend and Xpand
languages. One of the reasons we selected imperative model
Search WWH ::
Custom Search