on using uml profiles in atl transformations
DESCRIPTION
On Using UML Profiles in ATL Transformations. Manuel Wimmer and Martina Seidl . 1st International Workshop on Model Transformation with ATL . Manuel Wimmer. This work has been partly funded by the Austrian Science Fund (FWF) under grant P21374-N13. Introduction. - PowerPoint PPT PresentationTRANSCRIPT
Business Informatics GroupInstitute of Software Technology and Interactive Systems Vienna University of TechnologyFavoritenstraße 9-11/188-3, 1040 Vienna, Austriaphone: +43 (1) 58801-18804 (secretary), fax: +43 (1) [email protected], www.big.tuwien.ac.at
On Using UML Profiles in ATL TransformationsManuel Wimmer and Martina Seidl
1st International Workshop on Model Transformation with ATL
Manuel Wimmer
This work has been partly funded by the Austrian Science Fund (FWF) under grant P21374-N13.
2
Introduction
Modeling languages are defined with metamodels UML profiles
Model transformation approaches support metamodels as first class language definitions but not UML profiles
UML profiles are frequently used in practical transformations vertical: PIM -> PSM -> Code horizontal: Integration of DSMLs and UML
3
MotivationAllFusionGen 2 Rational Software Modeler (back in 2006)
Goal of the ModelCVS project: Bridge AllFusion Gen (AFG) with UML tools AFG consists of several DSLs: Data Model, GUI Design, Dialog Flow, … Case Study: Bridge Data Model with UML Class Model
Integration architecture
ModelCVSClass
Cl assClass
Class
Cl ass
Cl ass
Cl ass
Cl ass
Cl assClass
Class
Cl assClass
Class
Cl ass
Cl ass
Cl ass
Cl ass
Cl assClass
Cl ass
Class Class Class
Class
Class ClassClass
Class
Cl assClass
Class
Cl ass
Cl ass
Cl ass
Cl ass
Cl assClass
Class
Cl assClass
Class
Cl ass
Cl ass
Cl ass
Cl ass
Cl assClass
Cl ass
Class Class Class
Class
Class ClassClass
X
Y Z
U V
W
X
Y Z
U V
W
X
Y Z
U V
W
X
Y Z
U V
W
More information: http://www.modelcvs.org
AllFusion Gen
Rational SoftwareModeler(RSM)
Eclipse
DataModelMM UML2MM AFGProfile
DataModel ClassModel
Gen_2_UML2
UML2_2_Gen
ATL
ATL
I njector
ExtractorExtractor
I njector
Eclipse Modeling Framework UML2 Project
4
Running ExampleMetamodel Excerpt: AFG::EntityType 2 UML::Class
«profile»AFG
«stereotype»EntityType
«stereotype»AnalysisEntityType
«stereotype»DesignEntityType
avgOccurrence:IntminOccurrence:IntmaxOccurrence:Int
«metaclass»Class
phase :String store : String
AFG::DataModel
EntityTypenoInstances: BoolavgOccurrence:IntminOccurrence:IntmaxOccurence:Int
Class
UML
AnalysisEntityType DesignEntityTypephase : String store : String
isAbstract:Bool
C
C
5
Profile Support in ATLTransformation Execution Configuration
Profile is additional input model Usage of external UML 2 API
Output UML ModelExecute ATL Transformation
AFG 2 UML
UML MM
AFG MM
AFG Profile
AFG Model
AFG ProfileUML MM
Input
UML API
6
Profile Support in ATLATL Code Excerpt
module AFG2UML;create OUT:UML from IN:AFG, IN2:PRO;
helper def: ste : PRO!Stereotype = PRO!Stereotype.allInstances() -> select(e|e.name = 'AnalysisEntityType').first());
abstract rule ET_2_Class { from s : AFG!EntityType to t : UML!Class ( isAbstract <- s.noInstances )}
rule AnalysisET_2_Class extends ET_2_Class{ from s : AFG!AnalysisEntityType to t : UML!Class do{ t.applyStereotype(ste); --assign tagged values from super stereotypes if(not s.avgOccurrence.oclIsUndefined()){ t.setTaggedValue(ste,'avgOccurrence',s.avgOccurrence); } ... }}
1. Feature to Tagged Value assignments have to be done in do blocks
2. Stereotypes are only assigned implicitly3. Tagged Values are only assigned implicitly4. Knowledge of technical details of UML APIs
7
Profiles as First Class Language DescriptionsApproach #1: Merge UML metamodel with profile
«profile»AFG
«stereotype»EntityType
«stereotype»AnalysisEntityType
«stereotype»DesignEntityType
avgOccurrence:IntminOccurrence:IntmaxOccurrence:Int
«metaclass»Class
phase :String store : String
Class
UML_base
isAbstract:Bool
UML_ext
EntityType
AnalysisEntityType DesignEntityType
avgOccurrence:IntminOccurrence:IntmaxOccurrence:Int
Class
phase : String store : String
isAbstract:BoolMerge Rules
stereotypeA«stereotype»
stereotypeA
mergemerge
ATL
AFG Model
UML_ext Model
UML Model
8
Profiles as First Class Language DescriptionsApproach #1: ATL Code
module AFG2UML;create OUT:UML_ext from IN:AFG;
abstract rule ET_2_ET { from s : AFG!EntityType to t : UML!EntityType ( isAbstract <- s.noInstances, avgOccurrence <- s.avgOccurrence, minOccurrence <- s.minOccurrence, maxOccurrence <- s.maxOccurrence )}
rule AnalysisET_2_AnalysisET extends ET_2_ET{ from s : AFG!AnalysisEntityType to t : UML!AnalysisEntityType( phase <- s.phase )}
EntityType
AnalysisEntityType DesignEntityType
avgOccurrence:IntminOccurrence:IntmaxOccurrence:Int
Class
phase : String store : String
isAbstract:Bool
UML_ext
9
Profiles as First Class Language DescriptionsApproach #1: Drawbacks
«profile»AFG
«stereotype»…
«metaclass»Class
UML_ext
Persistent
Persistent/Active
Class
«stereotype»Persistent
Class
UML_base
isAbstract:Bool
mergemerge
Active
«stereotype»Active
….
….
Gets even more complicated when several profiles are used!
10
Profiles as First Class Language DescriptionsApproach #2: Providing a Preprocessor
Extend ATL syntax for applying Profiles Stereotypes
Tagged Values to Feature assignments Standard assignment operator
Benefits1. Reusable Feature to Tagged Value
assignments2. Stereotypes are assigned explicitly3. Tagged values are assigned explicitly4. Abstraction from UML APIs
ATL4pro
ATL
UML ModelAFG Model
AFG Model
AFG Profile UML Model
UML API
11
Profiles as First Class Language DescriptionsApproach #2: ATL Code
module AFG2UML;create OUT:UML using AFG_Profile:PRO from IN:AFG;
abstract rule ET_2_ET { from s : AFG!EntityType to t : UML!Class apply PRO!EntityType ( isAbstract <- s.noInstances, avgOccurrence <- s.avgOccurrence, minOccurrence <- s.minOccurrence, maxOccurrence <- s.maxOccurrence )}
rule AnalysisET_2_AnalysisET extends ET_2_ET{ from s : AFG!AnalysisEntityType to t : UML!Class apply PRO!AnalysisEntityType( phase <- s.phase )}
Differences to standard ATL
usingfrom … IN2:AFG_Profile
apply helper def: ste : PRO!Stereotype =
PRO!Stereotype.allInstances()-> select(e|e.name = 'AnalysisEntityType').first());
t.applyStereotype(ste);
Feature to Tagged Values Assign.if(not s.avgOccurrence. oclIsUndefined()){ t.setTaggedValue(ste,
'avgOccurrence', s.avgOccurrence);}
12
Profiles as First Class Language DescriptionsApproach #3: Extending ATL Syntax and Compiler
Solution #2 drawback No debugging support
Benefits of extending ATL directly No preprocessing of
Metamodels/models ATL code
Complete tool support of ATL
ATL
ATL_VM
UML ModelAFG Model
AFG Model
AFG Profile UML Model
UML API
13
Conclusion & Ongoing Work
Profiles are important for several transformations scenarios Some transformations may be generated from high-level mappings Most transformation code must be written by hand
Profiles as first class language extensions provide Shorter ATL transformations Tooling issues: Static checking & code completion Higher-order transformations: Easier matching/rewriting
Ongoing work Provide an experimental ATL variant: ATL4pros (ATL for profiles ;-)
Provide new keywords Extend the ATL compiler Provide static checking for profile information Provide code completion facilities
Explore other profile usage scenarios such as forward engineering
14
Danke für die Aufmerksamkeit
Thank you for your attention
Merci pour l'attention
DE_2_EN.atl
EN_2_FR.atl