1
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 1 -
Model Transformation and Weaving Model Transformation and Weaving Tools in the AMMA PlatformTools in the AMMA Platform
Jean Bézivin, Marcos Didonet Del Fabro, Frédéric Jouault{jean.bezivin, marcos.didonet-del-fabro, frederic.jouault}@univ-nantes.fr
ATLAS group (INRIA & LINA), University of Nantes, Francehttp://www.sciences.univ-nantes.fr/lina/atl/
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 2 -
Contents
• Introduction• Model Engineering Overview• AMMA Platform Overview
• Model Transformation with ATL• Model Weaving with AMW• Case Study: Bridging UML Profiles and Domain
Specific Languages• Demonstrations
>
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 3 -
Model Engineering Overview
Metametamodel
Metamodel
Model
NodePlace
PlaceP1
PlaceP2
NodeTrans
NodeNode
NodeLink
LinkarcPT
LinkarcTP
TransT1
arcPT arcTP
LinkinCom
LinkoutGo
outGo
outGo
inCom
inCom
Linkmeta
outGo
inCom
inCom outGo
outGo inCom
conformsTo
conformsTo
conformsTo
meta
repOf
System
P2
P1
T1
Classicalrepresentation
M1
M2
M3
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 4 -
AMMAAMMA
ATLATL AMWAMW AM3AM3 ATPATP
Model TransformationModel WeavingGlobal Model Management(Megamodel)
Technical Projectors
CombiningModel Transformation and Model Weaving
AMMA: a Lightweight Model Engineering Architectural Style
AMMA Platform Overview
2
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 5 -
Contents
• Introduction• Model Transformation with ATL
• Definitions• ATL Overview• ATL Development Tools
• Model Weaving with AMW• Case Study: Bridging UML Profiles and Domain
Specific Languages• Demonstrations
>
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 6 -
Model transformation definition
• By definition, a model transformation is the automatic creation of target models from source models.
• Model transformation is not only about M1 to M1 transformations:• M1 to M2: promotion,• M2 to M1: demotion,• M3 to M1, M3 to M2, etc.
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 7 -
Some definitions
MOF
MMa MMb
Ma MbMMa2MMb.atl
ATLMMa is thesourcemetamodel
Ma is the source model Mb is the target model
MMB is thetargetmetamodel
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 8 -
G 2 PRule
R 2 BRule
Small theory
Ma Mb
MMaGreenNode
RedNode
MMbBlueNode
PinkNode
Metametamodel
NodeNode
ATLRuleNode
MMa2MMb.atl
conformsTo conformsTo
conformsTo conformsTo
conformsTo
3
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 9 -
ATL Overview
• Source models and target models are distinct.• Source models cannot be modified, only navigated.• Target models cannot be navigated.• The language is a declarative-imperative hybrid:
• There are declarative matched rules.• There are imperative called rules (to be implemented).
• An imperative rule is basically a procedure.• A declarative rule specifies:
• a source pattern to be matched in the source models,• a target pattern to be created in the target models for each
match.
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 10 -
Execution order
• The order in which rules are matched and applied is not specified.
• The order in which bindings are applied is not specified.
• The execution of declarative rules can however be kept deterministic:• The execution of a rule cannot change source models: it cannot
change a match,• Target elements are not navigable: the execution of a binding
cannot change the value of another.
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 11 -
The ATL Virtual Machine Architecture
Model Handler Abstraction Layer
Eclipse
EMF
Netbeans
MDR…
ATL VM
Model repository*
*The simplest form of a model repository is a file system.
XMI 2.0XMI 1.2
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 12 -
ATL Development Tools (ADT): an Eclipse-based IDE for ATL
• ATL perspective and ATL project• ATL Code editor
• Syntax highlighting• Outline• Error reporting
• ATL Builder• ATL Debugger
• Source-level debugging• Stepping through elementary operations• Breakpoints support
4
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 13 -
ATL Development Tools: perspective, editor and outlineModel Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 14 -
ATL Development Tools: launch configuration
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 15 -
ATL Development Tools: source-level debuggerModel Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 16 -
Contents
• Introduction• Model Transformation with ATL• Model Weaving with AMW
• Definitions• Weaving metamodel• Weaving as models: advantages• Combining model weaving and transformation
• Case Study: Bridging UML Profiles and Domain Specific Languages
• Demonstrations
>
5
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 17 -
Model Weaving
•Model Weaving means:•Establishing typed links between model elements•Representing these links as models•Defining link types in a metamodel
Library (RDBMS)Books
ISBNTitleSubjectIDPublisher
SubjectsSIDDescription
Library (XML)Books
ISBNTitlePublisherIDSubjects
SIDDescription
PublisherPIDName
FKConstraint
NestedConstraint
New ID
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 18 -
Model Weaving Use Cases
• Data exchange• Schema evolution• Heterogeneous data integration• Mapping between models and a graphical representation• Transformation specifications• Etc.
Library (RDBMS)Books
ISBNTitleSubjectIDPublisher
SubjectsSIDDescription
Library (XML)Books
ISBNTitlePublisherIDSubjects
SIDDescription
PublisherPIDName
FKConstraint
NestedConstraint
New ID
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 19 -
•Models: directed graphs•Mappings: how to represent them?
Models
e1
e2Mod
el e3 e4
me1
me2
Met
amod
el
me3
Meta edges
e1
e2
Mod
el1
e3
e4
me1me2
Met
amod
el1
meta?correspondence:
(isA?)
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 20 -
Weaving model
•Correspondences as first class entities and with semantics•Conforms to a weaving metamodel• Weaving link
• concatenation, ordered, equals, containment,supplier/consumer, etc.
• Namespace
e1
e2
e3
Model 1
e1 e2
Model 2
e3 e4
Equals
Concat
String
Weaving model
6
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 21 -
Weaving core metamodel
• Several weaving metamodels (extending a minimal metamodel)• we cannot predict all weaving semantics
not a general purpose weaving language Linking semantics
Namespacesemantics
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 22 -
•Use of same model management primitives•Add, delete, update, navigation
•Expressiveness •Reason about mappings (infer about mappings)
(“The fundamental role of a reasoning engine is to derive new information via automated inference”[sigmod04])
•Foreign keys, nested constraints, ordering, concatenation, merge, etc.•Hard to express with 1-1 correspondences
(semantics implemented ad-hoc)
Weaving as models: advantages
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 23 -
•Adaptability•Minimal metamodel + extensions
•Namespace extensions, matching based extensions, concatenation, ordered, equals, containment, supplier/consumer
•Efficiency and reuse•Weaving model is a specification, it is not
executable •Same weaving model used to produce:
• ATL –> model transformation language• XSLT –> XML• Morphisms -> generic model management• SQL –> relational databases
Weaving as models: advantagesModel Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 24 -
Efficiency and reuse: weaving model + transformations
MwMMa MMb
G
TMa Mb
Semi automatic
Automatic
Automatic
- Weaving
- Producing T from Mw(based on patterns)
- Transforming models
7
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 25 -
Combining Model Weaving and Model TransformationLibrary (RDBMS)
BooksISBNTitleSubjectIDPublisher
SubjectsSIDDescription
Library (XML)Books
ISBNTitlePublisherIDSubjects
SIDDescription
PublisherPIDName
Weavingmodel
FKConstraint
NestedConstraint
New ID
rule Books {from
s : RDBMS!BookRcdto
t : XML!Book (ISBN <- s.ISBN,Title <- s.Title,Author <- s.Author,subjects <- RDBMS!SubjectRcd.
allInstances()->select(e |e.SID = s.SID
))
}
rule Subjects {from
s : RDBMS!SubjectRcd (RDBMS!BookRcd.allInstances()
->exists(e | e.SID = s.SID))
tot : XML!Subject (
SubjectID <- s.SID,Description <- s.Description
) }
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 26 -
For a given weaving model, two representations: ATL and XSLT
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 27 -
AMW Example: represented semantics
Semantics
SQL schema represented in Ecore
XML schema represented in Ecore
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 28 -
AMW Example: some UI facilities
Item providers extensions
Identification mechanism
Plugged panels
8
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 29 -
Contents
• Introduction• Model Transformation with ATL• Model Weaving with AMW• Case Study: Bridging UML Profiles and Domain
Specific Languages• Overview• UML Profiles• Implementation Architecture
• Demonstrations
>
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 30 -
Bridging UML profiles and Domain Specific Languages*
• Two major approaches appear in Model Engineering to model domain specific concepts: • UML approach : uses a single, large, general purpose
metamodel, extensible through profiles.• DSL (Domain Specific Languages) approach: uses a large
number of small, domain specific, metamodels.
• We need interoperability between these approaches:• A tool which can perform automatic transformations between
profiled UML models and models conforming to corresponding metamodels.
*Work realized by Anas Abouzahra.
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 31 -
UML Profiles (1/2)
• UML profiles are dedicated to the strategic intention to formalize and support the development of applications with UML:• It allows designers to customize UML to their particular domain or
purpose .• It defines virtual UML subclasses by associating stereotypes, tag
definitions and constraints to provide an additional meaning to UML classes.
The UML class and optional stereotypes, which combination represent the MetaModel_Class
MetaModel_Class
UML ElementMetaModelElement
Mapping table • Profiles are generally represented by mapping tables which show correspondences between stereotypes and concepts.
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 32 -
• Each element of the profile maps to a specific metamodel element
• The mapping table is completed by mapping details:• They define more precisely each map
between UML and metamodel elements.• Each mapping details contains
subsections covering these topics: tags, mapping properties, constraints, and limitations.
• Tags are used for metamodel properties not directly supported by UML.
• Some domain specific details cannot be rendered in UML using profiles. Those details are described in a limitationssection.
ValueTag
UMLMOF Feature
Tags
Feature Map
UML Model Constraints
Limitations
UML Profiles (2/2)
9
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 33 -
Example: UML Profile For MOF (1/2)
• Purpose: using widely available UML CASE tools to design metamodels
• Each element of the profile maps to a specific MOF element.
UML ElementMetaModel Element
Attribute with <<reference>> stereotype or AssociationEnd (if implicitReferences is set to true)Reference
DataTypePrimitiveType
Dependency with <<import>> or <<clustering>> stereotypeImport
ConstraintConstraint
DataValueConstant
Exception or Class with <<exception>> stereotypeException
AssociationAssociation
Model or Package, both with <<metamodel>> stereotypePackage
UML Profile For MOF: concepts mapping table
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 34 -
• Each element of the profile maps to a specific MOF element as shown in the mapping table above.
• The mapping table is completed by mapping details.
true (default) or falseorg.omg.uml2mof.hasImplicitReferences
ValueTag
other packages on supplier end of UML dependencies stereotyped as <<subtyping>> that binds them to this package.
supertypes
always set to public_visvisibility
isAbstractisAbstract
isLeafisLeaf
isRootisRoot
ownedElement, taggedValuecontents
namespace or null if the namespace is either null or not mapped to a MOF Package
container
UMLMOF Feature
The order of elements is not fully preserved when rendered using the profile as UML since it has separate associations for ownedElementand taggedValue.
UML Model/Package representing a nested MOF Package must not have a tag org.omg.uml2mof.hasImplicitReferences.
Tags
Feature Map
UML Model Constraints
Limitations
Example: UML Profile For MOF (2/2)
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 35 -
Profile metamodelModel Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 36 -
Profile metamodel
• The definition of each virtual UML subclass which corresponds to a definition of a Profile element (in particular a class of the metamodel profiled) can be done in several ways.
• An UML element can take more than one stereotype to define the same element of the metamodel profiled. However, it can also take different stereotypes to define different elements.
• We should have the possibility to navigate the UML elements used by the Profile and have access to some of their attributes and values
Profile MetaModel
10
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 37 -
Implementation Architecture
MOF
<<DSLa>>
UML DSLa
Ma Ma
conformsTo conformsTo
conformsToconformsTo
UML DSLa
DSLa2UML.atl UML2DSLa.atl
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 38 -
Implementation Architecture
MOF
<<DSLa>>
UML DSLa
Ma Ma
Weavingmodel
Transformations
conformsTo conformsTo
conformsToconformsTo
DSLa2UML.atl UML2DSLa.atl
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 39 -
Using ATL transformations (1/3)
ProfileMetaMMa
MOF
Ma.uml*Ma
* Uses UML Profile for MMa
UMLMMWeaver
ProfileForMMaMWeaver
T1Atl
weaving conforming transformation
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 40 -
Using ATL transformations (2/3)
ProfileMetaMMa
MOF
Ma.uml*Ma
* Uses UML Profile for MMa
UMLMMWeaver
ProfileForMMaMWeaver
T2Atl
weaving conforming transformation
11
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 41 -
Mprofile
MAMW
MMA
TUMLtoMM
TMMtoUML
TAMWtoATL
M’uml
M’MMMuml
MMM
{M’uml, M’MM } = TUML<->MM(MMA , MAMW , Mprofile , MMM , Muml)
M’uml = TMMtoUML ( MMM )
M’MM = TUMLtoMM ( Muml )
{TUMLtoMM, TMMtoUML} = TAMWtoATL(MMA , MAMW , Mprofile)
Using ATL transformation (3/3)
TUML<->MM
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 42 -
The ProfileForMOF Model
• profile ProfileForMOF : MOF {
……
define AssociationEnd {UML!AssociationEnd {
tag documentation ; -- AssociationEnd.annotation
}nested{
ref name;ref namespace;ref constraint;ref participant;ref multiplicity {range { lower , upper } };ref ordering : literal {ok_ordered (true) , ok_unordered(false)} ;
-- isOrdered is mapped to ordering (where true corresponds to ordered)
ref isUnique : boolean = true;ref aggregation : literal {ak_composite , ak_aggregate ,ak_none};ref isNavigable;ref changeability : literal {ck_changeagle (true), ck_frozen(false) , ck_addOnly(false)};
}}
……
}
any stringdocumentation
ValueTag
ModelElement.constraintconstraints
ModelElement.namespacecontainer
body of the first comment in ModelElement.comment; value of documentation tag
annotation
ModelElement.namename
UMLMOF Feature
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 43 -
Weaving model of the profile for MOF
Any stringdocumentation
true or falsealyasFor
ValueTag
ModelElement.constraintconstraints
ModelElement.namespacecontainer
ModelElement.namename
UMLMOF Feature
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 44 -
Contents
• Introduction• Model Transformation with ATL• Model Weaving with AMW• Case Study: Bridging UML Profiles and Domain• Demonstrations>
12
Model Transformation and Weaving Tools in the AMMA Platform
© 2005 ATLAS Nantes- 45 -
End of the presentation
ThanksQuestions?Comments?
[email protected] group, INRIA & LINA, Nantes