1 / 30

ModTransf A Simple Model to Model Transformation Engine

ModTransf A Simple Model to Model Transformation Engine. Cédric Dumoulin. Requirements. Model input: XMI files, ruled by a MOF metamodel XML files, ruled by an XML schema Easy maintenance of transformation rules To follow metamodel changes Code generation from model Simple to use

liang
Télécharger la présentation

ModTransf A Simple Model to Model Transformation Engine

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. ModTransfA Simple Model to Model Transformation Engine Cédric Dumoulin

  2. Requirements • Model input: • XMI files, ruled by a MOF metamodel • XML files, ruled by an XML schema • Easy maintenance of transformation rules • To follow metamodel changes • Code generation from model • Simple to use • Yet available

  3. Proposed Solution

  4. MM MM rules rules based on based on instance of instance of transformationengine model model model model Proposed Solution • A transformation engine • takes model(s) and set of rules as input, • and produce model(s)

  5. Vocabulary • Model: • Graph of related Concepts • Concepts defined in metamodel • Metamodel (MM): • Graph of classes defining concepts • Transformation • Specify how concepts from input MM are mapped to concepts of output MM

  6. Basic Principle • “Divide and Conquer” • Express transformation rule by rule • Rule • Specify how one or few input concepts are transformed to one or few output concepts. r1 r2 r3 r4 r5 T input MM output MM

  7. Rule • A rule is made of: • domains • describe input and output concepts • can contain complex conditions • implicitly define enterGuard, exitGuard, concept creations • implicitly define rule parameters • enterGuard • to guard the rule execution • actions • to populate concept, perform code generation, do additional computation, … • exitGuard • to check the result • bind variables • to bind concept and properties to guards and actions

  8. Rule Example 1 (UML)

  9. Rule Example 1(XML)

  10. Rule Example 2 (UML)Nested Concept

  11. Rule Example 2 (XML)

  12. Transformation • A transformation is made of: • involved models declaration • rules • topRule • called by the engine • execute all possible solutions on input domains • rule • called by other rules • selectRule • set of rules called by other rules • the first matching rule is executed

  13. Transformation (UML and XML)

  14. How Transformation is Processed • Called with input and output models • Specify which models are used as target • target models are usually empty • models are bind to transformation model names • TopRules are executed • input domains are those referring to input models • output domains are those referring to output models

  15. How Rules are Processed • Input bind variables are set • Input enter guards are checked • stop if not verified • Output actions are executed • Output objects are created and populated • starting from the more nested one (leafs) • For a concept, property values are computed first, then the object is created and populated. • Output post actions are executed • Output exit guards are checked

  16. Multiple Call of a Rule • Call of a rule with the same set of parameters • Return the same result • Only the first call is executed • Subsequent calls return the first result •  multiple properties referencing the same concept are transformed to references to the same transformed concept

  17. Advanced Features

  18. Extra Properties Definition(ex: stereotypes) • Extra Properties can be defined on model concepts • Usage like regular properties • Only visible in the transformation • Example • definition of the property “stereotypes” • used to check stereotype • defined by the model helper

  19. Extra Properties Usage

  20. Associate code templates to rules Templates contain Replacement places for attributes Nested rule calls Use Velocity templates Code Generation $c1.packageName #foreach( $import in $c1.import ) import $import; #end public class ${c1.name} { // attributes $engine.callRule("attribute“, “src.feature“) // methods $engine. callRule( “method”, “src.method”) }

  21. Code Generation: Example

  22. Documentations

  23. Ongoing effort • Schema • modtransf-v3 • XML syntax

  24. XML Rule Syntax:Schema (transformation)

  25. XML Rule Syntax:Schema (domains)

  26. Access To Models • Throw a common API • Should be implemented for each Technology: • JMI, XML, EMF, Database, …

  27. MOFmetamodel schema JMI JAXB generate generate XMImodel XMLmodel import/export import/export JMI classes Java classes Models Kind • Engine takes graphs of objects as models • Model loading is not part of the engine • Can use JMI, JAXB, Castor, DOM, … • From MOF metamodel: • Use JMI • From XML schema • Use JAXB, Castor

  28. Future features • Aspect like property declaration • enable declaration of extra properties and methods on model concepts • Structure and classes declaration • To create data needed during transformation • dependsOn • Allows specification of rule dependencies • Inheritance • Key declarations • To lookup created concepts by specified properties • …

  29. Questions and Discussion

More Related