Information Technology Reference
In-Depth Information
Listing 3.6 presents an example of a simple declarative
model transformation rule using the ATL language [JOU 05].
Line 2 states the source and target models. Line 3 presents
the signature of the transformation rule, which creates Table
elements (line 7) from Class elements (line 4). Thus, for
each class in a SimpleClass model, one table is created in a
SimpleRDBMS model. The source and target metamodels (the
class metamodel and the RDBMS metamodel) are specified in
a descriptor file used to execute the rule.
1 module SimpleClass2SimpleRDBMS;
2 create OUT : SimpleRDBMS from IN : SimpleClass;
3 rule Class2Table {
4f r om
5 c: impleClass!Class
6t o
7 t
: impleRDBMS! Table (
8
n a m e < − c . name
9
10 }
Listing 3.6. Example of a declarative model transformation rule
1 import SimpleClassMetamodel;
2 import SimpleRDBMSMetamodel ;
3
4 create Table class2Table(Class c):
5
this.setName(c .name) −>
6
this;
Listing 3.7. Example of an imperative model transformation rule
Listing 3.7 presents an example of the transformation
rule in Listing 3.6 but using Xtend, which is an imperative
language [OAW 09]. Line 1 and line 2 present the required
import torefermetaconceptsintransformationrules.Therule
in line 4 uses a so-called create extension. Create extensions,
as a side effect when called, create an instance of the type
 
Search WWH ::




Custom Search