HowTo - Metamodel comparison use case

This HowTo explains how to create weaving models that are used to compare metamodels and to produce ATL transformation.

The general approach of this use case is explained in more details in the Use Cases section.

Instructions

Metamodels: these metamodels are injected into Ecore by clicking in the context menu "Inject KM3 into Ecore metamodel":
- Scade.km3
- ScadeNew.km3;

Producing a new weaving model

A weaving model containing a reference to the woven models (Scade versions) is created manually using the AMW wizard. It creates one root element:

  • In the "models" folder, select "New...", "Weaving Model".
  • In the AMW wizard first page, the following metamodel extensions must be selected:
    - mw_base_extension.km3: the base extension to the core metamodel. It extends all abstract classes of the core weaving metamodel.
    - mmw_match.km3: defines simple links between classes, attributes and references.
    - mmw_compare.km3: defines links with elements without any equivalence in both metamodels.
    - mmw_propagation.km3: defines a set of auxiliary structures to execute the Similarity Flooding algorithm.
  • In the wizard second page, select "New model" and fill the text field with the name of the weaving model (ScadeCmp.amw). After that, select "MatchModel" as the current "WModel". This type of WModel must be selected to be able to execute the matching heuristics correclty.
  • The wizard third page sets up the two models that will be woven. Select first the "leftM" model, and click on "Edit selected model". This button opens a new window. Select "ModelRef" in the "WModelRef" combo. Then select "DefaultWovenPanelExtension", that is the implementation for this type of "WModelRef" (standard identification mechanism of EMF). Finally, select "Scade.ecore" in the metamodel text field.
    The same procedure must be done for the right metamodel, "ScadeNew.ecore".

Executing the matching transformations

The AMW plug-in provides a set of matching transformations that automate the task of creating weaving models. To execute these transformations, open the context menu of the weaving panel (the middle panel) and select the "Match" submenu. This submenu contains a list of the matching transformations available.
This use case executes 5 matching transformations: "Cartesian product", "Name Equality", "Threshold", "Link rewriting" and "Link rewriting - non equivalence". Each matching transformation produces a new weaving model, and adds a predefined suffix to it. This is because we don't want to override the current model. Thus, the new weaving model should be opened to be able to execute the subsequent transformation.

  • Cartesian product: produces a Cartesian product of the elements with the same type. It produces a new weaving model with the suffix "_cp" (ScadeCmp_cp.amw).
  • Name equality: this transformation assigns a high similarity value to the elements that have the same name. It produces a model with the suffix "_equal". (ScadeCmp_cp_equal.amw)
  • Threshold: selects the links with the highest similarity values. Produced model: (ScadeCmp_cp_equal_thres.amw). Suffix: "_thres"
  • Link rewriting: reorganizes the links according to the containment relationships between Classes, Attributes and References. Produced model: (ScadeCmp_cp_equal_thres_lr.amw). Suffix: "_lr"
  • Link rewriting - non equivalence: creates links with the elements that do not have equivalence in the left or right metamodels. Produced model: (ScadeCmp_cp_equal_thres_lr_noneq.amw). Suffix: "_noneq"

Generating and extracting the ATL transformation

The AMW plug-in contains a higher-order transformation (HOT) that interprets the weaving model and that produces an ATL transformation. To execute this transformation, open the context menu of the weaving panel (the middle panel) and select the "Transform" submenu. Then click on "Generate transformation (HOT)". This action produces an ATL model (ScadeCmp_cp_equal_thres_lr_hot.ecore).
The output transformation model is extracted to an ATL file by clicking in the context menu "Extract ATL-0.2 model to ATL-0.2 file".

Installation requirements:

The AMW, ATL and AM3 plug-ins must be installed. See the download page.

Remark(s):

All the injection and extraction menus (Ecore and ATL) are available in the "AM3" perspective and in the "AM3 Resource Navigator" view.