Introduction to MDE and Model Transformation

Similar documents
Computation Independent Model (CIM): Platform Independent Model (PIM): Platform Specific Model (PSM): Implementation Specific Model (ISM):

MDSE USE CASES. Chapter #3

Introduction to Dependable Systems: Meta-modeling and modeldriven

Sequence Diagram Generation with Model Transformation Technology

INTRODUCTION. Chapter #1

The Model Driven Architecture. Dennis Wagelaar Viviane Jonckers Software Languages Lab

Model Driven Engineering (MDE)

Model Transformation. Suppose I ask you to provide a software that converts any E-R diagram into a UML class diagram, how would you achieve that?

Language engineering and Domain Specific Languages

An Introduction to MDE

BLU AGE 2009 Edition Agile Model Transformation

Plan. Language engineering and Domain Specific Languages. Language designer defines syntax. How to define language

Model transformations. Overview of DSLE. Model transformations. Model transformations. The 4-layer architecture

Knowledge Discovery: How to Reverse-Engineer Legacy Systems

ATHABASCA UNIVERSITY RULE ENHANCED BUSINESS PROCESS MODELING OF SERVICE ORIENTED ARCHITECTURES LUIS ROCHA. A project submitted in partial fulfillment

Christian Doppler Laboratory

MDD with OMG Standards MOF, OCL, QVT & Graph Transformations

SCENARIO-BASED REQUIREMENTS MODELLING

ECLIPSE MODELING PROJECT

Model driven Engineering & Model driven Architecture

A universal PNML Tool. Lukasz Zoglowek

Model-Driven Iterative Development of 3D Web-Applications Using SSIML, X3D and JavaScript

Small is Beautiful Building a flexible software factory using small DSLs and Small Models

An Introduction to Model Driven Engineering (MDE) Bahman Zamani, Ph.D. bahmanzamani.com

MDSE PRINCIPLES. Chapter #2

The Eclipse Modeling Framework and MDA Status and Opportunities

Modellierung operationaler Aspekte von Systemarchitekturen. Master Thesis presentation. October 2005 March Mirko Bleyh - Medieninformatik

University of Alabama

Model Abstraction versus Model to Text Transformation

Defining Domain-Specific Modeling Languages

Metamodeling. Janos Sztipanovits ISIS, Vanderbilt University

QoS-aware model-driven SOA using SoaML

Ontology-based Model Transformation

Static analysis and testing of executable DSL specification

Modelling in Enterprise Architecture. MSc Business Information Systems

Overview of lectures today and Wednesday

Acceleo Galileo Simultaneous Release

innoq Deutschland GmbH innoq Schweiz GmbH D Ratingen CH-6330 Cham Tel Tel

The Unified Modelling Language. Example Diagrams. Notation vs. Methodology. UML and Meta Modelling

with openarchitectureware

A Metamodel independent approach for Conflict Detection to support distributed development in MDE. Mostafa Pordel A THESIS

Bachelor of Engineering, IT Thesis

Towards Generating Domain-Specific Model Editors with Complex Editing Commands

Model Transformation Techniques

Raising the Level of Development: Models, Architectures, Programs

Outline. A little history. Outline. The Unified Modeling Language Opportunities and Challenges for Formal Methods

A (Very) Short Introduction to Model-Driven Development (MDD)

This paper is more intended to set up a basis for a constructive discussion than to offer definitive answers and closed solutions.

Software Architecture

The PISA Project A Model Driven Development case study

Science of Computer Programming. Aspect-oriented model-driven skeleton code generation: A graph-based transformation approach

Model Driven Architecture - The Vision

Future Directions for SysML v2 INCOSE IW MBSE Workshop January 28, 2017

challenges in domain-specific modeling raphaël mannadiar august 27, 2009

Model Transformations for Embedded System Design and Virtual Platforms

Introduction to EGF. Benoît Langlois / Thales Global Services.

PisaTel Meeting Roma, 29 novembre 2007

