Main Page/Resources/MTBenchmark/Matching

From Atenea

Jump to: navigation, search

Contents

Matching

This case study realizes the cartesian product of two models conforming to the Class Metamodel, so it uses several rules with N..M cardinality. In particular, it takes two input models and combines them using one 2..1 rule and two 2..3 rules.

Metamodels

Input metamodel

Download Class.ecore or show Class.ecore tree view

Image:ClassMM.png

Output metamodel

Download Mapping.ecore or show Mapping.ecore tree view

Image:Mapping.png

Transformation

As an example, in the following we show the ATL transformation for this case study. The code can be downloaded from here.

module MatchTransformation;
create OUT : MatchMM from LEFT : LeftMM, RIGHT : RightMM;
rule CreateMappingModel {
   from pl : LeftMM!Package, 
       pr : RightMM!Package
   to
      model : MatchMM!MappingModel ()
}
rule CreateC2CMapping {
    from
        cl : LeftMM!Class, 
      cr : RightMM!Class 
   to
      mapping : MatchMM!C2C_Mapping (
         left <- leftE,
         right <- rightE,
         mappingModel <- Tuple{ pl = cl.package, pr = cr.package }
      ),
      leftE : MatchMM!ProxyElement (
         name <- cl.name
      ),
      rightE : MatchMM!ProxyElement (
         name <- cr.name
      )   
}
rule CreateA2AMapping {
    from
        cl : LeftMM!Attribute, 
      cr : RightMM!Attribute 
   to
      mapping : MatchMM!A2A_Mapping (
         left <- leftE,
         right <- rightE,
         mappingModel <- Tuple{ pl = cl.owner.package, pr = cr.owner.package }   
      ),
      leftE : MatchMM!ProxyElement (
         name <- cl.name
      ),
      rightE : MatchMM!ProxyElement (
         name <- cr.name
      )   
}   

Input models

The input models are the same that were presented [here] for the Identity case study.

Personal tools