Cours #9 - Eclipse

Download Report

Transcript Cours #9 - Eclipse

An ATL Example
Bridging UML profiles and Domain Specific Languages
• Two major approaches appears in Model Engineering:
• UML approach : It uses profiles to model domain specific
•
concepts .
Approach based on DSL (Domain Specific Languages):
It aims at representing every domain with a
specific metamodel.
• We need interoperability between these approaches:
• A tool which can perform automatic transformations between
UML models defined using a profile for a metamodel and
models conforming to this metamodel.
-1-
© 2005 ATLAS Nantes
An ATL Example
The tool
MOF
UML
MMa
Ma
THE TOOL
Ma.uml*
* Uses UML Profile for MMa
-2-
© 2005 ATLAS Nantes
An ATL Example
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.
Profiles are generally
represented by mapping
tables which show maps
between profiled MetaModel
elementets and UML ones.
Mapping table
MetaModel Element
UML Element
MetaModel_Class
The UML class and eventualy
stereotypes which represent
the MetaModel_Class
-3-
© 2005 ATLAS Nantes
An ATL Example
UML Profiles (2/2)
•
•
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 MOF elements.
Each mapping details contains
subsections covering these topics:
tags, mapping properties, constraints,
and limitations.
Tags are used for MOF properties not
directly supported by UML.
Some MOF details cannot be rendered
in UML using this profile. Those details
are described by limitations.
Tags
Tag
Value
Feature Map
MOF Feature
UML
UML Model Constraints
Limitations
-4-
© 2005 ATLAS Nantes
An ATL Example
UML Profile For MOF (1/2)
•
•
Each element of the profile maps to a specific MOF element.
Table below show some mapping element .
UML Profile For MOF : mapping table
MetaModel Element
UML Element
Package
Model or Package, both with <<metamodel>> stereotype
Association
Association
Exception
Exception or Class with <<exception>> stereotype
Constant
DataValue
Constraint
Constraint
Import
Dependency with <<import>> or <<clustering>> stereotype
PrimitiveType
DataType
Reference
Attribute with <<reference>> stereotype or AssociationEnd (if implicitReferences is set to true)
-5-
© 2005 ATLAS Nantes
An ATL Example
UML Profile For MOF (2/2)
Tags
•
•
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.
Tag
Value
org.omg.uml2mof.hasImplicitRe
ferences
true (default) or false
Feature Map
MOF Feature
UML
container
namespace or null if the namespace is
either null or not mapped to a MOF
Package
contents
ownedElement, taggedValue
isRoot
isRoot
isLeaf
isLeaf
isAbstract
isAbstract
visibility
always set to public_vis
supertypes
other packages on supplier end of UML
dependencies
stereotyped
as
<<subtyping>> that binds them to
this package.
UML Model Constraints
UML Model/Package representing a nested MOF Package must not
have a tag org.omg.uml2mof.hasImplicitReferences.
Limitations
The order of elements is not fully preserved when rendered using the
profile as UML since it has separate associations for ownedElement
and taggedValue.
-6-
© 2005 ATLAS Nantes
An ATL Example
UML Profile for Data Modeling (1/2)
•
•
Stereotypes for
Various
Persistent
Storage
Mechanisms
Stereotype
Storage Mechanism Type
<<File>>
File
<<Hierarchical Database>>
Hierarchical database
<<Object-Oriented Database>>
Object-oriented database (OODB)
<<Object-Relational Database>>
Object-relational database (ORDB)
<<Network Database>>
Network database
<<Relational Database>>
Relational database (RDB)
<<XML Database>>
XML database
Example of
physical data
model for a
relational
database using
the profile
-7-
© 2005 ATLAS Nantes
An ATL Example
UML Profile for Data Modeling (2/2)
Stereotypes for Classes
Stereotype
DiagramType
Core Notation
Application
Style Issues
<<Associative
Table>>
Physical
Yes
Apply this to associative tables in a PDM for a
relational database.
<<Entity>>
Logical,
Conceptual
No
Optional notation that is implied by the model type.
<<Index>>
Physical
No
Apply this when you are modeling an index that
implements a table key within a relational
database. Doing so indicates a dependency
from the index to the table or to the key
column(s) that the index implements.
The stereotypes for LDMs and conceptual
DMs on a diagram implies that all
class boxes on the diagram are
entities unless otherwise marked.
Indices are implied by keys, so you might
not want to invest the time to model
the index in the first place.
<<Lookup
Table>>
Physical
No
Apply to tables that are used to store simple
"lookup" lists.
Just because you are using a table for
lookup values does not imply that
everyone uses it that
way. Therefore you may not wish
to mark the table with this
stereotype as it may confuse people.
<<Stored
Procedures>>
Physical
Yes
Apply this to a class that contains only the
operation signatures for the stored
procedures of the database.
<<Table>>
Physical
No
Optional notation that is implied by the model type.
<<View>>
Physical
Yes
Apply this when you are modeling a view to a table.
Indicate a dependency to each table involved
in the definition of the view.
The stereotype for PDMs on a diagram
implies that all class boxes on the
diagram are tables unless otherwise
marked.
-8-
© 2005 ATLAS Nantes
An ATL Example
The tool configuration (1/3)
MOF
MMa
Ma
MMWeaver
ProfileMeta
MWeaver
ProfileForMMa
Ma.uml*
T1Atl
* Uses UML Profile for MMa
UML
weaving
conforming
-9-
transformation
© 2005 ATLAS Nantes
An ATL Example
The tool configuration(2/3)
MOF
MMa
Ma
MMWeaver
ProfileMeta
MWeaver
ProfileForMMa
Ma.uml*
T2Atl
* Uses UML Profile for MMa
UML
weaving
conforming
- 10 -
transformation
© 2005 ATLAS Nantes
An ATL Example
The tool configuration(3/3)
Muml
MMM
TMMtoUML
MMA
TAMWtoAT
MAMW
L
Mprofile
TUMLtoMM
MMM
Muml
Muml = TAMWtoATL ( MMM , Mprofile )
=TUMLtoMM( MMM )
TUMLtoMM = TAMWtoATL (MMA , MAMW , Mprofile )
- 11 -
© 2005 ATLAS Nantes
An ATL Example
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
+owner
Profile
+metaModelTarget : string
1
+definitions
ProfileDefinition
1..*
1
+owner
1..*
1..*
+umlConcepts
+elements
1
ProfileElement
UmlConcept
+umlConceptOwner
+tagOwner
TagDefinition
1
1
+stereotypeOwner
Stereotype
+tagDefinitions
1
0..*
+owner
0..1
+parent
+stereotype
Node
0..*
+nestedReferences
1
0..*
+val : string
+child
NestedReference
+type : string
- 12 -
© 2005 ATLAS Nantes
An ATL Example
The ProfileForMOF Model
•
profile ProfileForMOF : MOF {
Tag
Value
documentation
any string
……
MOF Feature
define AssociationEnd {
UML!AssociationEnd {
name
tag documentation ;
-- AssociationEnd.annotation
annotation
}
nested{
ref name;
container
ref namespace;
ref constraint;
constraints
ref participant;
ref multiplicity {range { lower , upper } };
ref ordering : literal {ok_ordered (true) , ok_unordered (false)} ;
UML
ModelElement.name
body of the first comment in
ModelElement.comment; value of
documentation tag
ModelElement.namespace
ModelElement.constraint
-- isOrdered is mapped to ordering (where true corresponds to ordered)
ref
ref
ref
ref
}
isUnique : boolean = true;
aggregation : literal {ak_composite , ak_aggregate ,ak_none};
isNavigable;
changeability : literal {ck_changeagle (true), ck_frozen(false) , ck_addOnly(false)};
}
……
}
- 13 -
© 2005 ATLAS Nantes
An ATL Example
Using AMW for mapping details (1/4)
• Five types of correspondences:
• LinkDef
• LinkElem
• Nested
• IfNested
• NewType
- 14 -
© 2005 ATLAS Nantes
An ATL Example
Using AMW for mapping details (2/4)
• Example :
MOF
UML
AssociationEnd
AssociationEnd
multiplicity
multiplicity
lower
range
upper
lower
isOrdered
upper
isUnique :True
ordering : OrderingKind
{ok_ordered ,
ok_unordered }
True <- ok_ordered
False <- ok_unordered
- 15 -
© 2005 ATLAS Nantes
An ATL Example
Using AMW for mapping details (3/4)
• Example:
Profile ProfileForMOF
The Weaving Model
ProfileDefinition AliasType
LinkDef AliasType
ProfileDefinition Association
LinkDef Association
ProfileDefinition AssociationEnd
LinkDef AssociationEnd
ProfileElement
UmlConcept AssociationEnd
…
EClass MultiplicityType
EAttribute lower
EAttribute upper
EAttribute isOrdered
EAttribute isUnique
LinkElem
NewType
TagDefinition isUnique
Nested
Left lower
Right lower
Nested
Left upper
Right upper
IfNested
NestedReference multiplicity
Node range
Node lower
Node upper
NestedReference ordering
Node ok_ordered
Node ok_unordered
EClass AssociationEnd
…
EReference multiplicity
…
Nested
Left ok_ordered
The Profile For MOF
…
EPackage Model
Pro Model
…
Nested
Left ok_unordered
left lower
<left model>
…
The MOF Metamodel
<right model>
Right lower
- 16 -
© 2005 ATLAS Nantes
An ATL Example
Using AMW for mapping details (4/4)
• Weaving model of the profile for MOF
Tag
Value
documentation
Any string
alyasFor
true or false
MOF Feature
UML
name
ModelElement.
name
container
ModelElement.
namespace
constraints
ModelElement.
constraint
- 17 -
© 2005 ATLAS Nantes
An ATL Example
Using ATL transformations
• Two ATL transformations
Muml
MMM
MMA
MAMW
MMM
MUML
MMA
T2AMWtoATL
TUMLtoMM
Mprofile
MAMW
T1AMWtoATL
TMMtoUML
Mprofile
MMM =TUMLtoMM( Muml )
TUMLtoMM = T2AMWtoATL (MMA , MAMW , Mprofile )
MUML = TMMtoUML( MMM )
TMMtoUML = T1AMWtoATL (MMA , MAMW , Mprofile )
- 18 -
© 2005 ATLAS Nantes
An ATL Example
Some Links
• http://www.jeckle.de/uml_spec.htm
• http://www3.software.ibm.com/ibmdl/pub/software/
rational/web/whitepapers/2003/tp185.pdf
• http://www.omg.org/mda/specs.htm#Profiles
• http://www.agiledata.org/essays/umlDataModelingPr
ofile.html
• http://mdr.netbeans.org/uml2mof/profile.html
- 19 -
© 2005 ATLAS Nantes