<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Model Transformations powered by Rewriting Logic ?</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Francisco J. Lucas</string-name>
          <email>fjlucas@um.es</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Ambrosio Toval</string-name>
          <email>atoval@um.es</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Software Engineering Research Group Department of Informatics and Systems University of Murcia</institution>
          ,
          <country country="ES">Spain</country>
        </aff>
      </contrib-group>
      <fpage>41</fpage>
      <lpage>44</lpage>
      <abstract>
        <p>This paper shows a rigorous approach based on algebraic specications and rewriting logic which makes up for the lack of current transformation languages and oers a balanced rigour-versus-intuition framework for model transformation, focusing on the MDA-QVT standards. To illustrate this approach, an example and some formal applications of these specications are sketched.</p>
      </abstract>
      <kwd-group>
        <kwd>Model Transformation based on a Rewriting Logic</kwd>
        <kwd>Approach</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        In recent years, the profound impact of the Model Driven Architecture (MDA)
proposal [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], promoted by the OMG as architecture for software development,
has meant that the model transformation becomes a very active research and
development direction. Within this scope, OMG also published the QVT
standard [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], a language for the specication of model transformations within the
MDA scope. Since transformations guide the whole software development cycle,
it is crucial to oer a precise and rigorous infrastructure, in order to help to
verify and guarantee correctness of them. However, current implementations of
transformations languages lack this necessary mathematical underpinning.
      </p>
      <p>
        The aim of this short paper is: on the one hand, to show how a rigorous
