Presentation is loading. Please wait.

Presentation is loading. Please wait.

1© 2007 BIG Vienna University of Technology A Semi-automatic Approach for Bridging DSLs with UML 7th OOPSLA Workshop on Domain-Specific Modeling Montréal.

Similar presentations


Presentation on theme: "1© 2007 BIG Vienna University of Technology A Semi-automatic Approach for Bridging DSLs with UML 7th OOPSLA Workshop on Domain-Specific Modeling Montréal."— Presentation transcript:

1 1© 2007 BIG Vienna University of Technology A Semi-automatic Approach for Bridging DSLs with UML 7th OOPSLA Workshop on Domain-Specific Modeling Montréal Canada October 21-22, 2007 Manuel Wimmer, Andrea Schauerhuber, Michael Strommer, Gerti Kappel {wimmer, schauerhuber, strommer, gerti}@big.tuwien.ac.at 22.10.2007 Vienna University of Technology Wieland Schwinger schwinger@ifs.uni-linz.ac.at IFS Johannes Kepler University Linz

2 2© 2007 BIG Vienna University of Technology Overview Motivation Related Work State of the Art Methodology Semi-automatic Bridge Generation Case Study Summary

3 3© 2007 BIG Vienna University of Technology Motivation In the modeling world, DSLs are defined externally with Metamodels or internally with UML Profiles Problem: No interoperability between formalisms Need to bridge both approaches 1. Exit strategy for existing CASE tools  Further use of code generation functionalities of CASE tools  No information of DSL models should be lost! 2. Building UML Profiles from scratch First step: define modeling concepts in a metamodel [1]

4 4© 2007 BIG Vienna University of Technology Related Work Integration of DSLs and UML Profiles in Abouzahra et al. [2] Mappings between DSL metamodel and UML profile Model transformations from DSL models to UML models and vice versa are automatically generated Prerequisite: UML Profile exists Difference to our work We do not assume, that a UML Profile is already available Whole bridge is generated  UML profile  Model transformations

5 5© 2007 BIG Vienna University of Technology DSL- MM DSL2UML rule EntityType2Class from e : EntityType to c : Class { c.name = e.name; c.applyStereotype(EntityType); c.maxInstances = e.maxInstances; } Transformations rule Class2EntityType from c: Class to e: EntityType [ c.appliedStereotype(EntityType) ] { e.name = c.name; e.maxInstances = c.maxInstances; } UML2DSL UML-MM C C UML- Profile « MetaClass » Class «Stereotype» EntityType maxInstances : Integer State of the Art Ad-hoc Bridge Implementation Drawbacks of Ad-hoc Implementation 1. Transformations and Profiles are highly coupled 2. Bridging covers repetitive tasks 3. No guidelines 4. No explicit correspondences between DSL and UML

6 6© 2007 BIG Vienna University of Technology MappingModel Methodology Step 1: Mapping Creation DSL- MM DSL2UML rule EntityType2Class from e : EntityType to c : Class { c.name = e.name; c.applyStereotype(EntityType); c.maxInstances = e.maxInstances; } Transformations UML- Profile « MetaClass » Class «Stereotype» EntityType maxInstances : Integer rule Class2EntityType from c: Class to e: EntityType [ c.appliedStereotype(EntityType) ] { e.name = c.name; e.maxInstances = c.maxInstances; } UML2DSL UML-MM C C Step 1: User has to define mappings between DSL and UML metamodel elements Manually in mapping editor Use a dedicated Metamodel Mapping Language

7 7© 2007 BIG Vienna University of Technology MappingModel Methodology Step 2: Bridge Generation DSL- MM DSL2UML rule EntityType2Class from e : EntityType to c : Class { c.name = e.name; c.applyStereotype(EntityType); c.maxInstances = e.maxInstances; } Transformations UML- Profile « MetaClass » Class «Stereotype» EntityType maxInstances : Integer rule Class2EntityType from c: Class to e: EntityType [ c.appliedStereotype(EntityType) ] { e.name = c.name; e.maxInstances = c.maxInstances; } UML2DSL UML-MM C C Step 2: Bridge is automatically generated by BridgeGenerator Parses user-defined mappings Generates profile definitions Generates model transformations Bridge Generator

