MDA and QVT Tom Gullion, Director of Product Management, Together Products.

Post on 28-Dec-2015

217 views 0 download

Tags:

Transcript of MDA and QVT Tom Gullion, Director of Product Management, Together Products.

MDA and QVTTom Gullion, Director of Product Management,

Together Products

Agenda

MDA Overview QVT Overview QVT By Example QVT Demos Developing QVT

Summary

MDA Overview

According to the Object Management Group (OMG): MDA provides an open, vendor-neutral approach to the

challenge of business and technology change. MDA aims to separate business or application logic from

underlying platform technology. Platform-independent models can enable intellectual property to

move away from technology-specific code, helping to insulate business applications from technology evolution, and further enable interoperability.

What is MDA?

MDA is not a single specification, but a collection of related OMG specifications: Unified Modeling Language (UML™) 2.0

Infrastructure Superstructure Object Constraint Language (OCL) Diagram Interchange Profiles

Meta-Object Facility (MOF) XML Meta-Data Interchange (XMI) Common Warehouse Meta-model (CWM) Query View Transformation (QVT)

What Comprises MDA?

Transformations

This is the challenge for MDA! Inspired by existing CWM transformation technology

MOF2 Core will align basis of UML and CWM

Query / View / Transformation (QVT) is the answer

A record of transformation is required to maintain traceability and synchronization.

Model Marking Transformation

Marks are specific to a transformation Can be a stereotype in a profile, for example

Machine Code

Impossible?

The Abstraction Gap

Middleware makes MDA a potential reality

Level of Abstraction

Generators

1

0..*

security

mortgages

1

0..*

borrower

mortgages

10..*

ownerhouses

House

-value:Money

Person

-ssn:Integer-salary:Money

+getMortgage(sum:Money,security:House):Mortgage

Mortgage

-principal:Money-monthlyPayment:Money-start:Date-end:Date

Machine Code with Operating System

Impractical?3GL with Operating System

Unlikely?3GL with Middleware

Practical(ly)Middleware with Framework

Today!

A b

s t r

a c

t i o

n G

a p

QVT Overview

Query-View-Transformation

QVT specification is the heart of Model Driven Architecture

Queries take a model as input and select specific elements from that model

Views are models that are derived from other models Transformations take a model as input and update it or

create a new model

Example Transformation

UML to RDB Example

UML Class model Relational Data Model

Model Query Viewtransformation

Key Benefits of QVT

Core benefit of MDA Smaller, manageable models operating in concert versus huge,

monolithic models Models become “usable” development artifact

avoid intermediate work products

Enables intelligent code generation Insulate models and applications from deployment platform

technology reuse made into reality

QVT in context

QVT might be used to: Transform

business process model object model (PIM to PIM) Analysis object model into Business Object model (PIM to PIM) Object model to data model (PIM to PIM or PIM to PSM) Object model to detailed object model (PIM to PSM)

Applicable Benefits

Intermediate work products vanish due to clear value of all models

Repeatable, high-quality approach to software design/development

Automated traceability between models, queries, transformations and views

Transformations

QVT provides language to implement model-to-model transformations

QVT fully supports OCL 2.0 expressions

Query libraries• Reusable libraries of QVT mappings

• Traceability• Automated traceability when executing mapping

• Extensible• QVT can call custom Java methods

QVT Language Overview

Together® Architect 2006 implementation based on the revised submission for MOF 2.0 Query/View/Transformation RFP (OMG document ad/05-03-02)

Supports operational transformations

Two types of transformation methods: Mappings and Queries

QVT by ExampleA few example QVTs

Transforming a Use Case Model to a Class Model

This transformation automates the construction of a set of use case realization classes

It is rather simple: a 1-to-1 mapping from Actor to Class. Use Cases owned by the Actor are created as Operations within the Class.

Transforming a PIM to a PSM

As a basic step toward elaborating the PSM, this QVT simply adds scaffolding code (e.g., getters and setters)

QVT DemosA few examples

QVT example #1: PIM to PSM

PIM: Three classes and a few attributes…

QVT: AddScaffoldingCode Simply add getter and setter methods

AddScaffoldingCode.qvt

Required

Impl

Control Flow in AddScaffoldingCode.qvt

main (not surprisingly) starts it off mapping methods do most of the work

Applying QVT transformations – 1of 4

Select input model

Choose menu option

Applying QVT Transformations – 2 of 4

Select QVT to use

Select target model Optionally create trace file

Applying QVT Transformations – 3 of 4

Transformation result – note added getter/setter methods

Applying QVT Transformations – 4 of 4

Trace file view

Developing QVTWalking through the dev features

QVT Editor, Model Navigator, Metamodel Browser

Code Completion

MetaModelBrowser

Project Metamodels and PrimitiveTypes

Syntax Highlighting

Error Annotations

QVT Debugger

Create Debug or Run configuration

QVT Debugger Debug Perspective Synchronized

Debug, Code andOutline views

Breakpoints Variables, Watches

Testing a compiled transformation – 1 of 2

Run project – Run As…., Eclipse Application Starts a runtime workspace with the compiled

transformation included Create a new source and target project for testing Do Model Apply Transformation QVT Compiled

Testing a compiled transformation – 2 of 2

Select transformation

Select target model

UC2Class QVT

Use Case to Class QVT See included project

PIM 2 PSM Using Library QVT

Extend Add Scaffolding QVT Reusable QVT library example

See included project

Applying QVT to submodelsUser-selectable scope

Avoiding unnecessary parsing…

The QVT draft spec only defines complete models as input but this demands unnecessary parsing in many cases

generating XSD for a single class diagram transformations of a use case model transformations of a partition (package tree) of a model

fortunately, the Together group solved this problem and we’re getting this added to the QVT specification

BPMN to UML example

Note we selected the Process Pool element

then we can Model Apply Transformation QVT … choose a Together UML20 project as the target

BpmnToUml.qvt

QVT Summary

QVT in Together 2006 Summary

provides language to implement model-to-model transformations implementation based on the revised submission for MOF 2.0

Query/View/Transformation RFP (OMG document ad/05-03-02) fully supports OCL 2.0 expressions query libraries

Reusable libraries of QVT mappings

Traceability Automated traceability when executing mapping

Extensible QVT can call custom Java methods

References

QVT Language Reference, Together Architect 2006 online help

revised submission for MOF 2.0 Query/View/Transformation RFP (OMG document ad/05-03-02)

The Object Constraint Language, 2edJos Warmer and Anneke Kleppe