graph transformation for model transformation

17
30 March 2005, IPA lentedagen, Breda Graph-Based State Spaces 1 Graph Transformation for Model Transformation Arend Rensink University of Twente

Upload: snowy

Post on 22-Jan-2016

72 views

Category:

Documents


1 download

DESCRIPTION

Graph Transformation for Model Transformation. Arend Rensink University of Twente. Trafo Def Language. Language A. A-B Trafo Def. Language B. Overview. Scenario Outline of the presentation Requirements Principles Example Practice Next step Final words. A-Model. A-B Trafo. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Graph Transformation for  Model Transformation

30 March 2005, IPA lentedagen, Breda

Graph-Based State Spaces 1

Graph Transformation for Model Transformation

Arend RensinkUniversity of Twente

Page 2: Graph Transformation for  Model Transformation

30 March 2005, IPA lentedagen, Breda

Graph-Based State Spaces 2

Overview

• Scenario

• Outline of the presentation– Requirements– Principles– Example– Practice– Next step– Final words

A-Model A-B Trafo B-Model

Language A A-B Trafo Def

Trafo Def Language

Language B

Page 3: Graph Transformation for  Model Transformation

30 March 2005, IPA lentedagen, Breda

Graph-Based State Spaces 3

Requirements: What do we need?• Reasoning about models– Instances of different meta-models– Need common representation

• Idea: graphs as common representation– Powerful yet simple– Natural for many models – Theory of graph transformation available

• Some aspects not covered well– Cardinality and inheritance in meta-models– Ordered associations– Attributes

Page 4: Graph Transformation for  Model Transformation

30 March 2005, IPA lentedagen, Breda

Graph-Based State Spaces 4

Example: ASG to FG

• Abstract Syntax Graph model

Statementnext

1

0..1

AssignIfWhile

body

else

then 0..11

Page 5: Graph Transformation for  Model Transformation

30 March 2005, IPA lentedagen, Breda

Graph-Based State Spaces 5

Example: ASG instance

• Programready = false;while (! ready) {

if (x < max) {x = x*x;ready =

true;} else {

ready = false;

}}

• Graph Assign

While

If

Assign

Assign

Assign

next

body

then

next

else

Page 6: Graph Transformation for  Model Transformation

30 March 2005, IPA lentedagen, Breda

Graph-Based State Spaces 6

Target model: Flow Graphs

Element

flow

1 2

Procedure Stop

flow

Predicate

nondeterministic choice

Page 7: Graph Transformation for  Model Transformation

30 March 2005, IPA lentedagen, Breda

Graph-Based State Spaces 7

Example: FG instance

• ASG Assign

While

If

Assign

Assign

Assign

next

body

then

next

else

• FG Proc

Pred

Pred

Proc

Proc

Proc

flow

flow

flow

flow

flow

Stop

flow flow

Page 8: Graph Transformation for  Model Transformation

30 March 2005, IPA lentedagen, Breda

Graph-Based State Spaces 8

Trafo Def: set of rulesstart

assign

if-else

stop

if-no-else while

Page 9: Graph Transformation for  Model Transformation

30 March 2005, IPA lentedagen, Breda

Graph-Based State Spaces 9

Graph formalism

• Graphs in this presentation:– flat (i.e., not hierarchical), untyped– directed, edge-labelled, no parallel edges– self-edges depicted as node labels

• Formally: G = (L,N,E) with– L set of labels– N finite set of nodes– E N L N finite set of labelled edges

• Partial morphisms– structure-preserving node mappings

Page 10: Graph Transformation for  Model Transformation

30 March 2005, IPA lentedagen, Breda

Graph-Based State Spaces 10

forbidden

Graph ProductionsProduction rule

source graph

matching

Concrete transformation

src(t) tgt(t)morph(t) target

graph

pushout

NACNACNACs

(SPO = Single Pushout Approach)

LHS RHSrule morphism

(partial)

Page 11: Graph Transformation for  Model Transformation

30 March 2005, IPA lentedagen, Breda

Graph-Based State Spaces 11

Example production ruleAlternative single-graph representation

blue = eraser:LHS, not RHS;

to be matched and deleted

green = creator:

RHS, not LHS;to be added

black = reader:LHS and RHS;

to be matched and preserved

red = embargo:

NAC, not LHS;forbidden

Page 12: Graph Transformation for  Model Transformation

30 March 2005, IPA lentedagen, Breda

Graph-Based State Spaces 12

B-Model

Lang B

Application scenario

• Overhead: Transformation to and from graphs– Price for common representation

• Graph transformations inefficient– Graph matching inherently complex (NP-complete)– Domain-specific transformations superior– Graph Trafo can serve as specification

A-B Trafo

A-B Prod Syst

Graph Production Systems

A-Graph

A-Type

A-Model

Lang A

B-Graph

B-Type

should be reversible

Page 13: Graph Transformation for  Model Transformation

30 March 2005, IPA lentedagen, Breda

Graph-Based State Spaces 13

Graphs everywhere

• Other modelling domains (meta-models)– XSD/XML– ERD schemas/databases– Class/object diagrams

• Certain patterns emerge– Commonalities among modelling

domains– Should be formulated on MOF level

Page 14: Graph Transformation for  Model Transformation

30 March 2005, IPA lentedagen, Breda

Graph-Based State Spaces 14

Practice: What is available?

• BOTL (München) – Bidirectional O-o Transformation Language– Transforms object models to object models

• FuJaBA (Paderborn, Kassel)– From UML to Java and Back Again– Generates Java code from enriched activity

diagrams

• ATOM3 (Madrid)– A Tool for Multi-Formalism Meta-Modelling– Transforms any model at any meta-level

Page 15: Graph Transformation for  Model Transformation

30 March 2005, IPA lentedagen, Breda

Graph-Based State Spaces 15

Next step: Dynamic Semantics• Current research mostly on static semantics– Models: Class diagrams, ERD schemes, XML

schemas– Instances: Objects, ER databases, XML documents

• Dynamic semantics: how do systems behave?– Can be expressed as changes on instance level– These can also be seen as transformations– Graph transformations for operational semantics– Aim: Semantics-preserving model transformations

• NWO project: GRASLAND– Graphs for Software Language Definition– Aim: Generic semantic definition language

Page 16: Graph Transformation for  Model Transformation

30 March 2005, IPA lentedagen, Breda

Graph-Based State Spaces 16

TAAL Experiment[Kleppe, Rensink,

Kastenberg]

• Example O-Olanguage

• Transformations

dynamic semantics

ASG to FGmeta-levelshift

GROOVE

Page 17: Graph Transformation for  Model Transformation

30 March 2005, IPA lentedagen, Breda

Graph-Based State Spaces 17

Final words• MDA: Cool idea– Good intuitions– Poor mathematical backing

• Graph transformation: Promising approach– Good mathematical backing– Useful for formalizing principles– Questionable for practical transformations

• State of the art– A lot of work at the stage of (small) case studies– We need engineering discipline

(Who’s going to write the XSD meta-model in MOF?)