November 17, 2007


This post is about MOF QVT (Query/View/Transformation), a model transformation language we also discussed in the course of our seminar (November 15, 2007). First of all lets briefly explain these three terms:

  • A query basically is an expression evaluated over a model. OCL is a prominent example of a query language that we will discuss in a future post.

  • A model completely derived from another model is called a view. Mostly views are not persistent and cannot be changed independent from their base model.

  • A program that generates a target model from a source model is called a transformation.

The focus of MOF QVT is clearly on transformations.

Transformations can be classified in several ways. We describe some providing examples at the same time:

  • horizontal vs. vertical: In contrast to horizontal transformations a vertical transformation changes the level of abstraction. Examples: class diagram to relational database schema (horizontal), model to code (vertical)

  • unidirectional vs. bidirectional: Direction of the transformation and the way how changes can be propagated

  • input/output cardinalities: number of input and output models

Similar to programming languages different paradigms are possible to describe a model transformation: operational (the sequence of steps necessary to produce the result) and declarative (only relationships between model elements are described). QVT follows a hybrid approach, i.e. both paradigms are supported.

The abstract syntax of QVT itself is defined using MOF. However, in the specification a textual as well as a visual notation for the definition of a transformation are given.

We cannot introduce these languages here in detail, however, we provide a short teaser (taken directly from the specification, chapter 7):

relation UML2Rel {
  checkonly domain uml1
    c:Class {name = n, attribute = a:Attribute{name = an}}
  checkonly domain r1
    t:Table {name = n, column = col:Column{name = an}}

This is an excerpt from the classical example, the transformation of a class diagram to a relational database schema, a relational description of the mapping between a class and a table. Visually this can be expressed as shown in the image on the left side.

QVT is a very new language so tool support is quite limited up to now. The operational part is implemented e.g. in the tool SmartQVT. In the next post I will shortly introduce ATL, the ATLAS transformation language, that is not a QVT implementation but that provides a very mature and widely-used model transformation language on its own.

At the moment there is a lot of discussion on how to bring together graph transformation (see, e.g., my introductory post about Graph Transformation) and QVT. I will discuss this together with the introduction of triple graph grammars in a later post.

Further reading:

No comments: