Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

ATL/User Guide

< ATL
Revision as of 09:57, 13 January 2009 by Unnamed Poltroon (Talk) (An Introduction to Model Transformation)

Contents

Introduction

ATL, the Atlas Transformation Language, is the ATLAS INRIA & LINA research group’s answer to the OMG MOF / QVT RFP. It is a model transformation language specified as both a metamodel and a textual concrete syntax. In the field of Model-Driven Engineering (MDE), ATL provides developers with a mean to specify the way to produce a number of target models from a set of source models.

The ATL language is a hybrid of declarative and imperative programming. The preferred style of transformation writing is the declarative one: it enables to simply express mappings between the source and target model elements. However, ATL also provides imperative constructs in order to ease the specification of mappings that can hardy be expressed declaratively.

An ATL transformation program is composed of rules that define how source model elements are matched and navigated to create and initialize the elements of the target models. Besides basic model transformations, ATL defines an additional model querying facility that enables to specify requests onto models. ATL also allows code factorization through the definition of ATL libraries.

Developed over the Eclipse platform, the ATL Integrated Development Environment (IDE) provides a number of standard development tools (syntax highlighting, debugger, etc.) that aim to ease the design of ATL transformations. The ATL development environment also offers a number of additional facilities dedicated to models and metamodels handling. These features include a simple textual notation dedicated to the specification of metamodels, but also a number of standard bridges between common textual syntaxes and their corresponding model representations.

The present manual aims at providing both an exhaustive reference of the ATL transformation language and a comprehensive guide for the users of the ATL IDE. For this purpose, this manual is organized in three main parts: the first part (Section 2 and Section 3) introduces the main concepts of model transformation and provides an overview of the structure and the semantics of the ATL language. The second part (corresponding to Section 4) focuses on the description of the ATL language while the last part (Section 5) deals with the use of the ATL tools.

The detailed structure of the document looks as follows:

  • Section 2 provides a short introduction to the model transformation area;
  • Section 3 offers an overview of the ATL capabilities;
  • Section 4 is dedicated to the description of the ATL language;
  • Section 5 describes the IDE that has been developed around the ATL transformation language;
  • Section 6 provides ATL programmers with a number of pointers to available ATL resources;
  • Finally, Section 7 concludes the document.

An Introduction to Model Transformation

