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

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

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

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

MDA and QVTTom Gullion, Director of Product Management,

Together Products

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

Agenda

MDA Overview QVT Overview QVT By Example QVT Demos Developing QVT

Summary

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

MDA Overview

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

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?

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

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?

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

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.

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

Model Marking Transformation

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

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

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

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

QVT Overview

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

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

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

Example Transformation

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

UML to RDB Example

UML Class model Relational Data Model

Model Query Viewtransformation

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

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

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

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)

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

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

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

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

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

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

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

QVT by ExampleA few example QVTs

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

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.

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

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)

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

QVT DemosA few examples

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

QVT example #1: PIM to PSM

PIM: Three classes and a few attributes…

QVT: AddScaffoldingCode Simply add getter and setter methods

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

AddScaffoldingCode.qvt

Required

Impl

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

Control Flow in AddScaffoldingCode.qvt

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

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

Applying QVT transformations – 1of 4

Select input model

Choose menu option

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

Applying QVT Transformations – 2 of 4

Select QVT to use

Select target model Optionally create trace file

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

Applying QVT Transformations – 3 of 4

Transformation result – note added getter/setter methods

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

Applying QVT Transformations – 4 of 4

Trace file view

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

Developing QVTWalking through the dev features

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

QVT Editor, Model Navigator, Metamodel Browser

Code Completion

MetaModelBrowser

Project Metamodels and PrimitiveTypes

Syntax Highlighting

Error Annotations

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

QVT Debugger

Create Debug or Run configuration

QVT Debugger Debug Perspective Synchronized

Debug, Code andOutline views

Breakpoints Variables, Watches

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

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

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

Testing a compiled transformation – 2 of 2

Select transformation

Select target model

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

UC2Class QVT

Use Case to Class QVT See included project

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

PIM 2 PSM Using Library QVT

Extend Add Scaffolding QVT Reusable QVT library example

See included project

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

Applying QVT to submodelsUser-selectable scope

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

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

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

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

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

BpmnToUml.qvt

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

QVT Summary

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

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

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

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