Skip to main content
October Donation Campaign Donate Now

HowTo - Model difference use case

This is a step by step document that explains how to generate the generic match and difference transformations, and how to execute them.

The use case was applied to two different KM3 models, Relational and Class. The initial configuration is set up to the Relational models.

Installation

  • Install ATL, AM3 (tested with CVS version of Feb 21st, 2007). Do not forget the antlr.jar and ant-contrib.jar files. These jars are used in the Ant Scripts.
  • Install the Atlas Model Weaver (tested with CVS version of Feb 21st, 2007). See the download page. This use case requires the installation of the AMW Model Handler plug-in (org.eclipse.gmt.weaver.amw4atl).
  • Create a new Eclipse launch config (Eclipse Application). Tested with JRE 1.5.0_06.
  • Import the project HOTMatchAndDiff into the workspace

Configuration

Folder's description

build/
  • ATLFiles/ : contains the HOTs (higher-order transformations) used to generate the match, diff and patch transformations.
  • metamodels/ : contains the weaving metamodels for the match&diff, match parameters & TCS (for ATLModel2ATLFile).
  • models/ : contains the TCS (textual concrete syntax) model used to extract an ATL model into an ATL file. (ATL-0.2-TCS.ecore)

metamodels/
This folder contains the input metamodels (Class and Relational). It is necessary to have a KM3 an an Ecore version of each metamodel.

models/
This folder contains the sample input models (KM3 and Relational), and the patched model.

output_matchAndDiff_<KM3>/
This folder contains the weaving models generated after the match and diff transformations, and the patch transformation.

Configuration of the Ant Scripts

  • Refresh Tab: select "Refresh the project containing the selected resource"
  • Build Tab: select "Build the project containing the selected resource"
  • Classpath Tab: add antcontrib.jar & antlr.jar
  • JRE Tab: select "Run in the same JRE as workspace"
    • The Ant Scripts should be modified depending on the input models or metamodels (it is initially set up to the "Relational" models). To do this, modify the property metamodel_name according to the name of the metamodel (e.g., set up the property to "Relational" when using the Relational.km3 file) :
      Example :

       <property name="metamodel_name" value="Relational"/> 

      Execution

      The example is divided in three phases:

      Generating the transformations

      This phase generates the metamodel-specific match and difference transformations. The first step is to execute the genMatchParameters.xml script. This script generates a parameter model for a specific metamodel (e.g., KM3 or Ecore).

      Then, set up the threshold and ratio properties of the parameter model. The parameter model is located at matchAndDiff_/MatchParameters_<metamodelName>.ecore. There are two examples previously configured in the root folder. To use them, overwrite the file previously generated.

      Finally, execute the GenMatchAndDiff.xml script. This script executes the higher-order transformations that generate the metamodel-specific match and diff transformations (in the matchAndDiff_<metamodelName> folder).

      Executing the match and difference transformations

      The ApplyMatchAndDiff.xml executes the metamodel-specific match and difference transformations. These transformations are generated by the GenmatchAndDiff script. It is necessary to set up the oldModelFilename and newModelFilename properties (the script is already pre-configured to execute the difference between the "Relational" models).

      The match and diff results are in the folder output_matchAndDiff_<metamodelName>

      Executing the patch transformation

      The patch transformation is generated in the output_matchAndDiff_<metamodelName> folder. Execute the ANT Script applyPatch_<oldModelFilename>-<newModelFilename>.xml. The patched model is generated in the models folder.

Back to the top