<!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>Design Patterns for Model Transformations: Current research and future directions</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>K. Lano</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>S. Yassipour-Tehrani</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Dept of Informatics, King's College London</institution>
          ,
          <addr-line>Strand, London</addr-line>
          ,
          <country country="UK">UK</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Research into MT design patterns</institution>
          ,
          <country country="US">USA</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>There is increasing interest in the use of design patterns for model transformations, and a number of such patterns have been proposed. In this paper we survey previous work on transformation design patterns, discuss one pattern in detail, and identify priorities for future research. { Transformations involve complex structured data (models) and navigation through and manipulation of such data. { Transformations involve unconventional processing such as graph rewriting and partially-specified execution orders. { Hybrid MT languages involve a mix of declarative and imperative language elements. { Languages supporting bidirectional transformations (bx) involve complex processing to synchronise or transform models in either source to target or target to source directions.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>Design patterns have proved to be an effective concept to improve the quality of
software systems, with classic patterns such as Iterator, Facade and MVC now
part of the standard vocabulary of software developers and provided as essential
elements of programming languages and of software development environments.
Model transformation (MT) development should also be able to benefit from
the standardised solutions and expertise embedded in design patterns: currently
such development is often carried out in an ad-hoc manner because of the novel
nature of the languages and processing involved.</p>
      <p>
        Transformation development requires new or adapted specification and
design patterns because of the specialised features of MT programming and
languages:
The first works on MT design patterns identified language-specific patterns for
the ATL [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] and QVT-R [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ] languages:
ATL: In [
        <xref ref-type="bibr" rid="ref2 ref7">2, 7</xref>
        ] ATL-specific patterns were identified: Transformation
Parameters; Multiple Matching; Object Indexing; Many-to-one; Many-to-many;
Custom Tracing.
      </p>
      <p>
        QVT-R: In [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ] QVT-R patterns such as Enable conditions in only one
Direction, and Simulation of Key were introduced. In [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] the use of marker
relations in a Model Copying pattern for QVT-R was detailed.
      </p>
      <p>In some cases, such patterns simply gave techniques for circumventing limitations
of the specific MT languages.</p>
      <p>
        Subsequently, work was carried out to identify language-independent MT
design patterns, based on generalisations of the language-specific patterns or
adaptions of classical design patterns for MT: in [
        <xref ref-type="bibr" rid="ref1 ref11 ref12 ref14 ref15 ref17 ref5 ref6 ref7">1, 5–7, 11, 12, 14, 15, 17</xref>
        ] such
patterns were described. These included Auxiliary Metamodel, a generalisation
of the ATL pattern Transformation Parameters, and Map Objects Before Links,
a general strategy for model copying and migration transformations.
      </p>
      <p>
        In [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ] the patterns were grouped into five categories:
Rule modularisation patterns: Phased Construction; Structure Preservation;
Entity Splitting/ Structure Elaboration; Entity Merging/Structure
Abstraction; Map Objects Before Links; Parallel Composition/Sequential
Composition; Auxiliary Metamodel; Construction and Cleanup; Recursive Descent;
Replace Explicit Calls by Implicit Calls; Introduce Rule Inheritance.
Optimisation patterns: Unique Instantiation; Object Indexing; Omit
Negative Application Conditions; Replace Fixed-point by Bounded Iteration;
Decompose Complex Navigations; Restrict Input Ranges; Remove Duplicated
Expression Evaluations; Implicit Copy.
      </p>
      <p>Model-to-text patterns: Model Visitor; Text Templates; Replace Abstract
by Concrete Syntax.</p>
      <p>Expressiveness patterns: Simulating Multiple Matching; Simulating
Universal Quantification; Simulating Explicit Rule Scheduling.</p>
      <p>Architectural patterns: Phased Model Construction; Target Model Splitting;
Model Merging; Auxiliary Models; Filter Before Processing.</p>
      <p>
        Patterns for specific categories of transformation have also been identified:
Bidirectional transformation (bx) patterns: Auxiliary Correspondence Model;
Cleanup before Construct; Unique Instantiation; Phased Construction for bx;
Entity Merging/Splitting for bx; Map Objects Before Links for bx [
        <xref ref-type="bibr" rid="ref18">18</xref>
        ].
Data migration patterns: Migrate along Domain Partitions; Measure
Migration Quality; Data Cleansing [
        <xref ref-type="bibr" rid="ref20">20</xref>
        ].
      </p>
      <p>Auxiliary Correspondence Model is an inbuilt and essential language feature
of TGG and QVT-R. Unique Instantiation is an inbuilt language feature of
QVT-R and UML-RSDS, and Object Indexing and Omit Negative Application
Conditions are also inbuilt into UML-RSDS.</p>
      <p>
        Figure 1 (based on [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ]) shows the generalisation and usage relationships
between some of the above patterns.
      </p>
    </sec>
    <sec id="sec-2">
      <title>Pattern example: Cleanup before Construct</title>
      <p>This pattern has been identified in several bx examples. The pattern defines a
two-phase approach in both forward and reverse transformations associated with
a bx with relation R: the forward transformation R! first removes all elements
from the target model n which fail to satisfy R for any element of the source m,
and then constructs elements of n to satisfy R with respect to m. The reverse
transformation R operates on m in the same manner.</p>
      <p>Bene ts: The pattern is an effective way to ensure the correctness of
separatemodels bx: all target elements which invalidate R are removed.</p>
      <p>
        Disadvantages: There may be efficiency problems because for each target model
element, a search through the source model for possibly corresponding source
element(s) may be needed. Elements may be deleted in the Cleanup phase only to
be reconstructed in the Construct phase: use of Auxilliary Correspondence Model
[
        <xref ref-type="bibr" rid="ref18">18</xref>
        ] is an alternative strategy to avoid this problem, by enforcing that feature
values should change in response to a feature value change in a corresponding
element, rather than deletion and recreation of elements.
      </p>
      <p>
        Related Patterns: This pattern is a variant of the Construction and Cleanup
pattern of [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ].
      </p>
      <p>
        Examples: An example is the Composers bx [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. Implicit deletion in QVT
operates in a similar manner, but can only modify models (domains) marked as
enforced [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ]. In UML-RSDS, explicit cleanup rules Cn can be deduced from
the construction rules Cn, for mapping transformations [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ].
      </p>
      <p>Assume that the transformation rules Cn are of the form:
Si →forAll (s | SCond (s) ⇒</p>
      <p>Tj →exists (t | TCond (t ) &amp; Pi,j (s; t )))
for source entity types Si and target entity types Tj . Then if identity attributes
are used to define the source-target correspondence (so that target model element
t : Tj corresponds to source model element s : Si when the respective identity
attributes are equal: s:sId = t :tId ), then Cn can be expressed as the constraints
(i):</p>
      <p>Tj →forAll (t | TCond (t ) &amp; t :tId ̸∈ Si →collect (sId ) ⇒ t →isDeleted ())
which deletes t if there is no corresponding s with the same identity, and (ii):
Tj →forAll (t | TCond (t ) &amp; t :tId : Si →collect (sId ) &amp; s = Si [t :tId ] &amp;
not (SCond (s)) ⇒ t →isDeleted ())
which deletes t if such an s exists but it is not in the domain of the transformation
(relation R). (ii) is omitted if SCond is the true predicate.</p>
      <p>In the case that TCond (t ) and SCond (s) hold for corresponding s, t , but
Pi,j (s; t ) does not hold, t should not be deleted, but Pi,j (s; t ) should be
established by updating t (iii):</p>
      <p>Si →forAll (s | s:sId : Tj →collect (tId ) &amp; t = Tj [sId ] &amp;</p>
      <p>SCond (s) &amp; TCond (t ) ⇒ Pi,j (s; t ))
For a transformation , the cleanup transformation has the above Cn
constraints (i), (ii), (iii) as its postconditions, in the same order as the Cn occur in
the Post of . The forward direction ! of the bx is then ; .</p>
      <p>A change-propagation version ∆ of can also be defined, to operate on
source model increments m (finite collections of deletion, creation and
modification updates). ∆ is ; where the rules of are only applied for deletion
(i) and modification (ii), (iii) updates in m, and the rules of are only applied
for modification and creation updates in m.
4</p>
    </sec>
    <sec id="sec-3">
      <title>Future research directions and challenges</title>
      <p>Because of the novelty of the MT field, there is as yet insufficient evidence for
the effectiveness of most of the identified patterns. Work is needed to survey
applications of MT patterns in practice and to evaluate their utility. Work is
also needed to identify appropriate classifications for MT patterns, to identify
connections between patterns, and useful compositions of patterns. Techniques
and guidelines for the selection of MT patterns need to be developed and
incorporated into MT engineering environments. Patterns for new types of
transformation, such as transformations at runtime or streaming transformations, are
also needed. Finally, research into transformation anti-patterns and techniques
for the identification of ‘bad smells’ in transformation specifications is needed.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>A.</given-names>
            <surname>Agrawal</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Vizhanyo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Kalmar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Shi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Narayanan</surname>
          </string-name>
          , G. Karsai,
          <source>Reusable Idioms and Patterns in Graph Transformation Languages, Electronic notes in Theoretical Computer Science</source>
          , pp.
          <fpage>181</fpage>
          -
          <lpage>192</lpage>
          ,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>ATL</given-names>
            <surname>Design Patterns</surname>
          </string-name>
          , https://wiki.eclipse.org/ATL/Design Patterns,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>I.</given-names>
            <surname>Bayley</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Zhu</surname>
          </string-name>
          ,
          <article-title>On the composition of design patterns</article-title>
          ,
          <source>QSIC</source>
          <year>2008</year>
          , IEEE Computer Society,
          <year>2008</year>
          , pp.
          <fpage>27</fpage>
          -
          <lpage>36</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>J.</given-names>
            <surname>Cheney</surname>
          </string-name>
          ,
          <string-name>
            <surname>J. McKinna</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Stevens</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Gibbons</surname>
          </string-name>
          ,
          <article-title>Towards a repository of bx examples</article-title>
          ,
          <source>EDBT/ICDT</source>
          <year>2014</year>
          ,
          <year>2014</year>
          , pp.
          <fpage>87</fpage>
          -
          <lpage>91</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>J. S.</given-names>
            <surname>Cuadrado</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Jouault</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. G.</given-names>
            <surname>Molina</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Bezivin</surname>
          </string-name>
          ,
          <article-title>Optimization patterns for OCL-based model transformations</article-title>
          ,
          <source>MODELS</source>
          <year>2008</year>
          , vol.
          <volume>5421</volume>
          LNCS, SpringerVerlag, pp.
          <fpage>273</fpage>
          -
          <lpage>284</lpage>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>K.</given-names>
            <surname>Duddy</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Gerber</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Lawley</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Raymond</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Steel</surname>
          </string-name>
          ,
          <article-title>Model transformation: a declarative, reusable pattern approach</article-title>
          ,
          <source>7th International Enterprise Distributed Object Computing Conference (EDOC '03)</source>
          ,
          <year>2003</year>
          , pp.
          <fpage>174</fpage>
          -
          <lpage>185</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>J.</given-names>
            <surname>Bezivin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Jouault</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Palies</surname>
          </string-name>
          ,
          <source>Towards Model Transformation Design Patterns, 1st European Workshop on Model Transformations</source>
          ,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>V.</given-names>
            <surname>Bollati</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Vara</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Jimenez</surname>
          </string-name>
          , E. Marcos,
          <article-title>Applying MDE to the (semi-)automatic development of model transformations</article-title>
          ,
          <source>Information and Software Technology</source>
          ,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Eclipsepedia</surname>
          </string-name>
          , ATL User Guide, http://wiki.eclipse.org/ATL/ User Guide -
          <source>The ATL Language</source>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10. T. Goldschmidt, G. Wachsmuth,
          <article-title>Re nement transformation support for QVT relational transformations</article-title>
          , FZI, Karlsruhe, Germany,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>M. E. Iacob</surname>
            ,
            <given-names>M. W. A.</given-names>
          </string-name>
          <string-name>
            <surname>Steen</surname>
          </string-name>
          , L. Heerink,
          <article-title>Reusable model transformation patterns</article-title>
          ,
          <source>Enterprise Distributed Object Computing Conference Workshops</source>
          ,
          <year>2008</year>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>10</lpage>
          , doi:10.1109/EDOCW.
          <year>2008</year>
          .
          <volume>51</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>J. Johannes</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          <string-name>
            <surname>Zschaler</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          <string-name>
            <surname>Fernandez</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          <string-name>
            <surname>Castillo</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          <string-name>
            <surname>Kolovos</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          <string-name>
            <surname>Paige</surname>
          </string-name>
          ,
          <article-title>Abstracting complex languages through transformation and composition</article-title>
          ,
          <source>MODELS</source>
          <year>2009</year>
          , LNCS 5795, pp.
          <fpage>546</fpage>
          -
          <lpage>550</lpage>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>J. Kiegeland</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          <string-name>
            <surname>Eichler</surname>
          </string-name>
          , Medini-QVT, http://projects.ikv.de/qvt,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <given-names>K.</given-names>
            <surname>Lano</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Kolahdouz-Rahimi</surname>
          </string-name>
          ,
          <article-title>Model transformation design patterns</article-title>
          ,
          <source>ICSEA</source>
          <year>2011</year>
          , IARIA,
          <year>2011</year>
          , pp.
          <fpage>263</fpage>
          -
          <lpage>268</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <given-names>K.</given-names>
            <surname>Lano</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Kolahdouz-Rahimi</surname>
          </string-name>
          ,
          <article-title>Optimising Model-transformations using Design Patterns</article-title>
          ,
          <string-name>
            <surname>MODELSWARD</surname>
          </string-name>
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          16.
          <string-name>
            <given-names>K.</given-names>
            <surname>Lano</surname>
          </string-name>
          ,
          <article-title>The UML-RSDS Manual, www</article-title>
          .dcs.kcl.ac.uk/staff/kcl/uml2web/umlrsds.pdf,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          17.
          <string-name>
            <given-names>K.</given-names>
            <surname>Lano</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Kolahdouz-Rahimi</surname>
          </string-name>
          ,
          <article-title>Model Transformation Design Patterns</article-title>
          ,
          <source>IEEE Transactions in Software Engineering</source>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          18.
          <string-name>
            <given-names>K.</given-names>
            <surname>Lano</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Kolahdouz-Rahimi</surname>
          </string-name>
          ,
          <article-title>Model transformation design patterns for bidirectionality</article-title>
          ,
          <source>FSEN</source>
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          19. OMG, MOF
          <volume>2</volume>
          .0 Query/View/Transformation Speci cation
          <year>v1</year>
          .1,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          20.
          <string-name>
            <surname>M. Wagner</surname>
          </string-name>
          , T. Wellhausen,
          <article-title>Patterns for data migration projects, www</article-title>
          .tngtech.com,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>