<!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>Towards Declarative and Incremental Model Transformation</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>ViewMMapping'</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>McMaster University, Department of Computing and Software</institution>
          ,
          <addr-line>Ontario</addr-line>
          ,
          <country country="CA">Canada</country>
        </aff>
      </contrib-group>
      <fpage>32</fpage>
      <lpage>39</lpage>
      <abstract>
        <p>Model Driven Engineering (MDE) has proven to be a promising approach in software engineering. Model management and maintenance stands at the core of the MDE approach, while it still needs more theoretical and technical support for the realization of its expected functionalities, like model transformation, refactoring, migration and synchronization. In this thesis proposal, I introduce a declarative Model Transformation de nition in the meta-model layer, as the foundation for model transformation. I motivate the declarative method by discussing its usefulness for incremental model transformation. This PhD proposal's objectives are the implementation of the declarative method, developing the necessary semantics for the incremental model transformation, and applying the incrementality to some MDE scenarios.</p>
      </abstract>
      <kwd-group>
        <kwd>Incremental Model Transformation</kwd>
        <kwd>Declarative Model Transformation</kwd>
        <kwd>Transformation Languages</kwd>
        <kwd>Model Driven Engineering</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        Model Driven Engineering(MDE) has proven to be a promising approach in the
software development process [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. Model Transformation(MT) means translating
one model to another model and it stands at the core of the model management
activities in MDE, since many operations in model management use it. There are
two main MT approaches: imperative and declarative. In imperative approaches,
transformation is de ned by an algorithm which is traversing the source model's
elements and generating the corresponding target model elements, step by step.
In declarative approaches, transformation is speci ed in a speci cation language,
and its imperative implementation is left to the underlying MT framework.
Imperative and declarative MTs are comparable to imperative and declarative
programming languages, respectively.
      </p>
      <p>Since in declarative methods, users provide the MT speci cation, it is
possible to have di erent implementations, verify them against the speci cation and
optimize them, while still retaining the correctness of the implementation.
Usually in declarative MT methods, since the size of MT speci cation decreases in
comparison to its implementation, its maintainability increases. Unfortunately,
it is not easy to write a declarative speci cations and it needs training and
practice for imperative-oriented minds to get used to this. In contrast, imperative
approaches are being widely used at the moment, and many languages and tools
exist for them, but they miss the advantages of the declarative approaches we
just mentioned.</p>
      <p>After transformation, it is possible that either the source model, the target
model or both, change and we require the propagation of changes to make both
sides consistent again. The naive way of dealing with this situation is
generating the new versions of related models from scratch1, which is usually not
desirable. For example, it is obvious that the developer would not be happy
if the code inside a Java function were thrown away, when only the name of
that function changes in the corresponding class diagram. So we would need to
have incremental transformation for these kind of situations in the sense that we
only propagate changes and keep related models' elements unchanged as far as
possible. To this end, declarative MT is useful, inasmuch as it provides a more
abstract perspective for dealing with incrementality complexity; we will discuss
this more in section 3.1.</p>
      <p>
        In the next section we will introduce a declarative approach based on
mathematical background, which is primarily introduced by Diskin [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. This PhD
research will implement this declarative approach on top of existing MT
languages and develope the necessary semantics for incrementality. Based on this,
we intend to apply incrementality to some MT scenario as a proof of concept.
2
      </p>
    </sec>
    <sec id="sec-2">
      <title>Declarative MT : An Example</title>
      <p>
        We formally represent models as Typed Graphs [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] with some constraints de ned
on them. A typed graph consists of three elements: data graph, type graph and
typing mapping (a morphism from data graph to type graph). But commonly data
graphs, are referred to as models, and type graphs are separately referred to as
meta-models. For the sake of simplicity, we also stick to this naming convention.
      </p>
      <p>We would like to translate account models in a bank to the corresponding
client models. Account meta-model(i.e. ac) is shown in Fig. 1(a); boxes in the
meta-model denote classes and primitive domains, and arrows are attributes. In
our formal semantics, boxes are interpreted by sets, and attributes are functions
between them. Class Acc has three attributes ownerName, acNo, and balance.
The type(codomain) of attribute acNo is the labeled cartesian product of classes
fS,Bg (with label/ eld label) and Str (label/ eld num). Value label=S
indicates that the account is a Student account, and label=B means it is a Business
account.</p>
      <p>Fig. 2(a) and Fig. 2(b) demonstrate the tabular and the graph representation
of an ac instance, respectively. The rst record in Fig. 2(a) shows a student
account and the second record shows a business one.</p>
      <p>Client meta-model(i.e. cl) is shown in Fig. 1(b). The class Client has an
attribute name and two subclasses(arrow with triangle head denotes subclassing):
1 This is called batch-update
ownerName(</p>
      <p>Str(
X(</p>
      <p>acNo(
label(
{S,B}(
num(
Str(</p>
      <p>X = {S, B}× Str
balance(
int(
2B0u13sE0i7En15e% ssman and Student. Two constraints([Disj] and [Cov]) ensure that eac2%h
client is either a student or a businessman, but not both.</p>
      <p>The informal speci cation of the transformation is de ned as follows: each
account corresponds to one client; we assumed that each client has only one
account in the bank; this is implicitly stated in Fig. 1(a) by assuming that all
multiplicity constraints on edges are 1..1.; the client's name corresponds to the
account's ownerName, and the rst component of the account number indicates
the type of the client{whether he is student or businessman.</p>
      <p>The way we approach declarative MT is by relating the elements of the
target meta-model(i.e. cl) to the basic or derived elements of the source
metamodel(i.e. ac). We try to do this by using an informal MT speci cation. In
our example, we link, rst, class Client with attribute name in cl to class
Acc with attribute ownerName in ac. Now we would like to link classes Stu.
and Busi. in cl to respective classes in ac, but there are no such classes in
ac. However, we notice that these classes can be de ned (derived) in
metamodel ac by some suitable queries. In other words, we augment meta-model
ownerName'</p>
      <p>/type'
Str'</p>
      <p>lb'
{S,B}'</p>
      <p>X'</p>
      <p>Acc'
acNo'
num'
Str'
''ign 'igpn
yTp apm
balance'
int'
/SAcc'
/BAcc'</p>
      <p>[Cov]'
/isA' [Disj]'</p>
      <p>Pull$Back$
(Relabeling)$</p>
      <p>Traceability'
Mapping'
name'</p>
      <p>Str'</p>
      <p>Student'
Businessman'
isA'
ac with new elements denoting (results of the respective) query de nitions. We
call this procedure meta-model augmentation. We augmented ac in Fig. 2(c); its
augmented elements are in green dotted lines and their corresponding queries
are attached to them in red boxes. e.g. /type1 is the composition of acNo and
label, and /SAcc represents accounts, for which their acNo's rst component is
S. By having augmented ac, say q(ac), we can continue linking elements from
cl to q(ac); e.g., we relate Businessman and Student to /BAcc and /SAcc,
respectively. Complete linking from cl to q(ac) is shown in the upper part of
Fig. 3; we call this collection of links a mapping from cl to q(ac), or a
viewmapping, as it is analogous to the view-table mapping in database terminology.</p>
      <p>What is described in the previous paragraph is the declarative MT de
nition procedure, which is a heuristic process and requires user involvement; that
procedure is summarized in the more abstract view in Fig.4 by steps (1) and (2).</p>
      <p>For a given model like ac:ac (ac of type ac), MT execution would be as
follows: rst, queries are executed on ac and we get an augmented source model,
[[q]](ac). Augmented ac is shown in the lower left part of the Fig.32. Then, the
relabelling procedure takes [[q]](ac), q(ac), and typing mapping from [[q]](ac)
1 we followed UML notation for showing derived elements by putting slash at the
beginning of the derived element's name.
2 original mode's element are in grey solid lines and augmented elements which are
results of query execution, are in green dotted lines
Typing##
Mapping##</p>
      <p>AC#
ac#
Query##
Execu9on#
3</p>
      <p>Q(AC)(
[[Q]](ac)(
4
Traceability#
mapping#</p>
      <p>CL#
cl(
Pull#Back#
(Relabeling)#</p>
      <p>Typing##
Mapping##
to q(ac), as well as cl and the view-mapping, and generates, cl and two
mappings: a traceability mapping from cl to [[q]](ac) and a typing mapping from
cl to cl. The relabelling procedure is actually pullback operation in category
theory. Fig. 3 shows in detail how the relabelling procedure acts on ac. The
entire procedure described in this paragraph is abstracted in Fig. 4 and labeled by
steps (3) and (4). These two steps can be implemented automatically and don't
require user involvement.
3</p>
    </sec>
    <sec id="sec-3">
      <title>PhD Proposal</title>
      <p>In this section we discuss the incrementality issues and why we think declarative
MT is useful for dealing with them. Then, we list the PhD research objectives
and explain them.
3.1</p>
      <p>Declarative MT and Incrementality
In this section we argue that declarative MT makes incremental MT easier.
Suppose that we run MT, and the target model, TM , is generated from the source
model, SM . Later SM changes and we want to re ect this change on TM . One
naive approach is to regenerate TM from scratch (so called batch-update). This
approach has two main disadvantages: rst, when models are huge, and changes
happen frequently, running the transformation for every change is very costly
in time; second, it might happen that TM is also already changed |without
loosing its consistency with SM { and we want to respect the TM changes, but
batch-update completely ignores the TM changes. So, it is better to have an
incremental MT, in the sense that the MT engine propagates only the changes of
SM to TM . To have incrementality, we need to deal with some issues: private and
shared parts of models, minimal change on the target, and con ict resolution.
We discuss them brie y in the following paragraphs and mention how declarative
MT may help.</p>
      <p>Private and shared area. Sometimes, when SM changes, it is not necessary
to change TM , to make the two models consistent again. In other words, the
changed SM still remains consistent with TM . In this case we say that the changes
happened in the private area of the source. In contrast, if the changes happened
on the part which caused SM to lose its consistency with TM , then we say that
the changes happened in the shared area of SM . Distinguishing between private
and shared areas obviate the need to run the transformation every time that some
changes happen on the private area. De ning the transformation on the
metamodel layer {as we proposed in the previous section{ makes it easy to identify
private and shared areas; e.g., it is completely clear from our MT de nition in
Fig.3 that balance properties of ac instances belong to their private areas, since
if the balance of an account changes, we do not expect to change anything in
the corresponding client model.</p>
      <p>
        Minimal change. As we said, when TM changes, we would like to propagate
it to SM ; the problem is to nd a suitable translation on SM ; there might be
more than one way to do this translation. When TM is a view of SM , this
situation is analogous to a well-known problem in the database community called the
view-update problem. In the database context, the Constant Complement(CC)
approach [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] suggests that if we x the complement of the view, translation of
the view updates can be de ned uniquely. Choice of view complement can be
interpreted as the de nition of an update policy. In general, we are interested in
choosing a translator of updates in a way that imposes minimal change on SM ;
that is changing SM as minimally as possible; the best case is not changing it at
all. We need to formally de ne this minimality and its semantics. Recently, some
work has been done on the view-update problem, extending the CC approach
mentioned above using category theory [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. We believe that the categorical
approach to MT de nition in meta-model, provides a basis for extending the CC
approach to the MT world.
      </p>
      <p>Con ict resolution. Sometimes SM and TM evolve at the same time; e.g.,
software team members might work separately on some class diagrams and
sequence diagrams, or they might work on code and class diagrams simultaneously.
Updated models might be in con ict, and in most cases user involvement and a
heuristic approaches are necessary to resolve the con icts. A con ict resolution
objective is to support users in resolving the con icts . Looking at MT at a more
abstract level provides a better understanding of the MT behaviour and helps
to develop supporting tools and their semantics for con ict resolution purposes.
3.2</p>
      <p>PhD work de nition and challenges
The following list summarizes intended PhD goals:
1. Graphical language design and implementation, which provides a GUI for
declarative MT de nition
2. Adapting existing query languages for meta-model augmentation.
3. Implementing a transformation engine, using existing MT languages.
4. De ning necessary semantics for incrementality based on the introduced
declarative approach.
5. Applying incrementally to some MT scenarios.</p>
      <p>
        We intend to implement the declarative MT inside the eclipse framework as it
provides some good features like Ecore tools and APIs[
        <xref ref-type="bibr" rid="ref13">13</xref>
        ]. For designing the
graphical language, we will de ne its meta-model and provide an editor for the
users to de ne model transformations. It would let users to de ne the
augmentation of source meta-models and the view-mappings.
      </p>
      <p>
        OCL[
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] at the moment is used as a side-e ect free query language for
specifying constraints on UML diagrams. Besides that, EOL[
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] as the core language
of the Epsilon framework provides a query de nition facilities. We might choose
one of them to integrate as query language in our implementation, since there is
already good tooling support for them.
      </p>
      <p>Transformation engine of the framework would be responsible for executing
transformation de ned by user in graphical GUI. the engine is responsible for
query execution on given models. Further, it implements relabelling operation
and building the traceability and typing mappings from generated target model,
to respective source model, and target meta-model.</p>
      <p>Finally we will develop a precise semantics for supporting incrementality
based on the introduced declarative MT approach, and apply it to some MT
scenarios as proof of the concept.
4</p>
    </sec>
    <sec id="sec-4">
      <title>Related works</title>
      <p>
        For each imperative and declarative MT approaches, there exist some languages
and tool support. Epsilon framework[
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] provides a set of imperative languages
and tools for model management tasks. Story Diagrams(SD)[
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] combined graph
grammars |which are means to de ne transformation constructively{ and
activity diagrams to provide a mechanism for specifying model transformations. ATL
[
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] and Viatra2 [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] are both providing imperative and declarative
transformation languages. Our introduced approach provides a declarative
structure(metamodel augmentation, and view mapping) which is implicit and entangled in the
current imperative MT approaches.
      </p>
      <p>
        Triple Graph Grammars(TGGs)[
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] are extension of regular graph grammars
and used for specifying the correspondence between the SM and TM elements
declaratively. TGG approach is di erent from our declarative approach in the
sense that in TGG, the MT de nition between SM and TM is speci ed
constructively between model elements, while in our declarative approach, MT is
completely speci ed in the meta-model layer between the meta-model elements.
So we raised the level of abstraction in relation de nition between source and
target.
      </p>
      <p>
        QVT-R is declarative language of QVT [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] for model transformation. It has
some semantic issues [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ] and is not actively used in industry. There exists many
similarities between the QVT and the TGG concepts[
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] and like TGG, relation
de nition between SM and TM is not in the meta-model layer.
5
      </p>
    </sec>
    <sec id="sec-5">
      <title>Conclusion</title>
      <p>We introduced declarative MT by an example, and motivated its implementation
by discussing its usefulness for incrementality. PhD objectives are
implementing declarative MT, developing precise semantics for incrementality based on
introduced declarative method, and applying incremental method to some MT
scenarios.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>Andras</given-names>
            <surname>Balogh</surname>
          </string-name>
          and
          <string-name>
            <given-names>Daniel</given-names>
            <surname>Varro</surname>
          </string-name>
          .
          <article-title>Advanced model transformation language constructs in the viatra2 framework</article-title>
          .
          <source>In Proceedings of the 2006 ACM symposium on Applied computing</source>
          , pages
          <volume>1280</volume>
          {
          <fpage>1287</fpage>
          . ACM,
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>Francois</given-names>
            <surname>Bancilhon</surname>
          </string-name>
          and
          <string-name>
            <given-names>Nicolas</given-names>
            <surname>Spyratos</surname>
          </string-name>
          .
          <article-title>Update semantics of relational views</article-title>
          .
          <source>ACM Transactions on Database Systems (TODS)</source>
          ,
          <volume>6</volume>
          (
          <issue>4</issue>
          ):
          <volume>557</volume>
          {
          <fpage>575</fpage>
          ,
          <year>1981</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>Marco</given-names>
            <surname>Brambilla</surname>
          </string-name>
          , Jordi Cabot, and
          <string-name>
            <given-names>Manuel</given-names>
            <surname>Wimmer</surname>
          </string-name>
          .
          <source>Model-Driven Software Engineering in Practice. Synthesis Lectures on Software Engineering</source>
          . Morgan &amp; Claypool Publishers,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>Zinovy</given-names>
            <surname>Diskin</surname>
          </string-name>
          .
          <article-title>Model synchronization: mappings, tiles, and categories</article-title>
          .
          <source>In Generative and Transformational Techniques in Software Engineering III</source>
          , pages
          <volume>92</volume>
          {
          <fpage>165</fpage>
          . Springer,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>Hartmut</given-names>
            <surname>Ehrig</surname>
          </string-name>
          and
          <string-name>
            <given-names>Karsten</given-names>
            <surname>Ehrig</surname>
          </string-name>
          .
          <article-title>Overview of formal concepts for model transformations based on typed attributed graph transformation</article-title>
          .
          <source>Electron. Notes Theor. Comput. Sci.</source>
          ,
          <volume>152</volume>
          :3{
          <fpage>22</fpage>
          ,
          <string-name>
            <surname>March</surname>
          </string-name>
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>Thorsten</given-names>
            <surname>Fischer</surname>
          </string-name>
          ,
          <source>Jorg Niere</source>
          , Lars Torunski, and
          <article-title>Albert Zundorf. Story diagrams: A new graph rewrite language based on the uni ed modeling language and java</article-title>
          .
          <source>In Theory and Application of Graph Transformations</source>
          , pages
          <volume>296</volume>
          {
          <fpage>309</fpage>
          . Springer,
          <year>2000</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>Ulrike</given-names>
            <surname>Golas</surname>
          </string-name>
          , Leen Lambers, Hartmut Ehrig, and
          <string-name>
            <given-names>Holger</given-names>
            <surname>Giese</surname>
          </string-name>
          .
          <article-title>Toward bridging the gap between formal foundations and current practice for triple graph grammars</article-title>
          .
          <source>In Graph Transformations</source>
          , pages
          <volume>141</volume>
          {
          <fpage>155</fpage>
          . Springer,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>Joel</given-names>
            <surname>Greenyer</surname>
          </string-name>
          and
          <string-name>
            <given-names>Ekkart</given-names>
            <surname>Kindler</surname>
          </string-name>
          .
          <article-title>Reconciling tggs with qvt</article-title>
          .
          <source>In Model Driven Engineering Languages and Systems</source>
          , pages
          <fpage>16</fpage>
          {
          <fpage>30</fpage>
          . Springer,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <given-names>Michael</given-names>
            <surname>Johnson</surname>
          </string-name>
          and
          <string-name>
            <given-names>Robert</given-names>
            <surname>Rosebrugh</surname>
          </string-name>
          .
          <article-title>Constant complements, reversibility and universal view updates</article-title>
          .
          <source>In Algebraic Methodology and Software Technology</source>
          , pages
          <volume>238</volume>
          {
          <fpage>252</fpage>
          . Springer,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Frederic</surname>
            <given-names>Jouault</given-names>
          </string-name>
          , Freddy Allilaire, Jean Bezivin, and
          <string-name>
            <given-names>Ivan</given-names>
            <surname>Kurtev</surname>
          </string-name>
          .
          <article-title>Atl: A model transformation tool</article-title>
          .
          <source>Science of Computer Programming</source>
          ,
          <volume>72</volume>
          (
          <issue>1-2</issue>
          ):
          <volume>31</volume>
          {
          <fpage>39</fpage>
          ,
          <year>June 2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11. Dimitrios S. Kolovos, Richard F. Paige, and
          <string-name>
            <surname>Fiona</surname>
            <given-names>A. C.</given-names>
          </string-name>
          <string-name>
            <surname>Polack</surname>
          </string-name>
          .
          <article-title>Eclipse development tools for epsilon</article-title>
          .
          <source>In In Eclipse Summit Europe, Eclipse Modeling Symposium</source>
          ,
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12. OMG, http://http://www.omg.org/spec/. OMG Speci cations,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13. David Steinberg, Frank Budinsky, Marcelo Paternostro, and Ed Merks.
          <source>EMF: Eclipse Modeling Framework</source>
          <volume>2</volume>
          .0.
          <string-name>
            <surname>Addison-Wesley</surname>
            <given-names>Professional</given-names>
          </string-name>
          ,
          <source>2nd edition</source>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <given-names>Perdita</given-names>
            <surname>Stevens</surname>
          </string-name>
          .
          <article-title>Bidirectional model transformations in qvt: semantic issues and open questions</article-title>
          .
          <source>Software and Systems Modeling</source>
          ,
          <volume>9</volume>
          :7{
          <fpage>20</fpage>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>