8 8© 2007 BIG Vienna University of Technology Comparison of Approaches Drawbacks of Ad-hoc Implementation and Solutions Drawback 1: Transformations and profiles are highly coupled Solution: Mapping model is single source of information Drawback 2: Bridging covers repetitive tasks Solution: Automation by model transformations Drawback 3: No guidelines Solution: Guidelines support systematic integration Drawback 4: No explicit correspondences between DSL and UML Solution: Explicit correspondences via mapping model

9 9© 2007 BIG Vienna University of Technology Step 1: Mapping Creation (1/3) Overview General Idea: Map semantically corresponding DSL metamodel elements and UML metamodel elements Metamodel element types Class Feature  Attribute  Reference User-defined Type  Enumeration »Enumeration Literal  Data Type

10 10© 2007 BIG Vienna University of Technology mwcore MappingLanguage WModel ModelRef ElementRef WLinkEnd WLink WModel Cl2Cl-Mapping 0..* Feat2Feat-Mapping WLink Att2Att-MappingRef2Ref-MappingEnum2Enum-Mapping Lit2Lit-Mapping isAbstract : BOOL = false Invariant exp : OCLExpression 2 * * 1 0..* rightInvleftInv 0..* Step 1: Mapping Creation (2/3) Mapping Language superMapping 0..* MappingModel 0..* Dat2Dat-Mapping Type2Type-Mapping Mapping Language is based on the ATLAS Model Weaver Core Language (mwcore) [3] For each metamodel type, a mapping operator is defined (MappingLanguage)

11 11© 2007 BIG Vienna University of Technology Step 1: Mapping Creation (3/3) Mapping Tool: AMW UML MM DSL MM Mapping Model Properties of mappings

