<?xml version="1.0" encoding="UTF-8"?>
<TEI xml:space="preserve" xmlns="http://www.tei-c.org/ns/1.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.tei-c.org/ns/1.0 https://raw.githubusercontent.com/kermitt2/grobid/master/grobid-home/schemas/xsd/Grobid.xsd"
 xmlns:xlink="http://www.w3.org/1999/xlink">
	<teiHeader xml:lang="en">
		<fileDesc>
			<titleStmt>
				<title level="a" type="main">EMF-Syncer solution to TTC&apos;20 round-trip migration case</title>
			</titleStmt>
			<publicationStmt>
				<publisher/>
				<availability status="unknown"><licence/></availability>
			</publicationStmt>
			<sourceDesc>
				<biblStruct>
					<analytic>
						<author role="corresp">
							<persName><forename type="first">Artur</forename><surname>Boronat</surname></persName>
							<email>artur.boronat@leicester.ac.uk</email>
							<affiliation key="aff0">
								<orgName type="department">School of Computing and Mathematical Sciences</orgName>
								<orgName type="institution">University of Leicester</orgName>
								<address>
									<addrLine>University Rd</addrLine>
									<postCode>LE1 7RH</postCode>
									<settlement>Leicester</settlement>
									<country key="GB">United Kingdom</country>
								</address>
							</affiliation>
						</author>
						<title level="a" type="main">EMF-Syncer solution to TTC&apos;20 round-trip migration case</title>
					</analytic>
					<monogr>
						<idno type="ISSN">1613-0073</idno>
					</monogr>
					<idno type="MD5">8923F7D0B0A6336964F096BA831AB7FD</idno>
				</biblStruct>
			</sourceDesc>
		</fileDesc>
		<encodingDesc>
			<appInfo>
				<application version="0.7.2" ident="GROBID" when="2023-03-25T04:50+0000">
					<desc>GROBID - A machine learning software for extracting information from scholarly documents</desc>
					<ref target="https://github.com/kermitt2/grobid"/>
				</application>
			</appInfo>
		</encodingDesc>
		<profileDesc>
			<textClass>
				<keywords>
					<term>Model syncing</term>
					<term>model-driven engineering</term>
					<term>round-trip engineering</term>
				</keywords>
			</textClass>
			<abstract>
