Transcript Document
UML to XML-Schema Transformation: a Case Study in Managing Alternative Model Transformations in Model Driven Architecture Ivan Kurtev, Klaas van den Berg, Mehmet Aksit University of Twente, the Netherlands Forum on Specification and Design Languages (FDL) , Frankfurt, September 2003 Sheet 1 Outline • Alternative Model Transformations in MDA; • Case Study: Transformation from a UML Class Model into XML Schemas; • Example: Deriving Extensible XML Schemas; • Managing Alternative Transformations: Transformation Space; – Construction of Transformation Space; – Reduction of Transformation Space; – Reduction of Transformation Space on the basis of Quality Properties; • Discussion; Forum on Specification and Design Languages (FDL) , Frankfurt, September 2003 Sheet 2 Basic MDA Concepts • Basic concepts in Model Driven Architecture (MDA); • Models: Computation Independent Model (CIM) Platform Independent Model (PIM) Platform Specific Model (PSM) • Model Transformations – The MDA Pattern (from “MDA Guide”): Transformation Specification Source Model Transformer Target Model Forum on Specification and Design Languages (FDL) , Frankfurt, September 2003 Sheet 3 Alternatives in Model Transformations The model level (M1) and the meta-model level (M2) in the four level Meta Object Facility (MOF) modeling stack: Source metamodel Target metamodel MC2B MCA MC1B Level M2 MMB MMA Instance of Instance of C2A C2B Level M1 MA C1A Source model C1B MB Target alternative models M2: A given construct from the source meta-model may be mapped to more than one construct in the target meta-model. M1: This results into alternative transformations for the instances at level M1. Forum on Specification and Design Languages (FDL) , Frankfurt, September 2003 Sheet 4 The Problem with Alternatives Generation and Selection • Problem 1: Lack of support for identification of alternative transformations – Transformation to the desired model may not always be obvious and trivial; • Problem 2: Selection among Alternatives – Alternatives differ in their Quality properties such as Extensibility, Adaptability, Performance; • Alternative Transformations Analysis must be addressed explicitly in the MDA software development process! Forum on Specification and Design Languages (FDL) , Frankfurt, September 2003 Sheet 5 Case Study: UML to XML-Schema Transformation UML meta-model XML Schema meta-model Complex Type Class Element Level M2 Instance of Instance of C2 CT1 Level M1 C1 a UML model El1 Alternative XML schemas Forum on Specification and Design Languages (FDL) , Frankfurt, September 2003 Sheet 6 Example: Deriving Extensible XML Schemas UML Source Class Model We aim at deriving extensible XML schemas. New specializations of ExamItem are expected. This might affect the representation of Exam in the resulting schema. Forum on Specification and Design Languages (FDL) , Frankfurt, September 2003 Sheet 7 Two of many Alternative XML Schemas Schema 1: <element name=’examItem’> <complexType> <choice> <element name=’open’ type=’…’/> <element name=’mutipleChoice’ type=’…’/> </choice> </complexType> </element> <element name=‘fillInTheGap’…/> In the first schema it is not possible to extend the alternatives of <choice>. In the second schema the addition is modular and does not require changes in the rest of the schema components. Schema 2: <element name=’examItem’ type=’examItemType’ abstract=’true’/> ……………….. </complexType> <complexType name=’multipleChoiceType’> <complexContent> <extension base=’examItemType’> ……. </extension> </complexContent> </complexType> <element name=’multipleChoice’ type=’multipleChoiceType’ substitutionGroup=’examItem’/> <element name=‘fillInTheGap’… substitutionGroup=‘examItem’/> Forum on Specification and Design Languages (FDL) , Frankfurt, September 2003 Sheet 8 MDA Transformational Problem Requirements Source Meta Model Quality Model Target Meta Model Instance Of Instance Of Source Model Transformation Target Model The process of Alternatives Generation and Selection is based on the notion of Transformation Space Selection is based on Quality Requirements Forum on Specification and Design Languages (FDL) , Frankfurt, September 2003 Sheet 9 Transformation Space Alternative Space Analysis Activity Steps: Source Model Source Meta Model Quality Model Target Meta Model 1. Constructing Transformation Space 2. Reducing Transformation Space 3. Reducing Transformation Space on the base of Quality 4. Refinement Forum on Specification and Design Languages (FDL) , Frankfurt, September 2003 Set of Alternative Transformations Sheet 10 Step 1: Constructing Transformation Space • Set of dimensions: one dimension for every (relevant) element from the source model; • Coordinate set for every dimension – Coordinate: selected among the constructs in the target meta-model; • Point in Transformation Space: represents alternative transformation for the source model Coordinate sets for XML Schema Meta-model: • Components: • Relations: – – – – – Complex Type (CT); Element (E); Attribute (A); Attribute Group (AG); Model Group (MG); – – – – Containment (Cont); Reference (Ref); Derivation (Der); Substitution (Subst); Forum on Specification and Design Languages (FDL) , Frankfurt, September 2003 Sheet 11 Example of Transformation Space The space includes only two classes from the source model (ExamItem and Open) and the generalization between them (denoted as ExamItem_Open) Open CT – Complex Type E – Element MG – Model Group AG – Attribute Group Der – Derivation Subst – Substitution Cont – Containment Ref – Reference AG MG E E MG AG ExamItem CT CT Der Subst Cont Ref ExamItem_Open E 4 x 4 x 5=80 alternatives Forum on Specification and Design Languages (FDL) , Frankfurt, September 2003 Sheet 12 Step 2: Reducing Transformation Space Two operations for selection and exclusion from a space are defined. Selection from space: (e.g. ExamItem to Element or Complex Type) Exclusion from space: (exclude Element and Reference) Open Open AG AG MG MG E CT CT Der Subst E Cont MG Ref AG ExamItem E ExamItem_Open Select from S where <(ExamItem.E or ExamItem.CT) and (Open.E or Open.CT)> 20 alternatives E CT CT Der Subst E MG Cont AG Ref E ExamItem ExamItem_Open Exclude from S where <(ExamItem_Open.E or ExamItem_Open.Ref) > 12 alternatives Forum on Specification and Design Languages (FDL) , Frankfurt, September 2003 Sheet 13 Step 3: Reducing Transformation Space based on Quality Requirements • In this example the Quality Model is the model of Extensibility; • Model elements are: – Extensible; – Inextensible; • Our technique allows merging of quality properties with a transformation space; Extensible Extensible Inextensible Inextensible Forum on Specification and Design Languages (FDL) , Frankfurt, September 2003 Sheet 14 Merging Quality Properties with Transformation Space Operation Merge merges two spaces into one. In our example the resulting space contains information about the extensibility properties of the model elements Open (AG, InExt) (MG, InExt) (E, InExt) (CT, InExt) (CT, Ext) Der Subst (E, Ext) Cont (MG, Ext) (AG, Ext) Ref E ExamItem ExamItem_Open The software engineer may be supported by heuristics during the selection process. XML Schema best practices may be used in our example to select extensible schemas. Forum on Specification and Design Languages (FDL) , Frankfurt, September 2003 Sheet 15 Result Set of Alternative Transformations After applying some reduction steps and taking into account the quality properties, two alternative transformations from the space are selected: Dimension in Source Number … ExamItem Open ExamItem_Open 1 E E E Subst 2 E E CT Der … Alternative Transformation Coordinate in Target Forum on Specification and Design Languages (FDL) , Frankfurt, September 2003 Sheet 16 Conclusions • We presented a technique for Alternative Transformation Space Analysis for MDA transformations – Transformation Space is the main concept in that technique; • Transformation Space: – Is NOT a transformer; – Is NOT a transformation specification; • Not all alternatives in the Transformation Space are explicitly generated; Forum on Specification and Design Languages (FDL) , Frankfurt, September 2003 Sheet 17 Discussion • • • • • More complex mappings (not only 1:1); More complex quality models; Balancing quality factors; Tool support – adaptation of existing prototype; Handling large transformation spaces; Forum on Specification and Design Languages (FDL) , Frankfurt, September 2003 Sheet 18