approach based on algebraic specication and rewriting logic [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] can oer a
suitable framework for model transformations; and on the other hand, to show how
proving theoretical properties of transformations is possible if the transformation
language or tool has a mathematical underpinning [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. Maude [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] is the formal
language used in this work. To illustrate this approach, the formal specications
of two metamodels, and a transformation between them, have been created.
elements (represented as terms) into other target model elements. In this section,
as well as explaining the main principles of this approach, we will illustrate it by
means of an example of transformation from UML Class diagram to a RDBMS
diagram (extracted from [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]).
2.1
      </p>
      <sec id="sec-1-1">
        <title>Metamodel Formalization</title>
        <p>
          In QVT, model transformations are dened in terms of metamodels, existing
source and target metamodels. Metamodel elements will be specied in Maude
by means of the object oriented modules of Maude. Figure 1 summarizes the
elements that make up the approach. This Figure shows the OMG standards’
elements, the Maude elements and the relationship between them.
The rst metamodel specied is the so-called simple UML metamodel (taken
from annex A of [
          <xref ref-type="bibr" rid="ref2">2</xref>
          ]) which represents a simplied version of the UML Class
diagram. Each element of this metamodel is specied by means of a Maude class.
Figure 2 shows an example of a simple UML diagram and how it is expressed
by means of objects in Maude ; these objects are instances of Maude classes that
appear in the lefthand side of the gure, as it was indicated in Figure 1.
        </p>
        <p>
          Analogously, the textual description of the simple RDBMS metamodel (taken
from annex A of [
          <xref ref-type="bibr" rid="ref2">2</xref>
          ]) will be formalized in Maude.
2.2
        </p>
      </sec>
      <sec id="sec-1-2">
        <title>QVT Relations Features in Maude</title>
        <p>In this subsection, we analyze briey the basis of QVT Relations and how to
formalize them by means of the strengths oered by Maude.</p>
        <p>
          On the one hand, a transformation is expressed in QVT Relations by means
of relations between metamodel elements. A relation declares constraints that
must be satised by the two or more metamodels (or domains) that participate
in the relation. Each domain establishes a pattern that must be matched with
the candidate models in order to execute the transformation, known as object
template expressions that are directly expressed in Maude, since this language
oers pattern-matching in the simplication of terms. Regarding the specication
of QVT transformations in Maude, they can be specied as rewriting rules that
change and create the elements of the target model. Finally, constraints over the
candidate models will be specied as conditions in the rewriting rules.
In this section, we will study the transformation from UML diagrams to RDBMS
diagrams (taken from [
          <xref ref-type="bibr" rid="ref2">2</xref>
          ]). Basically this transformation has three main
(toplevel) relations: Package to Schema, Class to Table and Association to Foreign
Keys. Due to lack of space only the rst relation will be studied.
        </p>
        <p>Package to Schema relation transforms a package of a UML diagram into a
schema of a relational data base diagram. Figure 3 shows this relation expressed
in QVT (a) and how it is specied in Maude (b). In this relation, the object
template expression can be directly expressed in Maude. The pattern matching
binds the variable pn to a specic value that is used to create a new object
which represents a schema in the target model. On the other hand, since a model
is represented by means of objects in Maude, we have to use object identiers
in the rules. In the righthand side of the rule appears both the object of the
source model and the new object in the target model. Finally, once we have
specied the metamodels and the QVT Relations in Maude, we can execute the
transformation over any UML model.
3</p>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>Applications in Practice</title>
      <p>The main advantage of the use of this approach over other non-formal
transformation techniques is that some applications can be carried out only dening
the rewriting rules. The application shown checks if two models are semantically
equivalent. In general, various models are semantically equivalent if they have
similar meaning. Being more precise, in this work we consider that two models
are semantically equivalent if they hold all the equivalence relationships (dened
by means of QVT Relations) which, depending on the metamodels, express the
semantics equivalence of concepts as dened by the analyst. In this way, if the
(a) top relation PackageToSchema { pn: String;
checkonly domain uml p:Package {name=pn};
enforce domain rdbms s:Schema {name=pn}; }
(b)
rl [PackageToSchema] :
&lt; packageOid(p:String) : Package | domain : "uml", name : pn:String,...&gt; =&gt;
&lt; packageOid(p:String) : Package | domain : "uml", name : pn:String,...&gt;
&lt; schemaOid(p:String) : Schema | domain : "rdbms", name : pn:String &gt; .
(c) (search UMLdiagram =&gt;! C:Configuration C2:Configuration</p>
      <p>such that (C:Configuration := RDBMSdiagram) .)
semantic equivalence between two models is expressed as a relation, we can use
Maude to infer if two particular models are equivalent using these rules.</p>
      <p>If we dene a RDBMS model that is equivalent to the one in Figure 2, Figure
3 (c) shows the Maude command that checks this equivalence. We ask Maude
if it is possible to obtain the RDBMSdiagram model from the UMLdiagram
model using the specied rules. This execution will nd a solution since the
models are equivalent.
4</p>
    </sec>
    <sec id="sec-3">
      <title>Conclusions</title>
      <p>The research presented shows the feasibility of integrating formal techniques
with current software engineering standards (MDA-QVT). This approach may
be particularly useful in model-driven engineering processes to develop critical
or error-prone high quality systems. The metamodel specications made in this
approach oer a powerful way to verify type properties and the correctness of
the models without losing the legibility and practicality of other transformation
languages. Furthermore, in the formal framework proposed the transformations
are represented as mathematical entities and we can take advantage of all the
power of mathematical inference mechanisms. This allows us to infer information
and to prove properties of the transformations.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <source>OMG: MDA Guide Version 1.0</source>
          .1, http://www.omg.org/mda. (
          <year>2001</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2. OMG:
          <string-name>
            <surname>MOF QVT Final Adopted Specication</surname>
          </string-name>
          . Object Management Group., Retrieved from: http://www.omg.org/docs/ptc/07-07-07.pdf. (
          <year>2007</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Meseguer</surname>
          </string-name>
          , J.:
          <article-title>Conditional rewriting logic as a unied model of concurrency</article-title>
          .
          <source>Theoretical Computer Science</source>
          ,
          <volume>96</volume>
          (
          <issue>1</issue>
          ):
          <fpage>73</fpage>
          -
          <lpage>155</lpage>
          (
          <year>1992</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Mens</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Czarnecki</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Van Gorp</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          :
          <article-title>A Taxonomy of Model Transformations</article-title>
          .
          <source>Int. Workshop on Graph and Model Transformation (GraMoT)</source>
          .
          <source>Estonia</source>
          (
          <year>2005</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Clavel</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>DurÆn</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Eker</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lincoln</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mart-Oliet</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Meseguer</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Talcote</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          : Maude 2.3 Manual., http://maude.csl.sri.com/. (
          <year>2007</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>