<!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>
      <journal-title-group>
        <journal-title>Bergen, Norway (online).
" d.strueber@cs.ru.nl (D. Strüber)
~ https://www.danielstrueber.de/ (D. Strüber)</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Supporting round-trip data migration for web APIs with Henshin</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Daniel Strüber</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Faculty of Science, Radboud University Nijmegen</institution>
          ,
          <addr-line>Postbus 9010, 6500 GL Nijmegen</addr-line>
          ,
          <country country="NL">The Netherlands</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2021</year>
      </pub-date>
      <volume>000</volume>
      <fpage>0</fpage>
      <lpage>0002</lpage>
      <abstract>
        <p>We present a solution to the Round-Trip Migration case of the Transformation Tool Contest 2020, based on the Henshin model transformation language. The task is to support four scenarios of transformations between two versions of the same data metamodel, a problem inspired by the application scenario of Web API migration, where such a round-trip migration methodology might mitigate drawbacks of the conventional “instant” migration style. Our solution relies on Henshin's visual syntax, which seems well-suited to capture the problem on an intuitive level, since the syntax is already similar to the scenario illustrations in the case description. We discuss the five evaluation criteria expressiveness, comprehensibility, bidirectionality, performance, and reusability.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;data migration</kwd>
        <kwd>model transformation</kwd>
        <kwd>tool contest contribution</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <sec id="sec-1-1">
        <title>During the evolution of web-based systems, provided</title>
        <p>APIs may change over time. Implementing API changes
in an instant usually leads to severe complications, as
developers of client software need to rapidly respond
to such changes. A desirable alternative is a round-trip
migration system that provides support for several API
versions in parallel, while internally managing the data
in such way that consistency is ensured.</p>
        <p>
          To study how transformation tools may be an enabling
technology for such a system, this problem is the subject
of a case in the 2020 edition of TTC, called Round-Trip
Migration of Object-Oriented Data Model Instances [
          <xref ref-type="bibr" rid="ref1">1</xref>
          ].
The case description includes four scenarios of changes
that need to be supported by such a system: create/delete
ifeld , rename field , declare field optional/mandatory , and
multiple edits. The task is to develop transformations
capturing these changes between two versions 1, 2
of the same metamodel. In each scenario, four
transformations are required: the migration and subsequent
back-migration for both possible round-trip directions
(1-2-1, 2-1-2).
        </p>
        <p>
          In this paper, we present a solution to the case based on
the Henshin model transformation language [
          <xref ref-type="bibr" rid="ref2 ref3">2, 3</xref>
          ].
Henshin is a model transformation language that supports the
declarative, graph-based specification of in-place
transformations. The basic features of Henshin’s tool set are
a suite of editors and an interpreter kernel. It also ofers
a variety of advanced features, such code generation for
parallel graph pattern matching and support for various
transformation analyses.
        </p>
        <p>
          Henshin provides an expressive visual syntax that aims
to support usability during transformation development
[
          <xref ref-type="bibr" rid="ref3">3</xref>
          ]. In fact, combining the object-diagram paradigm with
change descriptions, Henshin’s syntax is similar to the
informal notation used in the case description. Whereas
the case description illustrates the change of specific
instances, Henshin captures such changes in the form of
reusable rules. Rules express basic match-and-change
patterns. To specify control flow between rules where
needed, Henshin provides composite units that
orchestrate the execution of a number of sub-units and rules.
From a variety of available units (including random
execution and loops), our solution uses one: Sequential units,
supporting the specification of rules in a given order as
well as the included data flow.
        </p>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>2. Solution</title>
      <p>The solution comprises a set of Henshin rules and units,
as well some Java-based glue code. The reason for
having the glue code is to establish the connection to the
benchmark framework by implementing the provided
task interface (constant over the diferent scenarios). The
solution contains 8 modules (one per scenario and case),
encapsulating rules and units. For scenarios 1–3, each
module contains 2 rules, one for forward and one for
background migration. For scenarios 4, each module contains
2 units, each orchestrating 4 rules (one of them reused).
The full solution and setup instructions are available at
https://github.com/dstrueber/ttc2020.
(a) Scenario 1, 1-2-1 case.
(b) Scenario 1, 2-1-2 case.</p>
      <sec id="sec-2-1">
        <title>2.1. Scenario 1: create/delete field.</title>
      </sec>
      <sec id="sec-2-2">
        <title>2.2. Scenario 2: rename field.</title>
        <p>The solution for scenario 1 comprises four rules, shown in Figure 2 shows two out of the four rules for scenario 2,