INF5120 Model-Based System Development

A Proposed Engine Implementation Mechanism to Execute the Code of Relations Query/View/Transformation Language

All you need are models Anneke Kleppe, Klasse Objecten

SPECIFICATION OF MODEL TRANSFORMATION AND WEAVING IN MODEL DRIVEN ENGINEERING

MDA Driven xuml Plug-in for JAVA

MOMOCS D2.1 XIRUP S UPPORTING T OOLS R EQUIREMENTS. Model driven Modernisation of Complex Systems. Dissemination Level: Work package:

CISC836: Models in Software Development: Methods, Techniques and Tools

Coral: A Metamodel Kernel for Transformation Engines

16 Evaluation Framework for Model-Driven Product Line Engineering Tools

Design and Prototypical Implementation of a Pivot Model as Exchange Format for Models and Metamodels in a QVT/OCL Development Environment

AUTOMATED BEHAVIOUR REFINEMENT USING INTERACTION PATTERNS

A Model-driven approach to NLP programming with UIMA

Blazo Nastov. Journée des doctorant, Nîmes, France 19 June 2014

A Taxonomy of Model Transformation

It s all Done with Mirrors Patterns and OCL. KMF Kent Modelling Framework D.H.Akehurst and O.Patrascoiu

Object Management Group Model Driven Architecture (MDA) MDA Guide rev. 2.0 OMG Document ormsc/

ADT: Eclipse development tools for ATL

DEV427 MODEL-DRIVEN DEVELOPMENT USING PowerDesigner. Xiao-Yun WANG PowerDesigner Chief Architect

On Using UML Profiles in ATL Transformations

A Visual Based Framework for the Model Refactoring Techniques


Generating JMI model transformation code from UML profile models for SDM Aligning Graph Rewriting with MDA-light

Model-Driven Architecture

Dominique Blouin Etienne Borde

An Open Source Domain-Specific Tools Framework to Support Model Driven Development of OSS

Dr. Klaus Fischer. Multiagent Systems Group DFKI GmbH Saarbrücken, Germany ICAART

Introduction to Model Driven Engineering using Eclipse. Frameworks

Model Querying with Graphical Notation of QVT Relations

Papyrus: Advent of an Open Source IME at Eclipse (Redux)

EMF Refactor: Specification and Application of Model Refactorings within the Eclipse Modeling Framework

The Model Driven (R)evolution. Richard Mark Soley, Ph.D. Chairman and CEO Object Management Group, Inc.

* Corresponding Author

Grammars. Prof. Andreas Prinz. Introduction, Compilers. Examples Meta-models vs. Grammars Summary

A Model-Driven Approach for the Fast Prototyping of Web Applications

Object Security. Model Driven Security. Ulrich Lang, Rudolf Schreiner. Protection of Resources in Complex Distributed Systems

DSL Design. Overview of DSLE. DSL Design. DSL Desing. Domain specific languages

Computer Science at Kent

Eclipse Development Tools for Epsilon

Introduction to OpenArchitectureWare

Experimental transformations between Business Process and SOA models

Proceedings of the 6th Educators Symposium: Software Modeling in Education at MODELS 2010 (EduSymp 2010)

Methods for the Development

Compositional Model Based Software Development

Transcription:

Vlad Acretoaie Department of Applied Mathematics and Computer Science Technical University of Denmark rvac@dtu.dk DTU Course 02291 System Integration

Vlad Acretoaie Department of Applied Mathematics and Computer Science Technical University of Denmark rvac@dtu.dk 1. Model Driven Engineering (MDE) (including slides by M. Brambilla, J. Cabot, M. Wimmer) DTU Course 02291 System Integration

Models in Software Engineering 3/46 Model-Driven Development (MDD): a development paradigm that uses models as the primary artifact of the development process. Model-driven Architecture (MDA): the particular vision of MDD proposed by the Object Management Group (OMG). Model-Driven Engineering (MDE): a superset of MDD, going beyond pure development (e.g. automatic documentation generation). Model-Based Engineering (MBE): any development process using models, but not as the main process driver.

