Download ATL User Manual - first version

Transcript
Content
1
Introduction ................................................................................................................................................. 1
2
An Introduction to Model Transformation ............................................................................................... 2
3
2.1
The Model-Driven Architecture ........................................................................................................... 2
2.2
Model Transformation ......................................................................................................................... 3
Overview of the Atlas Transformation Language .................................................................................... 5
3.1
ATL module.......................................................................................................................................... 5
3.1.1
Structure of an ATL module ........................................................................................................... 5
3.1.1.1
Header section ....................................................................................................................... 5
3.1.1.2
Import section ........................................................................................................................ 6
3.1.1.3
Helpers................................................................................................................................... 6
3.1.1.4
Rules ...................................................................................................................................... 7
3.1.2
Module execution modes ................................................................................................................ 9
3.1.2.1
Normal execution mode......................................................................................................... 9
3.1.2.2
Refining execution mode ....................................................................................................... 9
3.1.3
Module execution semantics ......................................................................................................... 11
3.1.3.1
Default mode execution semantics ...................................................................................... 11
3.1.3.2
Refining mode execution semantics .................................................................................... 12
3.2
ATL Query.......................................................................................................................................... 12
3.2.1
Structure of an ATL query ............................................................................................................ 12
3.2.2
Query execution semantics............................................................................................................ 13
3.3
4
ATL Library ....................................................................................................................................... 13
The ATL Language ................................................................................................................................... 14
4.1
Data types .......................................................................................................................................... 14
4.1.1
OclType operations ....................................................................................................................... 15
4.1.2
OclAny operations ........................................................................................................................ 15
4.1.3
The ATL Module data type ........................................................................................................... 16
4.1.4
Primitive data types....................................................................................................................... 17
4.1.4.1
Boolean data type operations............................................................................................... 17
4.1.4.2
String data type operations .................................................................................................. 17
4.1.4.3
Numerical data type operations ........................................................................................... 18
4.1.4.4
Examples ............................................................................................................................. 19
4.1.5
Collection data types ..................................................................................................................... 20
4.1.5.1
Operations on collections..................................................................................................... 20
4.1.5.2
Sequence data type operations............................................................................................. 21
4.1.5.3
Set data type operations ....................................................................................................... 21
4.1.5.4
OrderedSet data type operations .......................................................................................... 22
4.1.5.5
Bag data type operations...................................................................................................... 22
4.1.5.6
Iterating over collections ..................................................................................................... 23
4.1.5.7
Examples ............................................................................................................................. 24
4.1.6
Enumeration data types ................................................................................................................. 25
4.1.7
Tuple data type.............................................................................................................................. 26
4.1.8
Map data type................................................................................................................................ 26
4.1.9
Model element data type ............................................................................................................... 27
4.1.9.1
Examples ............................................................................................................................. 27
4.2
ATL Comments................................................................................................................................... 28
4.3
OCL Declarative Expressions............................................................................................................ 28
4.3.1
If expression .................................................................................................................................. 28
4.3.2
Let expression ............................................................................................................................... 29
4.3.3
Other expressions .......................................................................................................................... 30