Models are now part of an increasing number of engineering processes (such as software engineering). However, in most cases, they are still confined to a simple documentation role instead of being actively integrated into the engineering process. As opposed to this passive approach, the field of Model-Driven Engineering (MDE) aims to consider models as first class entities. It also considers that the different kinds of handled items (such as the tools, the repositories, etc.) can be viewed and represented as models. The model-driven approach supposes to provide model designers and developers with a set of operations dedicated to the manipulation of models. In this context, model transformation appears to be a central operation for model handling: it aims to make it possible to specify the way to produce a number of target models based on a set of source models. In the scope of the model-driven engineering, it is assumed that model transformations, as any other model-based tool, can be modelled, which means that they have to be considered themselves as models. This section aims to provide an overview of the main MDE concepts, with a particular focus on model transformation. To this end, it first presents, in [#The Model-Driven Architecture | Section 2.1], the organisation of the model-driven architecture. This first section addresses the model definition mechanisms that constitute the core of the MDE area: it introduces the notions of models, metamodels and metametamodels, as well as the conformance relation that relates these different artefacts. The second part of the section more particularly deals with model transformation. It provides an overview of the conceptual model transformation architecture and detailed the way this conceptual architecture is matched to the ATL language.

The Model-Driven Architecture

Models constitute the basic pieces of the model-driven architecture. Indeed, in the field of model-driven engineering, a model is defined according to the semantics of a model of models, also called a metamodel. A model that respects the semantics defined by a metamodel is said to conform to this metamodel. As an example, Figure 1 illustrates the conformance relation between a Petri net model and the Petri Nets metamodel.

TODO place figure1

TODO place figure2

TODO place figure3

As every model, the described Petri net model is composed of a number of distinct model elements. In the context of a Petri net, these model elements correspond to the places, the transitions and the arcs that compose the model. These different elements, as well as the way they are related, are defined in the scope of the Petri net metamodel. In the same way a model conforms to its metamodel, there exists a relation between the elements of a model and those of its metamodel. This relation, called meta, associates each element of a model with the metamodel element it instantiates. Figure 2 illustrates some of the existing meta relations between elements of the Petri net model and those of the Petri net metamodel. At this stage, it must be recalled that, before being a metamodel, a metamodel is a model. This implies for it to conform to its own metamodel. To this end, the model-driven architecture defines a third modelling level which corresponds to the metametamodel, as illustrated in Figure 3. A metametamodel aims to introduce the semantics that are required to specify metamodels. As a model with its metamodel, a metamodel conforms to the metametamodel. Note that a metametamodel is usually self-defined, which means that it can be specified by means of its own semantics. In such a case, a metametamodel conforms to itself. Several metametamodel technologies are available. The ATL transformation engine currently provides support for two of these existing technologies: the Meta Object Facilities (MOF 1.4) 8 defined by the OMG and the Ecore metametamodel 8 defined by the Eclipse Modelling Framework (EMF) 8. This means that ATL is able to handle metamodels that have been specified according to either the MOF or the Ecore semantics.

Model Transformation

In the scope of model-driven engineering, model transformation aims to provide a mean to specify the way to produce target models from a number of source models. For this purpose, it should enable developers to define the way source model elements must be matched and navigated in order to initialize the target model elements. Formally, a simple model transformation has to define the way for generating a model Mb, conforming to a metamodel MMb, from a model Ma conforming to a metamodel MMa. As previously highlighted, a major feature in model engineering is to consider, as far as possible, all handled items as models. The model transformation itself therefore has to be defined as a model. This transformation model has to conform to a transformation metamodel that defines the model transformation semantics. As other metamodels, the transformation metamodel has, in turn, to conform to the considered metametamodel.

TODO place figure4

Figure 4 summarizes the full model transformation process. A model Ma, conforming to a metamodel MMa, is here transformed into a model Mb that conforms to a metamodel MMb. The transformation is defined by the model transformation model Mt which itself conforms to a model transformation metamodel MMt. This last metamodel, along with the MMa and MMb metamodels, has to conform to a metametamodel MMM (such as MOF or Ecore). ATL is a model transformation language that enables to specify how one (or more) target model can be produced from a set of source models. In other word, ATL introduces a set of concepts that make it possible to describe model transformations.

TODO place figure5

Figure 5 provides an overview of the ATL transformation (Author2Person) that enables to generate a Person model, conforming to the metamodel MMPerson, from an Author model that conforms to the metamodel MMAuthor. The designed transformation, which is expressed by means of the ATL language, conforms to the ATL metamodel. In this example, the three metamodels (MMAuthor, MMPerson and ATL) are expressed using the semantics of the Ecore metametamodel.

Overview of the Atlas Transformation Language

ATL module

Structure of an ATL module

Header section

Import section

Helpers

Rules

Module execution modes

Normal execution mode

Refining execution mode

Module execution semantics

Default mode execution semantics

Refining mode execution semantics

ATL Query

Structure of an ATL query

Query execution semantics

ATL Library

The ATL Language

Data types

OclType operations

OclAny operations

The ATL Module data type

Primitive data types

Boolean data type operations

String data type operations

Numerical data type operations

Examples

Collection data types

Operations on collections

Sequence data type operations

Set data type operations

OrderedSet data type operations

Bag data type operations

Iterating over collections

Examples

Enumeration data types

Tuple data type

Map data type

Model element data type

Examples

ATL Comments

OCL Declarative Expressions

If expression

Let expression

Other expressions

Expressions tips & tricks

ATL Helpers

Helpers

Attributes

Limitations

ATL Rules

ATL imperative code

The assignment statement

The if statement

The for statement

Current limitations

Matched Rules

Source pattern

Local variables section

Simple target pattern element

Iterative target pattern element

Imperative block section

Called Rules

ATL Queries

ATL Keywords

ATL Tips & Tricks

The ATL Tools

Installation

Perspectives

ATL perspective

Navigator

Editors

Outline

Problems

Properties

Error Log

Console

ATL Debug perspective

Debug

Variables

Breakpoints

Editors

Outline

Console

Tasks

AM3 perspective

Programming ATL

Creating an ATL project

Designing metamodels with KM3

Creating an ATL file

The ATL File Wizard

Creating an ATL file from scratch

Compiling an ATL file

Setting up an ATL run launch configuration

The ATL Configuration tab

The Model Choice tab

The Common tab

Running an ATL launch configuration

Debugging ATL

Managing breakpoints

Setting/Removing breakpoints

Activating/Deactivating breakpoints

Limitations

Creating an ATL Debug launch configuration

Running an ATL Debug launch configuration

Debugging actions

Displaying variables values

Additional ATL Resources

ATL developers, beginner as confirmed ones, should find in the present manual answers to most of the problems they may encounter while either programming ATL modules or interacting with the ATL development environment. However, there exist a number of additional ATL resources that provide detailed information on specific aspects of ATL. This section provides the ATL developers with a list of these available ATL resources.

Before starting using the ATL tools, developers are encouraged to consult the ATL Installation Guide [16]. This guide describes the step-by-step procedures corresponding to the different available installation modes (e.g., from source code or binaries).

After having installed ATL for the first time, beginner developers may feel a little bit confused with the different concepts and technologies on which ATL relies on. The ATL Starter’s Guide [12] has been designed for these beginner developers: it presents the step-by-step design of a very simple ATL transformation. It progressively introduces, in this scope, the different functionalities of the ATL IDE.

A number of ATL transformation examples, from varied fields (such as build tools, bug tracking systems, etc.), are available on the GMT web site [17]. This set of transformations illustrates the use of the different ATL capabilities. They can be executed as standalone transformations, but also be integrated in larger transformation chains. Also available from the GMT web site, the Atlantic Zoo provides a collection of more than one hundred metamodels specified by means of the KM3 textual notation. These metamodels can be used for the design of new ATL transformations.

Note that a specific template has been designed to provide a standard scheme for the description of transformations [20]. Developers sharing the transformations they develop are strongly encouraged to use this template to specify their transformations.

Available ATL documentation also includes the specification of the ATL virtual machine [21]. This specification details the set of instructions on which the ATL virtual machine implemented by the ATL IDE is based. It also describes the way the ATL compiler generates the ATL bytecode contained in ASM file from the code specified in .atl files. This specification can be used as a reference for developers that are interested in developing an alternative ATL engine.

The KM3 user manual [14] provides an overview of the Kernel MetaMetaModel language. KM3 is a textual notation dedicated to the specification of metamodels. This user manual describes both the language textual syntax and its semantics.

Finally, there exists an ATL discussion board [22] enabling the ATL community to share information about the ATL language and its dedicated development environment. This board is in particular used to announce the new ATL releases.

Conclusion

TODO check relevance

This manual introduces both the ATL transformation language and the development environment that was designed for it. In a first part, the document proposes a brief overview of the model transformation area in which it introduces the model transformation concepts that are used in the rest of the manual. In a second part, it provides the complete reference of the ATL language, describing the syntactic structure of the different types of ATL units (e.g., ATL modules, queries and libraries). It also provides a comprehensive overview of the execution semantics of these different units. The last part of this manual was dedicated to the description of the ATL development environment.

The reader may have note that both the ATL language and its associated development environment still suffer from some limitations. As an example, the ATL compiler does not enable developers to define helpers or attributes in the context of a collection type. In the same way, the provided debugger does not allow developers to navigate the content of the attributes defined in the context of the ATL module. There however exist some on-going development efforts that aim to correct know problems and limitations of both the language and its development environment. Further developments will also provide new functionalities, in particular by extending the capabilities of the AM3 (ATL MegaModel Management) component. ATL developers are therefore encouraged to keep aware of the ATL actuality by means of the ATL discussion board. New releases of versions, of resources (transformation examples, metamodels, etc.) and documentations are therefore prioritary announced onto this dedicated discussion board.

References

TODO replace in text by direct links if necessary

[1] OMG/MOF Meta Object Facility (MOF) 1.4. Final Adopted Specification Document. formal/02-04-03, 2002.

[2] OMG/RFP/QVT MOF 2.0 Query/Views/Transformations RFP. October 2002.

[3] Allilaire, F., Idrissi, T. ADT: Eclipse Development Tools for ATL. EWMDA-2, Kent, September 2004.

[4] Budinsky, F., Steinberg, D., Ellersick, R., Grose, T. Eclipse Modeling Framework, Chapter 5 ”Ecore Modeling Concepts”. Addison Wesley Professional. ISBN: 0131425420, 2004.

[5] Budinsky, F., Steinberg, D., Ellersick, R., Grose, T. Eclipse Modeling Framework. Addison Wesley Professional. ISBN: 0131425420, 2004.

[6] The ATL Book to Publication transformation. Available at http://www.eclipse.org/gmt/atl/atlTransformations/.

[7] OMG/OCL Object Constraint Language (OCL) 2.0. OMG Final Adopted Specification. ptc/03-10-14, 2003.

[8] Java regular expressions. Available at http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html#sum.

[9] Java Map interface. Available at http://java.sun.com/j2se/1.4.2/docs/api/java/util/Map.html.

[10] The ATL EMF to KM3 transformation. Available at http://www.eclipse.org/gmt/atl/atlTransformations/.

[11] The Eclipse project. http://www.eclipse.org/.

[12] The ATL Starter’s Guide. Available at http://www.eclipse.org/gmt/atl/doc/.

[13] The netbeans Metadata Repository (MDR) project. http://mdr.netbeans.org/.

[14] The Kernel MetaMetaModel (KM3) Manual. Available at http://www.eclipse.org/gmt/atl/doc/.

[15] The Atlas MegaModel Management project. http://www.eclipse.org/gmt/am3/.

[16] The ATL Installation Guide. Available at http://www.eclipse.org/gmt/atl/doc/.

[17] The Generative Model Transformer (GMT) project. http://eclipse.org/gmt/.

[18] Gentleware. Poseidon for UML. Available at http://gentleware.com/index.php.

[19] OMG/XMI XML Model Interchange (XMI) OMG Document AD/98-10-05, October 1998.

[20] The ATL transformation description template. Available at http://www.eclipse.org/gmt/atl/doc/.

[21] Specification of the ATL Virtual Machine. Available at http://www.eclipse.org/gmt/atl/doc/.

[22] The ATL mailing list. http://groups.yahoo.com/group/atl_discussion/.


Appendix A - The MMAuthor metamodel

Appendix B - The MMPerson metamodel

Appendix C - The Biblio metamodel

Appendix D - The Table metamodel

Back to the top