• Non ci sono risultati.

2.5 Technical background

2.5.4 Transformation technologies

This section summarizes the surveyed technologies found in literature.

Java Java is one of the most important programming languages based on object orient paradigm. Java may be also used to implement transformations between source and target languages. Despite the power of Java, specific transformation languages are preferred because they provide a range of useful features which facilitate writing, understood and execution of the transformation.

ATL ATL stands for Atlas Transformation Language, created by the ATLAS INRIA & LINA research group. It is the answer to the OMG MOF and to QVT.

It is a model transformation language specified both as a meta-model and as a textual concrete syntax. It is a hybrid language since it is possible to define declarative and imperative statements. Most of the rules written by using ATL are declarative, which means that mappings can be expressed simply. Despite the declarative way is preferred, imperative constructs are provided in order to manage situations too complex to be dealt by means of also declarative rules.

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. The structure of an ATL program is composed by four parts: Header, Import, Rules and Helpers. The header contains the transfor-mation name and the declaration of both source and target model. The import section is used to import definition specified by other ATL modules. This can be done by using the keyword “uses” followed by the library name. Rules section is the core of ATL file because it contains the transformation rules. Each rule defines source patterns, the element type of the source model to be transformed, and the target pattern, used to generate a portion of the target model. ATL sup-ports the definition of helpers: a helper is used to declare functions and global variables used by the transformation rules. Helper functions are written by using the OCL language.

In the pattern depicted in Figure 2.8, a source model Ma is transformed into a target model Mb, according to the rules defined in the transformation Mt. The transformation can be seen as model since it is software. Source and target mod-els, as well as the transformation definition are conforming to their respective meta-models: MMa, MMb and MMt. All meta-models in this example are con-forming to MOF meta-meta-model (obviously this relationship is not strictly nec-essary; other meta-meta-models are of course usable). This schema is general enough to be adopted by all other transformation languages. ATL, as mentioned before, is a mixed language which contains declarative and imperative parts, nevertheless, the ATL philosophy encourages the use of the declarative style in

FIGURE 2.8: ATL transformation schema (from http://help.

eclipse.org)

specifying transformations. However, sometimes it is difficult to provide a solu-tion completely declarative in a transformasolu-tion problem. In this case it is possible to use characteristics of the imperative language. ATL transformations are uni-directional, source models are read-only and the transformations produce write-only destination models. The implementation of a bidirectional transformation makes it necessary to realize a pair of transformations, one for each direction. An ATL rule, can be composed by several sections containing declarative or impera-tive statements. Among these sections, the most important are the source pattern, representing the element of the source model from which generate the target one, the target pattern, that specifies the way in which the target element is constructed and the do pattern, that allows to put the imperative code, when necessary. On the basis of the contained patterns several kind of rules can be distinguished; in particular the widely used are the matched rules, the called rules and the lazy rules. A matched rule specifies the way target model elements can be generated from source model. They are triggered every time the elements specified in the source pattern are matched in the source model. Matched rules, can be composed by both of the above mentioned patterns. The called rules, are instead rule that can contain only target and do patterns. In fact, they are similar to the methods of a general purpose language: a called rule allows to explicitly generate target model elements from imperative code inserted in a do pattern. Finally lazy rules are matched rules whose to pattern is called from another ATL rule.

QVT QVT stands for Query/View/Transformation and it is a language for model transformation reated and standardized by OMG. Due to OMG deriva-tion, QVT includes both MOF 2.0 and OCL 2.0 specifications. As ATL previously described, this language is hybrid (declarative and imperative). With QVT are provided three different transformation languages:

• QVT-Core which is a declarative language designed to be simple and to be used on QVT Relations target model. Due to the not fully specified nature of QVT-Core, QVT-Relational is more expressive.

• QVT –Operational which is imperative transformation defined for writing unidirectional transformations;

• QVT – Relations, which provide declarative transformations. The trans-formation written by using QVT-Relational can be both unidirectional and bidirectional.

Compared to ATL QVT languages do not permit M2T transformations, since each model must conform to MOF 2.0 metamodel. M2T transformations are be-ing standardised separately by OMG in MOFM2T standard [75].

ETL ETL stands for Eclipse Transformation Languages and provides M2M trans-formation language features to Epsilon. ETL allows standard operations of a transformation language but also other advanced features like manipulation, navigation and query of both source and target model. ETL is a hybrid language that implements a mechanism composed by declarative definition of rules but also inherits the imperative features to handle complex transformation which can’t be addressed with a declarative language. ETL is similar to ATL because it is organized in modules (named EtlModule). A module contains a number of transformation rules. Each rule has a unique name and has specified both source and target model. A transformation rule can extend other transformation rules with different mechanisms (called lazy, primary or abstract). EtlTransfor-mation defines a block statement in which is collocated the logic for populating the property values of the target model elements. ETL allows defining pre e post statements that can be executed before or after the transformation rule [58].

Text-based transformations The expression “text-based transformation” de-notes a transformation which transforms an input document written according a text-format in an output document written according a different format. An

example of text-based transformation language is XML transformation language which allows transforming an XML document in another XML document or in HTML document. Examples of XML transformation language are XSLT, which is a W3C recommendation or XQuery which is a standard de facto used by Oracle, Microsoft etc.

Acceleo Despite Acceleo is not properly a technology for model-to-model trans-formation, it has become a leading technology for generation of text from a model conformant both to Ecore based language and both to annotated UML.It is based on the template-based paradigm in which the user creates text templates in which some parts can be dynamically defined on the base of some model query.

Since its launch, Acceleo has become a widespread solution in model driven en-gineering processes [3].

Chapter 3

An interoperable framework for testing automation

Verification of functional requirements of safety-critical control systems requires an high effort, in order address recommendations of international standards. Ac-cording to the discussion in Chapter1, to support verification processes, by auto-mated solutions, is a key factor for achieving lower effort and costs and reducing time to market.

This chapter describes the methodology defined and followed for to the de-velopment of the automatic test case generation approach. In particular, such methodology can be collocated in a wider verification process related to the sys-tem level testing of railway control syssys-tems. The general verification process has been defined in order to address the needs of the ARTEMIS CRYSTAL project, which tackles the challenge to define Interoperability Specifications (IOSs) for the development of an European standard supporting the entire life cycle of safety-critical control systems. According to this, the chapter presents also an overview of the CRYSTAL project clarifying how thesis purposes are partially involved in the verification process defined by the CRYSTAL project. Moreover the high-level architecture of the test case generation framework resulting from the methodology is provided and discussed.