Today, Massimo Tisi explains the basic principles of Higher-Order Transformations. The growing popularity of the transformational approach in Model-Driven Engineering (MDE) caused the birth of a vast number of model transformations organized in complex patterns. Model transformations are the common technological means to automatically manipulate and evolve models both at development time and at runtime.
When transformations are a central artifact of the software production and structure, the idea of transformation manipulation naturally arises. We will often need to automatically generate, adapt, or analyze transformation rules. For instance, starting from a high-level mapping between two types of models (e.g. a class diagram and a database relational model) we could generate an ATL transformation that, when executed, takes class diagrams as input and transforms them into relational schemas according to the mapping information. Another example would be a transformation manipulation component that automatically adapts transformations that become obsolete after changes in the input or output metamodels (many more examples in the paper linked at the bottom of this post).
These transformation manipulations can, of course, be implemented by means of several technologies orthogonal to MDE, like program transformation or aspect orientation. The elegance of the MDE paradigm allows using the same transformation infrastructure also for transformation manipulation, by considering model transformations a particular kind of model. The transformation is represented by a transformation model that conforms to a transformation metamodel. Just as any other model can be created, modified, augmented by a transformation, a transformation model can itself be instantiated, modified, etc, by a so-called Higher-Order Transformation (HOT). This uniformity has several benefits: especially it allows reusing tools and methods, and it creates a framework that can be applied recursively (since transformations of transformations can be transformed themselves).
In the following figure we show the typical schema of a HOT for transformation modification in ATL:
- Transformation injection. The textual representation of the transformation rules is translated into a model representation. The generated model conforms to the ATL metamodel.
- Higher-order transformation. The transformation model is the input of a model transformation that produces another transformation model. The input, output, and HOT transformation models all conform to the same ATL metamodel.
- Transformation extraction. Finally, an extraction is performed to serialize back the output transformation model into a textual transformation code.
Unfortunately, HOT development is not as easy as I depicted it. HOT code is made complex by the fact that the metamodel of transformation languages is usually pretty big and transformation models look similar to abstract syntax trees, with several containment levels.
To approach the problem of facilitating HOT development, we started by identifying groups of similar HOT applications and gathering real-world examples for each one of them. Now our research effort is aiming at providing the user of reusable HOT libraries and patterns, and at tailoring the ATL transformation language for more direct support of its own models. You can learn more about our work in this area in these two papers:
- On the use of Higher-Order Model Transformations – ECMFA’09 and
- Improving Higher-Order Transformations Support in ATL – ICMT’10
ICREA Research Professor at Internet Interdisciplinary Institute (UOC). Leader of the SOM Research Lab focusing on the broad area of systems and software engineering. Home page.