SyncATL: An ATL-based Synchronization Tool

News

Introduction

SyncATL is a tool for synchronization Ecore models related by an ATL byte-code program.

By using ATL, we can transform models in one metamodel into models in another metamodel. However, there are situations where only transformation from one model to another is not enough. Users may change models after the transformation in both the source side and the target side, causing maintenance problems. Consider the following scenario: first designers create a Unified Modeling Language (UML) model to describe the system design, and then perform a model transformation on the UML model to produce a Java model for programmers to implement the system. Programmers add code and methods to the Java model, while at the same time, designers change the name of a class on the UML model. Now the UML model and the Java model become inconsistent and need to be synchronized. Simply performing the transformation from UML model to Java model again will not synchronize the models, because the modifications on the Java model will be lost. To synchronize the models, we need to propagate the modifications both from the UML model to the Java model and from the Java model to the UML model.

SyncATL is just for this purpose. Given a modified source model and a modified target model, together with the original source model and the ATL transformation, SyncATL can produce the synchronized source model and the synchronized target model with the modifications propagated across models.

The current implementation of SyncATL is mainly served as a demonstration and an evaluation of the approach we proposed in our ASE07 paper, and is not stable enough for serious use.

People

Zhenjiang HuAssociate Professor at the University of Tokyo
Dongxi LiuResearcher at the University of Tokyo
Hong MeiProfessor at Peking University
Hui SongPh.D. Student at Peking University
Masato TakeichiProfessor at the University of Tokyo
Yingfei XiongPh.D Student at the University of Tokyo
Haiyan ZhaoAssociate Professor at Peking University

Publications

[ASE07] Yingfei Xiong, Dongxi Liu, Zhenjiang Hu, Haiyan Zhao, Masato Takeichi, Hong Mei. Towards Automatic Model Synchronization from Model Transformations. In ASE'07: Proceedings of the 22nd IEEE/ACM International Conference on Automated Software Engineering, Atlanta, Georgia, pages 164-173, November 2007. [Paper][Slides][Bib]

Download

Prerequirement: JRE 1.5 ( not work with JRE 1.6 )

Download:

To install, just unzip the package into any directory you like.

A Guide to the Samples

The current release is shipped with five samples. The "UML2Java" is the running example used in the ASE07 paper, the "Class2Relational" is the case study presented in the ASE07 paper, and other examples are obtained from the ATL website.

To use the scripts for the examples, you must be under Windows. It should work on other operation system by making small modifications to the scripts, but I have not tested it.

The steps for trying out a sample is as the following

  1. Make the directory of the sample the current directory of the system.
  2. Run "transform.bat" to perform the original transformation. This file also create "*-modified.*" files for users to make modifications.
  3. Modify the "*-modified.*" files.
  4. Run "synchronize.bat" and the tool will produce the synchronized models, "*-synchronized.*".
  5. After you have finished the test, run "clear.bat" to delete the files created during the process.

How the Tool Works

As shown in the above figure, SyncATL synchronize models (conceptually) using the following steps:

  1. SyncATL executes the original transformation to produce the original target model.
  2. SyncATL compares the original source model with the modified source model, finding out what modifications users have made on the source model.
  3. SyncATL compares the original target model with the modified target model, finding out what modifications users have made on the target model.
  4. SyncATL propagates the modifications on the source model to the target model according to the transformation program.
  5. SyncATL propagates the modifications on the target model to the source model according to (conceptually) the inverse of the transformation program.

Key Attributes

When comparing original models with modified models, one important question is how to know which model element in the modified model corresponds to a model element in the original model. For example, suppose an original model contains elements "A" and "B", and the modified model contains only an element "C". It is possible that C is modified from A and B is deleted or C is modified from B and A is deleted. It is also possible that A and B are both deleted and C is inserted. It is difficult to know exactly which modifications users have made.