MDD in a nutshell 4/46 MDD (partially) automates software development. Main principle of MDD: by iteratively refining an initial highlevel model, it is possible to create a model of sufficient technical detail to allow accurate code generation. Main challenge of MDD: generating not only code structure (i.e. packages, classes), but also behavior. Model transformations automate the refinement process.

Motivation for adopting MDE 5/46 The adoption of MDE as a software development paradigm can bring important benefits to many types of development projects and to many development-related activities. Some examples: 1. Code generation (MDD) Generating an application s actual implementation from models. 2. System interoperability Using models to align the data formats exchanged by communicating systems. 3. Legacy systems re-implementation Many development projects have the goal of re-implementing obsolete IT systems, which often need to be reverse-engineered. The reverse engineering process can be facilitated by using models as an intermediate step, followed by updated code generation.

Systems interoperability 6/46

Legacy systems re-implementation 7/46 Discover Understand Regenerate Legacy artifacts : - source code - configuration files - tests - databases - etc. Models Viewpoints New Software Artifacts Models provide a homogenous representation of all legacy components. Model transformations are used to reverse-engineer models from legacy artifacts, as well as to generate new artifacts.

MDE adoption in practice 8/46 MDE has high initial costs: Deploying the technical infrastructure (including modeling tools, model manipulation and transformation tools, code generation tools) Training software engineers accustomed to other development paradigms Creating or adapting Domain Specific Modeling Languages (DSMLs) After the initial adoption effort, MDE delivers (among others): Increased development productivity and efficiency, Stronger correctness guarantees, Faster updates and bug fixes. As a result, MDE is mostly popular with large companies facing strict regulatory compliance requirements. Defense industry, avionics, automotive industry

MDE adoption in practice 9/46

Vlad Acretoaie Department of Applied Mathematics and Computer Science Technical University of Denmark rvac@dtu.dk 2. Model Driven Architecture (MDA) (including slides by M. Brambilla, J. Cabot, M. Wimmer) DTU Course 02291 System Integration

Model Driven Architecture 11/46 A standard by the Object Management Group (OMG) prescribing how to apply MDE practices to software development. Principles of MDA: 1. Models are expressed using well-defined notations. 2. System specifications are organized around a set of models and associated transformations. 3. Models conform to metamodels. 4. Competition among tools implementing the MDA standard will increase the acceptance and adoption of MDE.

Modeling levels in MDA 12/46

MDA example: CIM fragment 13/46

MDA example: PIM fragment 14/46

MDA example: PSM fragment 15/46

MDA and UML 16/46 MDA is based on the Unified Modeling Language (UML), another OMG standard. MDA typically requires a Domain-Specific Modeling Language (DSML) for expressing the PSM. Options for specifying DSMLs based on OMG standards: 1. UML Profiles: collections of Stereotypes extending the notation and semantics of standard UML elements. 2. Full DSMLs based on the Meta-Object Facility (MOF), the metamodeling language to which UML itself conforms.

Vlad Acretoaie Department of Applied Mathematics and Computer Science Technical University of Denmark rvac@dtu.dk 3. Model Transformations (including slides by H. Störrle, M. Brambilla, J. Cabot, M. Wimmer) DTU Course 02291 System Integration

Definition 18/46 A model transformation is an operation which: takes as input one or more source models and a transformation definition, produces target models, or other artifacts (e.g. code, documentation, deployment scripts) based on these inputs. Model transformations can be classified along several dimensions: Horizontal vs. Vertical Endogenous vs. Exogenous Model-to-Text vs. Model-to-Model

Model transformation (MT) 19/46 model transformation language (MTL) Source metamodel Refers to Transformation definition Refers to Target metamodel Conforms to Executes Conforms to Source model Reads Transformation engine Writes Target model or code, documentation, etc. Adapted from: Czarnecki, C., Helsen, S.: Feature-based survey of model transformation approaches. In: IBM Syst. J. 45(3), 621-645 (2006).

