Explore model transformations, their purposes, taxonomy, techniques in MDD, and comparison of tools and languages used in the process. Learn about imperative and declarative languages, transformation strategies, and examples like UML to RDMS.
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.
Outline • What is a model transformation? • Purposes in MDD • Taxonomy • Techniques • General purpose programming languages • Generic transformation tools (XSLT and Viatra) • Dedicated transformation language (QVT and ATL) • Comparison
What is a model transformation? • Transformations takes model and produces model • PIM to PSM a la OMG MDA • Refining and refactoring models • Reverse engineering • Generate new views • Applying design patterns • Deriving products in a product line ...Any model engineering activity that can be automated...
Taxonomy • Declarative • What is mapped • Imperative • How it is mapped • Hybrid
Operational Context MOF conformsTo conformsTo Define Transformation Meta-model A Meta-model B Transformation based on based on conformsTo conformsTo output input Model A Model B Apply Transformation using Engine
Model transformationstechniques • General purpose programming languages • Imperative object-oriented programming (Java) • Declarative object-oriented logic programming (Flora) • Generic transformation tools • Graph transformations (VIATRA) • XSLT • Case tools scripting languages (Rose) • Dedicated model transformations tools • OMG QVT style (QVT, ATL) • Meta-modeling tools (Kermeta)
General purpose programming languages • Java, VB, C# (take your favourite lang.) • Available via APIs, • however rules are implemented from scratch • Example: JMI (MOF-compliant Java Interface) • No overhead to learn a new language • The programming complexity problem, which MDD wish mastering, continues
Flora (F-Logic) • Frame Logic is an object oriented deductive database language • Syntactical integration between Object Oriented Paradigm and Rules • Combines expressivity and declarative semantics to object oriented concepts. • Implements Structural and Behavioural Inheritance with support for Single-source Multiple Inheritance • Flora is an implementation for F-logic over XSB Prolog
eXtensible Stylesheet Language Transformation (XSLT) • XML-based language used for the transformation of XML documents • Part of a W3C family of languages (XSL) • Describes how to format and transform XML files • XSLT, XSL-FO, XPath • Used to model transformation • Where models are in XMI encoding format
eXtensible Stylesheet Language Transformation (XSLT) • XSLT Characteristics • Declarative rather than imperative • Consist of a template rules collection • Each rule specifies what to add to a target fragment • Based on a source fragment and a fixed algorithm • XSLT processor scan the source tree, apply rules and generate de target tree • Syntactical & ineffic for model transformations • XML (XMI) is verbose • Operates on tree structures • More batch than interactive • Parameters passed by value
Target Schema Fragment Insertion Actions Matched Source Fragments XSLT Document XMLS Document 2 XMLS Document 1 Source Schema Fragment Matching Patterns Valid Valid XML Document 2 XML Document 1 XSLT Engine eXtensible Stylesheet Language Transformation (XSLT) • Transformation process: • Source document matching patterns • XSLT document specifying actions that copy matched elements and attributes from source document and assemble them in a novel way • Target document matching transformations
CASE tool scripting language • Ex.: Rose, OptimalJ, Arcstyler, Fujaba • Pro • Good level of maturity • Excellent integration with their CASE tool • Drawback • Proprietary language • Often developed as a second thought, not central • Many limitations when model transformations get complex • Structuration, modularity, reuse and configuration management problems
Query-View-Transformation (QVT) • OMG standard language for expressing queries, views, and transformations on MOF models • DSL for transformation aimed for • Simple development and maintenance of model transformations • With higher expression power • And enhanced structuration • Composition of rules and Interoperability OCL-based hybrid procedural and declarative transformation language
Overview of the Architecture • Declarative Relations transformation language • Specification of relations over model elements • Declarative Core transformation language • Simple transformation language • Reference point for defining the semantics of the Relations language • Operational Mappings • Imperative transformation language • Extends Relations language with imperative constructs
Model Transformation expressed inOperational Mappings Language Overall structure of a transformation program: metamodel 'http://www.borland.com/together/uml20'; transformation BookToPublication (in InputMetamodel): OutputMetamodel ………………………………………………………………… main () { ………………………………………………………………… } ………………………………………………………………… …helpers…………………………………………… …mapping operations……………… ………………………………………………… Signature: Declares the identifier of the transformation Entry point: The execution of the transformation starts here by executing the operations in the body of main. It also declares the source and target metamodels. in keywords indicate source and target model variables. The target is represented by the return of main. Transformation elements: Transformation consists of mapping operations and helpers. They form the transformation logic.
BookToPublication Example in the OMG QVT Specification [05-11-01.pdf] metamodel BOOK { class Book {title: String; composite chapters: Chapter;} class Chapter {title : String; nbPages : Integer;} } metamodel PUB { class Publication {title : String; nbPages : Integer;} } transformation Book2Publication(in bookModel:BOOK,out pubModel:PUB) main() { bookModel->objectOfType(Book)->map book_to_publication(); } mapping Class::book_to_publication () : Publication { title := self.title; nbPages := self.chapters->nbPages->sum(); }
ATL • Source models and target models are distinct: • Source models are read-only (they can only be navigated, not modified), • Target models are write-only (they cannot be navigated). • The language is a declarative-imperative hybrid: • Declarative part: • Matched rules with automatic traceability support, • Side-effect free navigation (and query) language: OCL 2.0 • Imperative part: • Called rules, • Action blocks. • Recommended programming style: declarative