Beruflich Dokumente
Kultur Dokumente
"Families to Persons"
A simple illustration of model-to-model transformation
Freddy Allilaire
Frédéric Jouault
ATLAS group, INRIA & University of Nantes, France
Overview
Prerequisites
Introduction
Family March
Father: Jim
Mother: Cindy
Son: Brandon
Daughter: Brenda
Family Sailor
Father: Peter
Mother: Jackie
Son: David
Son: Dylan
Daughter: Kelly
conformsTo conformsTo
conformsTo
Metametamodel (ECORE)
conformsTo conformsTo
conformsTo conformsTo
What is “Families”:
A collection of families. Family March
Each family has a name and is Father: Jim
Mother: Cindy
composed of members: Son: Brandon
A father Daughter: Brenda
Family Sailor
A mother Father: Peter
Several sons Mother: Jackie
Sons: David, Dylan
Several daughters Daughter: Kelly
Each family member has a first
name.
familyFather father
0..1 1
Family familyMother mother
Member
0..1 1
familySon sons
lastName : String firstName : String
0..1 *
familyDaughter daughters
0..1 *
Person
fullName
Male Female
M2
Families.km3 ATL.km3 Persons.km3
C2 C2 C2
M1
Families2Persons.atl
sample- sample-
Families.ecore Persons.ecore
C2 C2 C2
M2
Families.km3 ATL.km3 Persons.km3
C2 C2 C2
M1
Families2Persons.atl
sample- sample-
Families.ecore Persons.ecore
M1
Families2Persons.atl
sample- sample-
Families.ecore Persons.ecore
IN: Families:
Name of the Name of the
source model in source metamodel
the in the
transformation transformation
OUT: Persons:
Name of the Name of the
target model in target metamodel
the in the
transformation transformation
•
familyFather father
A helper is an auxiliary function 0..1 1
Family Member
that computes a result needed familyMother mother
in a rule. 0..1 1
familySon sons
0..1
father
1
Member
contained in class “Member”. The familyMother mother
familySon sons
name by navigating the relation lastName : String
0..1 *
firstName : String
0..1 *
rule Member2Male {
from
s : Families!Member (not s.isFemale())
to
t : Persons!Male (
fullName <- s.firstName + ' ' + s.familyName
)
}
• Member to Female
rule Member2Female {
from
s : Families!Member (s.isFemale())
to
t : Persons!Female (
fullName <- s.firstName + ' ' + s.familyName
)
}
M3 Ecore.ecore C2
C2 C2 C2
M1
Families2Persons.atl
sample- sample-
Families.ecore Persons.ecore
Summary
Person
• There are a lot of exercise
questions that could be
based on this simple
fullName: String
grandParent
example.
• For example, modify the
Male Female target metamodel as shown
and compute the
"grandParent" for any
Person.