Model transformations and MDA 20/46

Class models at different levels 21/46 Despite the different purpose, the same notation is used at each level. If you look closely, you can spot the differences.

CM to RDBM translation 22/46 1. Package-to-schema Every package in the class model is mapped to a schema with the same name. 2. Class-to-table Every persistent class is mapped to a table with the same name. Furthermore, the table should have a primary-key column with the type NUMBER and the name being the class name with _tid appended. 3. Attribute-to-column The class attributes have to be appropriately mapped to columns, and some columns may need to be related to other tables by foreign key definitions.

Code generation 23/46 Code generation is a Model-to-Text (M2T) transformation. Other M2T transformations produce artifacts such as documentation, test cases, and model serialization formats (XMI). Code generation must produce human-readable code expressed in various languages such as Java or SQL. The human-readable condition is important, since the generated code will almost always require editing and additions by a developer. Generated code does not live in isolation. It must usually be integrated with existing frameworks and APIs to be useful. Providing this integration automatically is feasible for code generated from Domain Specific Modeling Languages (DSML). Conversely, code generated from general purpose modeling languages such as UML is mostly boiler-plate.

Overview of generation techniques 24/46 QVT AspectJ ATL C++ Templates Java,.Net Java,.Net Model Transformation Code Transformation Byte Code Rewriting Reflection Model Source Code Generation Source Code Compilation Object Code or Byte Code Running Program Acceleo XPand MofScript Code Generation in MDE Java,.Net Based on Markus Völter. A catalog of patterns for program generation. In Proceedings of the 8th European Conference on Pattern Languages of Programs (EuroPLoP 03), pages 285 320, 2003.

Templates 25/46 Most M2T transformation approaches are based on templates. Templates are widely used in many areas of software development (e.g. text processing, Web development). As an example, consider the following e-mail template: Template text Dear «firstname» «lastname», Thank you for your interest in E-mail text Dear John Doe, Thank you for your interest in Components of a template-based M2T transformation approach: Templates Consist of text fragments with embedded meta-markers. Meta-Markers Have to be interpreted and evaluated based on the model. Use declarative query languages (e.g. OCL, VMQL, XPath) to extract model information. Template Engine Replaces meta-markers with model data at runtime and produces output files.

Template-based code generation 26/46 Source Model Person Customer Query Template «context class» public class «name» { String id, } Result Meta-marker Input Template Engine Text fragment Output1 Output2 Produced Text public class Person { String id, } public class Customer { String id, }

Vlad Acretoaie Department of Applied Mathematics and Computer Science Technical University of Denmark rvac@dtu.dk 4. Model Transformation Languages (including slides by H. Störrle) DTU Course 02291 System Integration

Model Transformation Paradigms 28/46 Paradigm Description Strengths, Weaknesses, Examples Operational Relational / Declarative Graphtransformation Hybrid Imperative language to create (sets of) model elements, based either on a meta-modeling formalism extended with facilities for expressing computations, or based on a query language (e.g. OCL) with imperative constructs.. Mathematical relations between source/target element types using constraints, executable semantics e.g. in PROLOG Relational approaches are side-effect-free, support multidirectional rules, can provide backtracking Graph transformations, are operates on typed, attributed, labeled graphs, consisting of a pair of patters The LHS pattern is matched in the model being transformed and replaced by the RHS pattern in place PRO: Concrete, may be efficient CON: low-level, very verbose EX: QVT Operational mappings, Kermeta, MTL, XMF-Mosaic s executable MOF, C-SAW, etc. PRO: higher-level CON: difficult to execute EX: QVT Relations, VMTL, MTF, Kent Model Transformation Language, Tefkat, AMW, mappings in XMF-Mosaic, etc. PRO: well-understood formal semantics CON: not efficient, complex rules / hard to debug EX: AGG, AToM3, VIATRA, GReAT, UMLX, BOTL, MOLA, Henshin etc. PRO: pragmatic approach CON: no (simple) semantics, not necessarily better EX: ATLAS, Epsilon, TRL, XDE,