Fig. 1: two for both directions, one for migration and one capturing the 1-2-1 case (for symmetry reasons,
for back-migration. Each rule has a name and a parame- the other two rules are identical). In attribute
calculater list; parameters have a name and one of the directions tions, Henshin supports the use of JavaScript expressions,
in, out, var. In and out parameters are passed into and including standard library objects such as Date, as we use
out of the the rule from the usage context (in our case, to specify the conversion between birth dates and age.
the Java-based glue code), var parameters (variables) are During execution, JavaScript expressions are evaluated
used internally to propagate information between difer- using the Nashorn JavaScript engine.
ent parts of the rule. Each rule comprises a number of
preserve elements (shown in gray), specifying the con- 2.3. Scenario 3: declare field
text for creations, and create elements (shown in green),
specifying newly created elements. For example, the optional/mandatory.
top migrate rule specifies a person from metamodel 1 as Figure 3 shows two out of four rules for scenario 3,
capcontext for the creation of a new person based on meta- turing the 1-2-1 case. Again, we rely on Henshin’s
model 2, obtaining the same name and the age value of -1. capability of using JavaScript calculations in attribute
valThe migrateBack rule for the 2-1-2 case requires a ues. In the migrateBack rule, we use the ternary operator
trace person as a source for the age value. The glue code to check if the name of the provided person object is null,
for the previously applied migrate rule ensures that this and specify diferent calculation outcomes for both cases.
object is available and can be passed into migrateBack. The 2-1-2 case (not shown) is largely similar; the</p>
        <p>A usability limitation in this particular scenario (in- main diference is that the migrate rule includes a
hanvolving two metamodels that, from the user’s perspective, dling of empty strings, in the same way that the shown
are actually versions of the same metamodel) is that there migraterules handles the null case.
is no visual distinction between elements from diferent
metamodels. This issue is mitigated by the use of names 2.4. Scenario 4: multiple edits.
(e.g., instance1 and instance2, referring to instances from
1 and 2) as well as the coloring of separate actions
(preserve, create).</p>
        <sec id="sec-2-2-1">
          <title>While scenarios 1–3 are straightforward, scenario 4 has</title>
          <p>a design space of possible solutions. The rationale of our
solution is to illustrate the reuse capabilities of Henshin,
as requested in the case description. Still, we notice an
inherent trade-of between reuse, simplicity and
performance. The granularity of reuse in this case is so fine</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. Evaluation</title>
      <p>
        that the price of reuse appears high: Compared to a
solution without reuse (capturing the edits in a single rule),
the specification is much larger and therefore harder to We discuss our solution in the light of the five evaluation
understand and less eficient to execute. criteria from the case description [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ].
      </p>
      <p>
        Figure 4 shows the implementation of the migrate step Expressiveness. The assessment of expressiveness is