<div xmlns="http://www.tei-c.org/ns/1.0"><p>In this paper, we present a solution to the TTC'20 offline case Round-trip migration of object-oriented data model instances <ref type="bibr" target="#b0">[1]</ref>. This case involves the application of maintenance tasks to web APIs that are associated with domain models so that updates are backward compatible. The solution presented in this article features the EMF-Syncer [2], a synchronization tool for bridging MDE-agnostic programs and MDE-aware programs, which may have some similarities in their object-oriented data models at run time. EMF-Syncer provides a generic synchronization strategy that exploits such similarities automatically and is, therefore, a suitable candidate for solving the proposed problems, since each problem relies on a small change and there is a large overlap between two versions of the same data model. In the paper, we used the case benchmark framework to justify that our solution exhibits a good balance between specification conciseness and performance.</p></div>
			</abstract>
		</profileDesc>
	</teiHeader>
	<text xml:lang="en">
		<body>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="1.">Introduction</head><p>The Round-trip migration of object-oriented data model instances case <ref type="bibr" target="#b0">[1]</ref> for the TTC'20 exposes an evolution problem in the context of web API development, where different APIs work on top of a common data model. To accommodate new or changing requirements in the system, API designers need to ensure backward-compatible changes in the underlying data model. Assuming an agile software development environment where data models may evolve rapidly, the case proposes the use of roundtrip migration services, relying on Model-Driven Engineering (MDE) technology, for enabling the co-existence of different versions of the data model at run time. In particular, the Eclipse Modeling Framework (EMF) <ref type="bibr" target="#b2">[3]</ref> is used to encode data models with the EMF meta-modeling language, namely Ecore, so that tools built atop EMF can be used to implement data migration services.</p><p>The solution presented in this article features the EMF-Syncer <ref type="bibr" target="#b1">[2]</ref>, a synchronization tool for bridging MDEagnostic programs and MDE-aware programs, which may have some similarities in their object-oriented data models 1 , at run time. EMF-Syncer provides a generic synchronization strategy that exploits such similarities automatically and is, therefore, a suitable candidate for solving the proposed problems, since each problem relies on a small change and there is a large overlap between two versions of the same data model. The EMF-Syncer assumes that MDE-agnostic programs are implemented in a JVM language and that MDE-aware programs represent their data model using EMF-generated code.</p><p>Given a source data model (represented in a package of classes in the MDE-agnostic program), a target data model (represented as an Ecore model in an EMF-based program), and a collection of objects representing the source program state, EMF-Syncer translates the MDEagnostic objects as an EMF model instance in the target EMF-based program, synchronizing the state of both programs at run time. EMF-Syncer automatically infers structural similarities between object-oriented data models by mapping object structural features by name, when found, translating both attribute and reference values. This translation can be performed using a push-based model, where the entire source program state is migrated, or using a pull-based model, where only those feature values accessed in the target program are migrated. Once synchronization is established, changes that have been applied to target EMF model instances can be incrementally back-propagated to the source MDE-agnostic counterpart. Incrementality of back-migration entails that only changes in target model instances are propagated back and merged within the source instance.</p><p>The aforementioned generic mapping strategy that is built in EMF-Syncer can be customized in order to allow for more complex data transformations between the data models involved. A domain-specific mapping strategy is declared with a mapping specification that maps a source feature type to a target feature type, possibly including feature value transformations, either from source to target, or from target to source, or both. Two main custom mapping strategies can be declared: For the TTC 2020 case, we are relying on the observation that an EMF-based program can be regarded as a plain Java program. Hence, the given Java program will refer to the source data model and the EMF-based program will refer to the target data model. In the following sections, we discuss the solution to the case in §2, and the evaluation of the solution in §3 using the evaluation criteria proposed in the case, wrapping up with some conclusions in §4.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.">Solution</head><p>The solutions to the different tasks of the case are explained below and are available at https://github.com/emf-syncer/ttc20-roundtrip.</p><p>The solution has been implemented using the language Xtend <ref type="bibr" target="#b3">[4]</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.1.">Task 1: create/delete field</head><p>In this task, a new feature age is added to the class Person in the modified data model 𝑀2 and when a Person instance is migrated, its feature value is set to -1. When the instance is migrated back, this information is lost.</p><p>The solution Task1_M1_M2_M1, shown in the listing below, illustrates the pattern used in all of the solutions. The EMF-Syncer is used by instantiating the class EMFSyncer between a source Java package name list #['scenario1_v1'] and a target Ecore model in the constructor. All of the solutions use the push-based model in syncForward, which is specified by indicating syncer.syncingStrategy = SyncingStrategy.EAGER, forcing the migration of the entire source instance.</p><p>In the method migrate, the statement syncer.syncForward(person_v1) migrates the source Person instance obtaining the target instance with the age feature, which is not initialized until the statement person_v2.age = -1 is evaluated. In the method migrateBack, the statement syncer.syncBack(person_v2) migrates the instance back to the source Java program.</p><p>The method modify is used to implement changes to target model instances that need to be propagated back. This logic is hardcoded in test cases in the benchmark framework. EMF-Syncer needs to track which changes are performed in the target model instance in order to enable incremental back migration. Therefore, this logic has been moved from test cases to task classes. It is important to note that the bidirectional transformation between both data models is completely inferred by the EMF-Syncer automatically in this task. In the back migration, as the age feature does not exist in the source program, it is not propagated.</p><p>The solution to the symmetric problem Task1_M2_M1_M2 is achieved by inverting the direction in which the EMF-Syncer is applied to the data models, as seen in the listing below. In this case, the data model M2 is regarded as the Java program and the data model M1 as the EMF program. In this case, the value of the age feature of a Person class is preserved on the back migration because this feature does not exist in M1 and, therefore, no changes can be applied to the feature age. In the following subsections, solutions to symmetric problems are achieved by flipping, as for this task, the direction in which the EMF-Syncer is applied and are not included in the paper. </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.2.">Task 2: rename field</head><p>In this task, the feature age of the class Person is renamed to ybirth, and its semantics is changed by representing the age and the year of birth, respectively. This renaming involves domain-specific semantics that is not present in the Ecore model, requiring a mapping specification so that the EMF-Syncer can perform the data transformation correctly.</p><p>A mapping specification consists of a collection of mappings between feature types by name, 'Person', 'age', /* &lt;-&gt; */ 'Person', 'ybirth', by adding optional feature value transformations as lambda expressions. For example, in the solution, the lambda expression gets a Person instance from the source data model and returns the ybirth value. When the EMF-Syncer applies the transformation syncForward, the feature value for Person::ybirth will be obtained by applying this expression. The rest of the solution follows the same structure as the solution explained in §2.1. This solution also contains an example of how to track changes performed in the target instance, in the modify method, that need to be migrated back. This change is encoded in the corresponding test case in the original test framework.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.4.">Task 4: multiple edits</head><p>This task combines Task_1 and Task_2 with the aim of analysing reuse mechanisms that can be employed. The solution below reuses the transformation logic of Task_1, as it is handled by the EMF-Syncer automatically, and it reuses the mapping specification of Task_2, which is defined as a static field. The rest of the solution is as in §2.1, after renaming the corresponding namespaces. </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.">Evaluation</head><p>In this section, we provide an evaluation of the solution according to the evaluation criteria proposed in <ref type="bibr" target="#b0">[1]</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.1.">Expressiveness</head><p>Two test cases are provided for checking the correctness of each task. A test case provides the input for a round-trip migration and the expected output. The test framework has been adapted in order to work with code generated from Ecore models via EMF, which is required by EMF-Syncer . The main properties (namely, name, nsPrefix and nsUri) of the EPackage in each Ecore model were updated in order to generate disjoint namespaces. In test cases, loading resources for each Ecore model was modified in order to use the corresponding generated factory for each model instance. Model instances, used as input/output data, were modified to refer to the corresponding nsUri. In some cases, the test case also performs a change in the target instance, as in Task_3, that needs to be propagated back to the source instance. Such modifications have been encoded in the task itself, in the method modify, as the EMF-Syncer needs to track those changes. Such changes refer to implementation details and do not alter the correctness properties checked<ref type="foot" target="#foot_2">2</ref> by the test suite.</p><p>Solutions for all of the tasks have been implemented and all of them pass the correctness check.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.2.">Comprehensibility</head><p>Task solutions have been implemented using Xtend. However, the EMF-Syncer can be used from Java programs as well. Given that the transformation in most of the solutions is inferred automatically and that solutions use generated code, instead of using the EMF reflection API for accessing/mutating values, we argue that solutions are likely to be more comprehensible than the reference ones.</p><p>When custom mappings are required, e.g. in Task_2 and in Task_4, these are defined by instantiating the class EMFSyncerMapping, where feature value transformations are defined as Xtend lambda expressions. Such mapping expressions could have been defined similarly in Java as well.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.3.">Bidirectionality</head><p>In the solution for most of the tasks, the EMF-Syncer infers both transformations to be applied, syncForward and syncBack, automatically. In such cases, the programmer does not need to provide a transformation specification and a bidirectional data transformation is being used internally so that Java instances can be migrated to an EMF program, and back again, at run time. A custom mapping specification containing only feature type renamings is fully bidirectional. Feature value transformation expressions are unidirectional though.</p><p>Therefore, the EMF-Syncer provides support for bidirectional transformations by default for all of the solutions and accommodates special cases with unidirectional feature value transformations, which correspond to a fraction of the data migration to be performed.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.4.">Re-usability</head><p>Re-usability is internalized in the EMF-Syncer by inferring transformations automatically. That is, when a user does not need to provide a mapping specification, the transformation logic in the EMF-Syncer is reused for any data model change. For example, reuse of the logic transformation in Task_1 falls under this category.</p><p>On the other hand, as EMF-Syncer is a JVM library, a programmer can rely on reuse mechanisms provided by the JVM language of choice. For example, reuse of the transformation logic in Task_2 falls under this category. The mapping specification defined for Task_2 is reused by calling a static field and by using a common interface for the class Person, which has been implemented using inheritance in Task_4.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.5.">Performance</head><p>We have run the performance tests both for the reference solution and for the EMF-Syncer solution on a MacBookPro11,5 Core i7 2.5 GHz, with four cores and 16 GB of RAM. The runtime results (in ms.) obtained are displayed in Fig. <ref type="figure" target="#fig_3">1</ref>. The EMF-Syncer solution exhibits a linear growth with respect to the number of iterations, as instructed in the case benchmark. However, the EMF-Syncer solution is more efficient than the reference one thanks to its support for incremental migration of changes. While the reference solution takes about 31 s. for 2 million iterations, the EMF-Syncer solution takes about 9 s, with an improvement factor of 70%. The incremental propagation relies on a traceability model that caches relevant data at run time. An analysis of memory consumption is left for future work as it was not part of the case benchmark. </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.">Conclusions</head><p>Following from the justification of the evaluation criteria in the section above, the results are summarized in Table <ref type="table" target="#tab_3">1</ref>, where the score 𝑋 out of 𝑌 is expressed as 𝑋(𝑌 ).</p><p>Overall, this solution shows that the EMF-Syncer helps in achieving a competitive trade-off between data migration specification and performance. On the one hand, the automatic inference of data transformations between different object-oriented data models reduces the need for specifying data transformations. When these have to be specified, a programmer can rely on their programming skills, using a JVM programming language, for reusing transformation logic. On the other hand, EMF-Syncer can be used as an efficient data migration service at run time. For example, the EMF-Syncer solution is faster than the reference solution developed in raw Java. EMF-Syncer can be used for building more scalable solutions, involving very large models, by using the pull-based model for propagating changes in syncForward only when they are required in the target program.</p></div><figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_0"><head></head><label></label><figDesc>model1, EPackage model2) { 5 super(model1, model2); 6 syncer = new Syncer(#['scenario1_v1'], model2) 7 syncer.syncingStrategy = SyncingStrategy.EAGER 8 EObject instance) { 18 val person_v2 = instance as scenario1_v2.Person 19 return syncer.syncBack(person_v2) as scenario1_v1.Person 20 } 21 22 override modify(EObject instance) { } 23 }</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_1"><head></head><label></label><figDesc>model1, EPackage model2) { 5 super(model1, model2); 6 syncer = new Syncer(#['scenario1_v2'], model1) 7 syncer.syncingStrategy = SyncingStrategy.EAGER 8 } 9 10 override migrate(EObject instance) { 11 val person_v2 = instance as scenario1_v2.Person 12 return syncer.syncForward(person_v2) as scenario1_v1.Person 13 } 14 15 override migrateBack(EObject instance) { 16 val person_v1 = instance as scenario1_v1.Person 17 return syncer.syncBack(person_v1) as scenario1_v2.Person 18 } 19 20 override modify(EObject instance) { } 21 }</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_3"><head>Figure 1 :</head><label>1</label><figDesc>Figure 1: Performance results (ms.) along iterations</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" type="table" xml:id="tab_2"><head>Expressiveness Comprehensibility Bidirectionality Re-usability Task 1: "Create/Delete Field"</head><label></label><figDesc></figDesc><table><row><cell>Task_1_M1_M2_M1</cell><cell>2 (2)</cell><cell></cell><cell>2 (2)</cell><cell cols="2">1 (1)</cell><cell></cell><cell>n.a.</cell></row><row><cell>Task_1_M2_M1_M2</cell><cell>2 (2)</cell><cell></cell><cell>2 (2)</cell><cell cols="2">1 (1)</cell><cell></cell><cell>n.a.</cell></row><row><cell cols="2">Task 2: "Create/Delete Field"</cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell></row><row><cell>Task_2_M1_M2_M1</cell><cell>2 (2)</cell><cell></cell><cell>2 (2)</cell><cell cols="2">1 (1)</cell><cell></cell><cell>n.a.</cell></row><row><cell>Task_2_M2_M1_M2</cell><cell>2 (2)</cell><cell></cell><cell>2 (2)</cell><cell cols="2">1 (1)</cell><cell></cell><cell>n.a.</cell></row><row><cell cols="2">Task 3: "Create/Delete Field"</cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell></row><row><cell>Task_3_M1_M2_M1</cell><cell>2 (2)</cell><cell></cell><cell>2 (2)</cell><cell cols="2">1 (1)</cell><cell></cell><cell>n.a.</cell></row><row><cell>Task_3_M2_M1_M2</cell><cell>2 (2)</cell><cell></cell><cell>2 (2)</cell><cell cols="2">1 (1)</cell><cell></cell><cell>n.a.</cell></row><row><cell cols="2">Task 4: "Create/Delete Field"</cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell></row><row><cell>Task_4_M1_M2_M1</cell><cell>2 (2)</cell><cell></cell><cell>2 (2)</cell><cell cols="2">1 (1)</cell><cell cols="2">4 (4)</cell></row><row><cell>Task_4_M2_M1_M2</cell><cell>2 (2)</cell><cell></cell><cell>2 (2)</cell><cell cols="2">1 (1)</cell><cell cols="2">4 (4)</cell></row><row><cell>∑︀</cell><cell>: 16 (16)</cell><cell>∑︀</cell><cell>: 16 (16)</cell><cell>∑︀</cell><cell>: 8 (8)</cell><cell>∑︀</cell><cell>: 8 (8)</cell></row></table></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" type="table" xml:id="tab_3"><head>Table 1</head><label>1</label><figDesc>Summary of evaluation results.</figDesc><table /></figure>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="1" xml:id="foot_0">val person_v1 = it as scenario2_v1.Person</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="2" xml:id="foot_1">Integer.valueOf(Calendar.getInstance().get(Calendar.YEAR) -person_v1.age) as Object</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="2" xml:id="foot_2">The test case task_3_M1_M2_M1_b had to be updated in order to check that the name was migrated back correctly.</note>
		</body>
		<back>
			<div type="references">

				<listBibl>