To solve this problem, SyncATL assumes each class of model elements has a set of attributes, called key attributes, to uniquely identify a model element and not to be modified by users. When comparing models, SyncATL match model elements with the same key attributes and assumes they are of the same model element. All unmatched model elements in the original model are considered as deleted and all unmatched model elements in the target model are considered as inserted.

To annotate a key attributes, we add an "eAnnotations" to an "eStructuralFeatures" element. The "eAnnotations" must have a source of "http:///jp.ac.u_tokyo.ipl.BiXM.AttributeAnnotations" and with a detail "PrimaryAttribute=true", as shown by the following example:

<eStructuralFeatures xsi:type="ecore:EAttribute" name="ID" eType="/0/Integer" iD="true">
<eAnnotations source="http:///jp.ac.u_tokyo.ipl.BiXM.AttributeAnnotations">
<details key="PrimaryAttribute" value="true"/>
</eAnnotations>
</eStructuralFeatures>

The attribute "ID" is annotated as a key attribute. You can annotate multiple attributes in one classifier, and all of them uniquely identify a model element as a group.

To ease the process of adding key attribute to existing models and transformation programs, we provide a small tool "AddID.jar" to automatically add an "ID" key attribute to existing models. The usage of "AddID.jar" is as the following:

java -jar AddID.jar --mm <source meta model path><target meta model path>Add an ID attribute to each class in the meta model
java -jar AddID.jar --m <ID meta model path><source model path><target model path>Initialize the ID attribute in a model originally having no ID attribute
java -jar AddID.jar --atl <source ATL program><target ATL program>Convert an ATL program so that it also transforms the ID attribute

Detailed Usage

The tool has two execution mode. One is used to invoke the original ATL model transformation, and the other mode is to synchronize models.

Transformation Mode

The command parameters are:

java -jar BiXM.jar --f --trans <transformation program>
[--src <id>=<model><id>=<metamodel>]
[--tgt <id>=<model><id>=<metamodel>]

--trans: specifying the path to the ATL byte-code program.
--src: specifying a source model. The <id> must be consistent with the names used in the ATL program. The <model> and <metamodel> are the paths to the model and the meta model, respectively. You can specifies multiple model by using the parameter multiple times.
--tgt: specifying a target model. The <id> must be consistent with the names used in the ATL program. The <model> and <metamodel> are the paths to the model and the meta model, respectively. You can specifies multiple model by using the parameter multiple times.

The files "transform.bat" in sample directories are examples showing how to invoke this mode.

Synchronization Mode

Note synchronization only works with models having key attributes. Refer to key attributes for more detail.

The command line parameters for synchronizing are:

java -jar BiXM.jar --s --trans <transformation url>
[--src <id>=<model><id>=<metamodel>]

[--tgt <id>=<model><id>=<metamodel>]
[--modifiedSrc <id>=<model>]
[--outSrc <id>=<model> ]
[--outTgt <id>=<model> ]
[--checkif]

--s: indicating the tool should run in synchronization mode.
--trans: specifying the path to the ATL byte-code program.
--src: specifying a source model. The <id> must be consistent with the names used in the ATL program. The <model> and <metamodel> are the paths to the model and the meta model, respectively. You can specifies multiple model by using the parameter multiple times.
--tgt: as same as "--src" excepting it specifies a modified target model.
--modifiedSrc: specifying a URL to a modified source model. The <id> should be consistent with the <id> in "--src" and the model names used in the transformation program.
--outSrc: specifying a path where the synchronized source model will be stored.
--outTgt: specifying a path where the synchronized target model will be stored.
--checkif: when this parameter is present, the tool will check the violation of conditional expressions. See the companion paper for more details.

The files "synchronize.bat" in the sample directories are examples to invoke the tool in the synchronization mode.

Limitations

Support of Other Transformation Languages

Our tool should be able to support programs in the QVT procedure language by using the transformation from QVT to ATL byte-code. However, we have not tested this out.

Contact

Please contact us at