in the 1-2-1 direction, comprising a sequential based on the number of passing test cases: the more test
unit that invokes four rules – three of them presented cases a solution covers, the more expressive it is.
Accordwith the unit, one of them reused from Scenario 2. (For ing to this criterion, the present solution is maximally
reading convenience, the rule from Scenario 2 was actu- expressive, since it passes all test cases.
ally copied and included into the Scenario 4
transformation file, but it would be possible to maintain an actual Comprehensibility. With our solution, we aimed at
reference as well—using EMF’s concept of remote refer- providing a primarily declarative solution. We achieved
ences.) The unit produces an instance of a 2 container this goal by specifying all parts of the change logic using
object from an instance of a 1 container object, and Henshin’s declarative rule and control flow concepts. In
also has four internal var parameters. The order of the addition, our solution includes some glue code, written
rule invocations is specified in an activity-diagram-like in Java, to implement the provided Task interface.
notation. Data flow is specified by passing parameters
Bidirectionality. Our solution (like any solution
passbetween rule invocations (questions marks refer to vari- ing all test cases) is inherently bidirectional, since it
supables, which do not have to be set from the context). Rule ports transformations in both directions. Still, Henshin
getObject1 fetches the person and dog objects from the does not provide dedicated support for automatically
gencontainer. Rules task2_migrate and dog_migrate produce erating the transformation in either direction, and hence,
the migrated objects. Rule connectMigrated2 connects leaves the efort for bidirectionality implementation to
the migrated objects with a reference and encapsulates the user. An extension of Henshin with dedicated support
them in a container, which is yielded as output. for bidirectionality exists in an early stage [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
      </p>
      <p>The solution for migrateBack and both steps in the
2-1-2 direction look largely similar. A small addi- Performance. Figure 5 shows the execution time data
tional sophistication is that migrateBack for 1-2-1 from running the performance test on a dual-core
i7requires a copy (a.k.a. trace) of the previously migrated 6600U CPU Ubuntu Linux system with 16 GB RAM. We
dog instance, which we implement in a similar manner observe a large slowdown, by two orders of magnitude,
as in the 2-1-2 case of scenario 1. compared to the Java reference implementation. This</p>
      <p>Total Transformation Runtime</p>
      <p>Furthermore, it can be emphasized that the Java-based
glue code for implementing the task interface is constant
over the diferent scenarios. Even though scenario 4 is
the most complex scenario by far, we were able to fully
reuse the glue code developed for scenarios 1–3 without
further modifications.
0</p>
      <p>No. of Repetitions
250000 500000 750000 1000000 1250000 1500000 1750000 2000000</p>
    </sec>
    <sec id="sec-4">
      <title>4. Outlook</title>
      <p>
        slowdown is to be expected due to the overhead of
Henshin’s generic matching engine, and the decision to use a
deliberately ineficient implementation (in favor of reuse)
in the most complicated scenario (scenario 4).
Re-usability. Henshin’s composite units support the
specification of a control flow. In scenario 4, we use this
feature to reuse rules originally specified for the
implementation of scenario 2. Doing so, we enable reuse by
following a suggestion from the case description:
"delegating the migration of the referenced Person instances to
migration functions which have been already defined." [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]
Henshin has another reuse concept for specifying rule
variants [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ], but this concept was not applicable to the
given case, since it does not support variations on the
level of node types (dog vs. person). This experience
emphasizes the need for more expressive reuse concepts
for model transformations [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ].
      </p>
      <p>
        The trade-of related to reusability vs.
simplicity/performance motivates further work on composition
of transformation systems: The complicated specification
of units and rules in scenario 4 could be translated into
a single rule, which might both increase readability and
execution performance. While there are various works
on composition of rules from smaller parts [
        <xref ref-type="bibr" rid="ref7 ref8 ref9">7, 8, 9</xref>
        ], no
existing work seems to consider control flow in the input
transformation specification. The considered round-trip
migration scenario is also relevant during the
modeldriven migration between diferent backend versions of
content management systems [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ].
      </p>
      <sec id="sec-4-1">
        <title>Acknowledgement. Thanks to Antonio Garcia</title>
        <p>Dominguez for providing an initial version of the
performance comparison figure.</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>L.</given-names>
            <surname>Beurer-Kellner</surname>
          </string-name>
          , J. von Pilgrim, T. Kehrer,
          <article-title>Roundtrip migration of object-oriented data model instances</article-title>
          , in: Transformation Tool Contest,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>T.</given-names>
            <surname>Arendt</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Biermann</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Jurack</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Krause</surname>
          </string-name>
          , G. Taentzer,
          <article-title>Henshin: advanced concepts and tools for in-place emf model transformations</article-title>
          ,
          <source>Model Driven Engineering Languages and Systems</source>
          (
          <year>2010</year>
          )
          <fpage>121</fpage>
          -
          <lpage>135</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>D.</given-names>
            <surname>Strüber</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Born</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K. D.</given-names>
            <surname>Gill</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Groner</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Kehrer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Ohrndorf</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Tichy</surname>
          </string-name>
          ,
          <article-title>Henshin: A usabilityfocused framework for emf model transformation development</article-title>
          ,
          <source>in: International Conference on Graph Transformation</source>
          ,
          <year>2017</year>
          , pp.
          <fpage>196</fpage>
          -
          <lpage>208</lpage>
          . URL: https://rgse.uni-koblenz.de/web/pages/ research/papers/SBGGKOT17.pdf .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>C.</given-names>
            <surname>Ermel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Hermann</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Gall</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Binanzer</surname>
          </string-name>
          ,
          <article-title>Visual modeling and analysis of emf model transformations based on triple graph grammars</article-title>
          ,
          <source>Electronic Communications of the EASST</source>
          <volume>54</volume>
          (
          <year>2012</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>D.</given-names>
            <surname>Strüber</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Rubin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Arendt</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Chechik</surname>
          </string-name>
          , G. Taentzer,
          <string-name>
            <given-names>J.</given-names>
            <surname>Plöger</surname>
          </string-name>
          ,
          <article-title>Variability-based model transformation: formal foundation and application</article-title>
          ,
          <source>Formal Asp. Comput</source>
          .
          <volume>30</volume>
          (
          <year>2018</year>
          )
          <fpage>133</fpage>
          -
          <lpage>162</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>M.</given-names>
            <surname>Chechik</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Famelis</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Salay</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Strüber</surname>
          </string-name>
          ,
          <article-title>Perspectives of model transformation reuse</article-title>
          ,
          <source>in: International Conference on Integrated Formal Methods</source>
          ,
          <year>2016</year>
          , pp.
          <fpage>28</fpage>
          -
          <lpage>44</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>A.</given-names>
            <surname>Rensink</surname>
          </string-name>
          ,
          <article-title>Compositionality in graph transformation</article-title>
          ,
          <source>in: International Colloquium on Automata, Languages and Programming</source>
          ,
          <year>2010</year>
          , pp.
          <fpage>309</fpage>
          -
          <lpage>320</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>A.</given-names>
            <surname>Anjorin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Saller</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Lochau</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Schürr</surname>
          </string-name>
          ,
          <article-title>Modularizing triple graph grammars using rule refinement</article-title>
          , in: Fundamental Approaches to Software Engineering,
          <year>2014</year>
          , pp.
          <fpage>340</fpage>
          -
          <lpage>354</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>L.</given-names>
            <surname>Fritsche</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Kosiol</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Schürr</surname>
          </string-name>
          , G. Taentzer,
          <article-title>Shortcut rules</article-title>
          , in: STAF workshops,
          <year>2018</year>
          , pp.
          <fpage>415</fpage>
          -
          <lpage>430</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>D.</given-names>
            <surname>Priefer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Kneisel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Strüber</surname>
          </string-name>
          ,
          <article-title>Iterative modeldriven development of software extensions for web content management systems</article-title>
          ,
          <source>in: European Conference on Modelling Foundations and Applications</source>
          ,
          <year>2017</year>
          , pp.
          <fpage>142</fpage>
          -
          <lpage>157</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>