<biblStruct xml:id="b0">
	<analytic>
		<title level="a" type="main">Round-Trip Migration of Object-Oriented Data Model Instances</title>
		<author>
			<persName><forename type="first">L</forename><surname>Beurer-Kellner</surname></persName>
		</author>
		<author>
			<persName><forename type="first">J</forename><surname>Pilgrim</surname></persName>
		</author>
		<author>
			<persName><forename type="first">T</forename><surname>Kehrer</surname></persName>
		</author>
		<ptr target=".org" />
	</analytic>
	<monogr>
		<title level="m">Proceedings of the 13th Transformation Tool Contest, a part of the Software Technologies: Applications and Foundations (STAF 2018) federation of conferences</title>
		<title level="s">CEUR Workshop Proceedings</title>
		<meeting>the 13th Transformation Tool Contest, a part of the Software Technologies: Applications and Foundations (STAF 2018) federation of conferences</meeting>
		<imprint>
			<publisher>CEUR-WS</publisher>
			<date type="published" when="2020">2020</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b1">
	<analytic>
		<title level="a" type="main">Code-first model-driven engineering: On the agile adoption of mde tooling</title>
		<author>
			<persName><forename type="first">A</forename><surname>Boronat</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Proceedings of the 34th IEEE/ACM International Conference on Automated Software Engineering (ASE 2019)</title>
				<meeting>the 34th IEEE/ACM International Conference on Automated Software Engineering (ASE 2019)<address><addrLine>San Diego, CA</addrLine></address></meeting>
		<imprint>
			<publisher>ACM</publisher>
			<date type="published" when="2019">November 11-15. 2019</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b2">
	<monogr>
		<author>
			<persName><forename type="first">D</forename><surname>Steinberg</surname></persName>
		</author>
		<author>
			<persName><forename type="first">F</forename><surname>Budinsky</surname></persName>
		</author>
		<author>
			<persName><forename type="first">M</forename><surname>Paternostro</surname></persName>
		</author>
		<author>
			<persName><forename type="first">E</forename><surname>Merks</surname></persName>
		</author>
		<title level="m">EMF: Eclipse Modeling Framework 2.0</title>
				<imprint>
			<publisher>Addison-Wesley Professional</publisher>
			<date type="published" when="2009">2009</date>
		</imprint>
	</monogr>
	<note>2nd ed.</note>
</biblStruct>

<biblStruct xml:id="b3">
	<monogr>
		<author>
			<persName><forename type="first">T</forename><forename type="middle">E</forename><surname>Foundation</surname></persName>
		</author>
		<ptr target="http://www.eclipse.org/xtend/" />
		<title level="m">Xtend (</title>
				<imprint>
			<date type="published" when="2018">2018</date>
		</imprint>
	</monogr>
	<note>official web page</note>
</biblStruct>

				</listBibl>
			</div>
		</back>
	</text>
</TEI>
