140 likes | 267 Views
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.
E N D
On Using UML Profiles in ATL Transformations Manuel Wimmer and Martina Seidl 1st International Workshop on Model Transformation with ATL Manuel Wimmer Thisworkhasbeenpartlyfundedbythe Austrian Science Fund (FWF) undergrant P21374-N13.
Introduction • Modeling languages are defined with • metamodels • UML profiles • Model transformation approaches support • metamodelsas first classlanguage definitions • but not UML profiles • UML profiles are frequently used in practical transformations • vertical: PIM -> PSM -> Code • horizontal: Integration of DSMLs and UML
Motivation AllFusionGen 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 More information: http://www.modelcvs.org
RunningExample Metamodel Excerpt: AFG::EntityType 2 UML::Class AFG::DataModel UML C EntityType noInstances: Bool avgOccurrence:Int minOccurrence:Int maxOccurence:Int Class isAbstract:Bool C AnalysisEntityType DesignEntityType phase : String store : String «profile» AFG «metaclass» Class «stereotype» EntityType avgOccurrence:Int minOccurrence:Int maxOccurrence:Int «stereotype» AnalysisEntityType «stereotype» DesignEntityType phase :String store : String
Profile Support in ATL Transformation ExecutionConfiguration Profile is additional input model Usageofexternal UML 2 API AFG 2 UML AFG MM UML MM AFG Profile AFG Model Execute ATL Transformation UML Model Input Output AFG Profile UML API UML MM
Feature toTagged Value assignmentshavetobedone in do blocks • Stereotypes areonlyassignedimplicitly • Tagged Values areonlyassignedimplicitly • Knowledgeoftechnicaldetailsof UML APIs Profile Support in ATL ATL 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()); abstractrule 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); --assigntaggedvaluesfrom super stereotypes if(not s.avgOccurrence.oclIsUndefined()){ t.setTaggedValue(ste,'avgOccurrence',s.avgOccurrence); } ... } }
Profilesas First Class Language Descriptions Approach #1: Merge UML metamodelwithprofile AFG Model UML_base «profile» AFG ATL «metaclass» Class «stereotype» EntityType Class avgOccurrence:Int minOccurrence:Int maxOccurrence:Int isAbstract:Bool UML_extModel «stereotype» AnalysisEntityType «stereotype» DesignEntityType phase :String store : String merge UML Model merge UML_ext Merge Rules Class isAbstract:Bool EntityType stereotypeA «stereotype» stereotypeA avgOccurrence:Int minOccurrence:Int maxOccurrence:Int AnalysisEntityType DesignEntityType phase : String store : String
Profilesas First Class Language Descriptions Approach #1: ATL Code module AFG2UML; createOUT:UML_extfrom IN:AFG; abstractrule 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) } UML_ext Class isAbstract:Bool EntityType avgOccurrence:Int minOccurrence:Int maxOccurrence:Int AnalysisEntityType DesignEntityType phase : String store : String
Profilesas First Class Language Descriptions Getsevenmore complicatedwhen severalprofilesareused! Approach #1: Drawbacks UML_base «profile» AFG «metaclass» Class Class isAbstract:Bool «stereotype» Active «stereotype» … «stereotype» Persistent merge merge UML_ext Class …. Persistent Active …. Persistent/Active
Profilesas First Class Language Descriptions Approach #2: Providing a Preprocessor Extend ATL syntax for applying • Profiles • Stereotypes Tagged Values to Feature assignments • Standard assignment operator Benefits • Reusable Feature to Tagged Value assignments • Stereotypes are assigned explicitly • Tagged values are assigned explicitly • Abstraction from UML APIs ATL4pro AFG Model UML Model AFG Model ATL UML Model AFG Profile UML API
Profilesas First Class Language Descriptions Approach #2: ATL Code module AFG2UML; create OUT:UML usingAFG_Profile:PROfrom IN:AFG; abstractrule ET_2_ET { from s : AFG!EntityType to t : UML!ClassapplyPRO!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!ClassapplyPRO!AnalysisEntityType( phase <- s.phase ) } • Differencestostandard ATL • using • from … IN2:AFG_Profile • apply helperdef: 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); • }
Profilesas First Class Language Descriptions Approach #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 AFG Model UML Model AFG Model ATL_VM UML Model AFG Profile UML API
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
Danke für die Aufmerksamkeit Thank you for your attention Merci pour l'attention DE_2_EN.atl EN_2_FR.atl