12 12© 2007 BIG Vienna University of Technology Step 2: UML Profile Generation (1/3) Stereotype Generation UML Profile generation is driven by user-defined mappings Stereotype Generation for each cl2cl mappingModel.getCl2Cl-Mappings(){ create Stereotype { self.setName(cl2cl.getRightClass().getName()); self.setExtension(cl2cl.getLeftClass()); for each superMapping cl2cl.getSuperMappings() { self.getSuperStereotype().add( resolveCreatedStereotypeFor(superMapping)); }

13 13© 2007 BIG Vienna University of Technology Step 2: UML Profile Generation (2/3) Tagged Value Generation General Idea of Tagged Value Generation: Distinction between mapped and unmapped features UML:: Class_B DSL:: Class_A Mapped features No tagged values are produced Unmapped DSL features Generate Tagged Values Unmapped UML features No tagged values are produced features Cl2Cl Unmapped UML features Optional? -> assign null Mandatory? standard value? -> assign standard value invariant in Cl2Cl-mapping

14 14© 2007 BIG Vienna University of Technology Step 2: UML Profile Generation (3/3) Data Type and Enumeration Generation Distinction between mapped and unmapped types - Private - Public DSL «enumeration» Visibility «enumeration» VisibilityKind UMLMappingModel E2E 0..* - Private - Public L2L DSLUML - Restrict - SetNULL n.a. No additional elements are necessary Create Enumeration DeletionKind with Literals Restrict and SetNULL Mapping not possible Mapped Types Unmapped Types Mapping Model BridgeGenerator «enumeration» DeletionKind

15 15© 2007 BIG Vienna University of Technology Step 2: Model Transformation Generation Model Transformation Frameworks supporting UML Profiles are hard to find Work-around: Read in Profiles as additional input models Model Transformation Generation Template (ATL Code) rule cl2cl.getLeft.name() + _2_ + cl2cl.getRight().name extends getRulesfor(cl2cl.superMappings) { from s : DSL!cl2cl.getLeft() [cl2cl.getLeftInv()] to t : UML!cl2cl.getRight() ( //set attributes/references for mapped features ) do{ if(cl2cl.isRoot()){ t.applyProfile(getLeftModel.name); } t.assignStereotype(cl2cl.getLeft().name); //set tagged values for unmapped features }

16 16© 2007 BIG Vienna University of Technology Case Study AllFusion Gen 2 Rational Software Modeler AllFusion Gen Rational Software Modeler (RSM) Eclipse DataModelMMUML2MMDataModelProfile DataModel ClassModel Gen_2_UML2 UML2_2_Gen ATL Injector Extractor Injector Eclipse Modeling Framework UML2 Project Goal of the ModelCVS project: Bridge AllFusion Gen with UML AllFusion Gen consists of several DSLs Data Model, GUI Design, Dialog Flow, … Case Study 1: Bridge Data Model with UML Class Model Architecture of the Integration Framework http://www.modelcvs.org

17 17© 2007 BIG Vienna University of Technology «profile» DataModel «stereotype» AnalysisEntityType «stereotype» DesignEntityType «metaclass» NamedElement «stereotype» DataDefinitionElement «stereotype» Relationship «metaclass» Property «stereotype» Attribute «metaclass» Package «stereotype» SubjectArea «metaclass» Class «stereotype» EntityType C2C Mapping Overview DataModel SubjectArea 0..* EntityType DataDefinitionElement Attribute Relationship name : String [1:1] PackageableElement 0..* Package NamedElement Property Class name : String [1:1] ClassModelMappingModel 0..* AnalysisEntityTypeDesignEntityType C2C 0..* GEN

18 18© 2007 BIG Vienna University of Technology DataModel EntityType Attribute Relationship avgOccurrence:Int minOccurrence:Int maxOccurence:Int percentengeOfGrowth:Int superEntity 0..1 Property Class superClass 0..* UMLModelMappingModel C2C 0..* AnalysisEntityTypeDesignEntityType isAbstract:Bool 0..* R2R «profile» DataModel «stereotype» AnalysisEntityType «stereotype» DesignEntityType avgOccurrence:Int minOccurrence:Int maxOccurrence:Int percentengeOfGrowth:Int «stereotype» EntityType «metaclass» Class if(self.getAssignedStereotype().oclIsKindOf(EntityType)){ self.superClass.upper = 1 } R2R EntityType 2 Class Mapping Details GEN

19 19© 2007 BIG Vienna University of Technology Summary We presented how to derive a bridge between DSLs and UML semi-automatically Mapping Creation: Define correspondences between DSL and UML metamodel elements Generate UML Profile: Stereotypes, tagged values, data types, and constraints Generate Model Transformations: Transformation Code also uses the generated UML profiles Ongoing Work Mapping Language: n:m Mappings, Path-Exp, … Mapping Editor: validation support, … Adapt profile and model transformation generation Further case studies: GUI Design, Dialog Flow Step 1 Step 2

20 20© 2007 BIG Vienna University of Technology References [1] N. Moreno, P. Fraternali, and A. Vallecillo. WebML modeling in UML. IET Software Journal, 2007. [2] A. Abouzahra, J. Bezivin, M. D. D. Fabro, and F. Jouault. A Practical Approach to Bridging Domain Specific Languages with UML profiles. In Proceedings of the Best Practices for Model Driven Software Development at OOPSLA’05, San Diego, California, USA, 2005. [3] M. D. D. Fabro, J. Bzivin, F. Jouault, E. Breton, and G. Gueltas. AMW: a generic model weaver. In Proceedings of the 1re Journe sur l’Ingnierie Dirige par les Modles (IDM05), 2005.


Download ppt "1© 2007 BIG Vienna University of Technology A Semi-automatic Approach for Bridging DSLs with UML 7th OOPSLA Workshop on Domain-Specific Modeling Montréal."

Similar presentations


Ads by Google