1 / 20

A Semi-automatic Approach for Bridging DSLs with UML

Johannes Kepler University Linz. 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.

flynn
Download Presentation

A Semi-automatic Approach for Bridging DSLs with UML

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. Overview • Motivation • Related Work • State of the Art • Methodology • Semi-automatic Bridge Generation • Case Study • Summary

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

  4. 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. C C Transformations UML-Profile DSL2UML UML2DSL «MetaClass»Class ruleClass2EntityTypefrom c: Class to e: EntityType[ c.appliedStereotype(EntityType) ] { e.name = c.name; e.maxInstances = c.maxInstances;} ruleEntityType2Classfrom e : EntityType to c : Class { c.name = e.name; c.applyStereotype(EntityType); c.maxInstances = e.maxInstances;} «Stereotype»EntityType maxInstances : Integer State of the ArtAd-hoc Bridge Implementation DSL-MM UML-MM • Drawbacks of Ad-hoc Implementation • Transformations and Profiles are highly coupled • Bridging covers repetitive tasks • No guidelines • No explicit correspondences between DSL and UML

  6. MappingModel MethodologyStep 1: Mapping Creation DSL-MM UML-MM C C Transformations UML-Profile DSL2UML UML2DSL «MetaClass»Class ruleClass2EntityTypefrom c: Class to e: EntityType[ c.appliedStereotype(EntityType) ] { e.name = c.name; e.maxInstances = c.maxInstances;} ruleEntityType2Classfrom e : EntityType to c : Class { c.name = e.name; c.applyStereotype(EntityType); c.maxInstances = e.maxInstances;} «Stereotype»EntityType maxInstances : Integer • Step 1: User has to define mappings between DSL and UML metamodel elements • Manually in mapping editor • Use a dedicated Metamodel Mapping Language

  7. MappingModel Bridge Generator MethodologyStep 2: Bridge Generation DSL-MM UML-MM C C Transformations UML-Profile DSL2UML UML2DSL «MetaClass»Class ruleClass2EntityTypefrom c: Class to e: EntityType[ c.appliedStereotype(EntityType) ] { e.name = c.name; e.maxInstances = c.maxInstances;} ruleEntityType2Classfrom e : EntityType to c : Class { c.name = e.name; c.applyStereotype(EntityType); c.maxInstances = e.maxInstances;} «Stereotype»EntityType maxInstances : Integer • Step 2: Bridge is automatically generated by BridgeGenerator • Parses user-defined mappings • Generates profile definitions • Generates model transformations

  8. Comparison of ApproachesDrawbacks 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. 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. Step 1: Mapping Creation (2/3) Mapping Language • Mapping Language is based on the ATLAS Model Weaver Core Language (mwcore) [3] • For each metamodel type, a mapping operator is defined(MappingLanguage) mwcore 2 WModel ModelRef 0..* ElementRef * 1 0..* WLink WLinkEnd * MappingLanguage WModel MappingModel WLink 0..* 0..* 0..* 0..* Cl2Cl-Mapping Feat2Feat-Mapping Type2Type-Mapping Lit2Lit-Mapping superMapping isAbstract : BOOL = false 0..* leftInv rightInv 0..* 0..* Invariant Att2Att-Mapping Ref2Ref-Mapping Dat2Dat-Mapping Enum2Enum-Mapping exp : OCLExpression

  11. Step 1: Mapping Creation (3/3)Mapping Tool: AMW Mapping Model UML MM DSL MM Properties of mappings

  12. 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. Step 2: UML Profile Generation (2/3)Tagged Value Generation • General Idea of Tagged Value Generation: Distinction between mapped and unmapped features DSL::Class_A UML:: Class_B Cl2Cl features features Unmapped UML features No tagged values are produced Unmapped DSL features Generate Tagged Values Mapped features No tagged values are produced Unmapped UML features Optional?-> assign null Mandatory?standard value? -> assign standard valueinvariant in Cl2Cl-mapping

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

  15. 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) rulecl2cl.getLeft.name() + _2_ + cl2cl.getRight().nameextends 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. Case StudyAllFusion Gen 2 Rational Software Modeler http://www.modelcvs.org • 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 Eclipse Eclipse Modeling Framework UML2 Project DataModelMM UML2MM DataModelProfile Rational SoftwareModeler(RSM) AllFusion Gen ATL Gen_2_UML2 Injector Injector ClassModel DataModel Extractor Extractor ATL UML2_2_Gen

  17. C2C C2C C2C C2C C2C «profile» DataModel «stereotype» DataDefinitionElement «metaclass» NamedElement «metaclass» Package «stereotype» Relationship «stereotype» SubjectArea «metaclass» Property «metaclass» Class «stereotype» Attribute «stereotype» EntityType «stereotype» AnalysisEntityType «stereotype» DesignEntityType C2C Mapping Overview MappingModel ClassModel DataModel DataDefinitionElement NamedElement name : String [1:1] name : String [1:1] SubjectArea Relationship 0..* 0..* PackageableElement Property Attribute 0..* 0..* 0..* EntityType Package Class GEN AnalysisEntityType DesignEntityType

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

  19. 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 Step1 Step 2

  20. 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.

More Related