Epsilon Transformation Language (ETL) 29/46 Part of the Epsilon family of model management languages Based on the common foundation of the Epsilon Object Language (EOL) The Epsilon family includes languages for model validation, code generation, model comparison, model migration, and model merging. ETL is a hybrid textual model transformation approach. It combines an imperative programming language having a Java-inspired syntax with declarative OCL-like constructs. ETL is based on the Eclipse Modeling Framework (EMF). It is implemented as an Eclipse plug-in containing an editor and interpreter. Apart from Ecore, EMF, and GMF models, it can operate on many model formats, including XML and Excel.

ETL abstract syntax 30/46

ETL concrete syntax 31/46

ETL example: tree to graph 32/46 Transform a tree model to a graph model. The Tree and Graph meta-models are shown below. ETL

ETL example: tree to graph 33/46 Graph nodes maintain the labels of corresponding tree nodes. Graph edges are created between every tree node and its parent.

Henshin: a graph-based MTL 34/46 Also based on the Eclipse Modeling Framework (EMF). A transformation consists of one or more rules. Each rule is expressed as an object diagram reflecting the abstract syntax of the host modeling language. E.g.: When transforming a UML model, nodes included in rules instantiate elements of the UML metamodel. Model elements included in rules have one of these stereotypes: <<create>> the element will be created in the target model; <<delete>> the element must exist in the source model and will be deleted in the target model; <<forbid>> the element must not exist in the source model; <<preserve>> the element must exist in the source model and will be preserved in the target model.

Control flow: Units 35/46 In Henshin, control flow is specified using units. Units can be arbitrarily nested. A rule is also a unit. The following unit types are available: Sequential units: sub-units are executed in the given order; Priority units: the sub-unit with highest priority is executed; Independent units: one sub-unit is randomly selected for execution; Loop units: the only sub-unit is executed as often as possible; Iterated units: the only sub-unit is executed for a fixed number of times; Conditional units: have either two or three sub-units: if, then, (and else). If a match for the if unit can be found, the then unit is executed. Otherwise, if present, the else unit is executed.

The Henshin metamodel 36/46

Henshin example: bank accounts 37/46 An endogenous transformation operating on instances of the Bank Metamodel shown below.

Example rule: create a bank account 38/46

Example rule: transfer money 39/46

The Visual Model Transformation Language (VMTL) 40/46 A declarative MTL allowing users to express model-to-model transformations using their existing model editors. Transformations consist of one or more rules, each containing: A Find Pattern describing where the rule can be applied; A Produce Pattern describing the effects of the rule; The Find Pattern and the Produce Pattern can be merged, forming an Update Pattern; Optionally, Require Patterns and Forbid Patterns describe positive and negative rule application conditions, respectively. VMTL patterns are model fragments enhanced by textual annotations. The annotations are typically expressed as comments.

The VMTL metamodel 41/46

VMTL and host modeling languages 42/46 Elements of the VMTL metamodel are mapped to elements of the host modeling language metamodel. A different mapping exists for each VMTL-compatible host language. There are four elements of the VMTL metamodel that must be mapped to elements of the host language: transformations, rules, patterns, and annotations.

VMTL example: process refactoring 43/46 In a Business Process Model and Notation (BPMN) Process Diagram, the execution order of Tasks is determined by directed Sequence Flows. Although legal, the absence of outgoing Sequence Flows from a Task may be considered a design anti-pattern, since the execution of this task will implicitly lead to the termination of the Process. Process termination can be made explicit by applying a refactoring which ensures that an End Event is executed after each Task with no outgoing Sequence Flows.

Source model 44/46

VMTL example: process refactoring 45/46 Update Pattern Forbid Pattern

Target model 46/46