compositional development framework for …...model transformations (short paper), ase 2011 10 our...

37
Compositional development framework for bidirectional model transformations based on structural recursion on graphs Soichiro Hidaka* National Institute of Informatics BIRS-BX 2013 December 4, 2013 *Joint work with BiGteam@NII (K.Asada, Z. Hu, K. Inaba, H. Kato, K. Matsuda, K. Nakano,). Other collaborators appear explicitly in the slides.

Upload: others

Post on 07-Feb-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

Compositional development framework for bidirectional model transformations based on

structural recursion on graphs

Compositional development framework for bidirectional model transformations based on

structural recursion on graphs

Soichiro Hidaka*National Institute of Informatics

BIRS-BX 2013December 4, 2013

*Joint work with BiGteam@NII (K.Asada, Z. Hu, K. Inaba, H. Kato, K. Matsuda, K. Nakano,). Other collaborators appear explicitly in the slides.

Page 2: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

2

Bidirectional GraphTransformation

Page 3: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

3

BX on Graphs

Model‐basedRequirements Analysis

Model‐basedSoftware Design

Model‐based Component Composition

Model‐based Application Deployment

Model‐based Testing

Models: GraphsBidirectional Model Transformation: Bidirectional Graph Transformation

Page 4: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

4

Can We Design a Language for BiG?

Association

name = "address"

Classname = "Person"is_persistent = true

src_of srcClass

name = "Address"is_persistent = false

dest

Association

name = "phone"

src_of srcClass

name = "Phone"is_persistent = true

dest

Attributename = "name"is_primary = true

attrsAttribute

name = "addr"is_primary = true

attrsAttribute

name = "number"is_primary = true

attrs

PrimitiveDataType

name = "String"

type type

PrimitiveDataType

name = "Integer"

typeTable

name = "Person"

Columnname = "name"type = "String"

pkey cols

Columnname = "addr"type = "String"

cols

Columnname = "number"

type = "Integer"

cols Fkey

fkeys

Table

name = "Phone"

Columnname = "number"

type = "Integer"

pkey cols

refs

cols

Page 5: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

5

Example of BX on Graphs

backward

forward

• Replace ‘a’ by ‘d’ and removes ‘c’

1

3

5

b

d

d

d2

D 7

B4

b

d

1

3

5

b

a

a

a2 4

b

D7

B

6

c

Insertion

RenamingDeletion

dforward

Page 6: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

6

WPutGet (Weak PutGet)

backward

modify

t’

forward t

s’

s

forward

t’’s’ backward

= ≠

Page 7: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

7

Towards a General Solution …

• How to deal with termination of graph transformation?

• How to deal with equality of two graphs?

• How to correctly reflect changes on the view to the source?

Structural Recursion and its bulk semantics

Bisimulation (graphs as regular trees)

Traceability based on Bulk Semantics

Page 8: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

8

GRoundTram: A General Functional Framework

• It is compositional (functional)– Based on the existing graph query language UnQL

• It is well-behaved– Built upon bidirectional UnCAL: a graph algebra with

clear bidirectional semantics

• It is an integrated development environment– Graph editor, graph validation, graph transformation

checking, visualizations of bidirectional behavior

Page 9: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

9

Overview of GRoundTram

SAC’09 PPDP’11

UserInput

ICFP’10, LOPSTR’11

ICFP’13

PPDP’13

[ASE] S. Hidaka, Z. Hu, K. Inaba, H. Kato and K. Nakano, GRoundTram: An Integrated Framework for Developing Well-Behaved Bidirectional Model Transformations(short paper), ASE 2011

Page 10: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

10

Our Approach:Bidirectionalization

UnCAL graph algebrastructural recursion

[Buneman et al., VLDBJ00]

UnCAL graph algebrastructural recursion

[Buneman et al., VLDBJ00]

Bidirectional InterpreterOperation based updatingBidirectional InterpreterOperation based updating

sourcegraphsourcegraph

targetgraphtargetgraph

Bidirectionalization•adding trace information•narrowing

[ICFP’10] S. Hidaka, Z. Hu, K. Inaba, H. Kato, K. Matsuda, K. Nakano, Bidirectionalizing Graph Transformations, 15th ACM SIGPLAN International Conference on Functional Programming, pp.205-216 Sep 2010

Page 11: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

11

Model Transformation in UnQL+(Compositional and Functional)Model Transformation in UnQL+(Compositional and Functional)

UnCAL Graph Algebra(Structural Recursion)

UnCAL Graph Algebra(Structural Recursion)

UnQL+ to UnCALTranslation[SAC]UnQL+ to UnCALTranslation[SAC]

Source/Target ModelsSource/Target Models

Bidirectional Interpreter [ICFP]

Bidirectional Interpreter [ICFP]

Optimizer[LOPSTR]Optimizer[LOPSTR]

TransformationVerifier[PPDP]

TransformationVerifier[PPDP]

Graph Verifier[SAC]

Graph Verifier[SAC]

Update Checker[JSSST]

Update Checker[JSSST]

Backend Engine for Bidirectional UnCAL

UnCAL GraphsUnCAL Graphs

Bidirectional Graph Contraction[ASE,PI] Bidirectional Graph Contraction[ASE,PI] 

Frontend of Bidirectional UnCAL

Architecture of GRoundTram

Application

[ICSE,BX]

Page 12: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

12

UnCAL : Graph Query Language

UnCAL (Unstructured CALculus) [Buneman et al. VLDB J. 2000] features:

1. Regular tree transformation2. Structural Recursion3. Termination and finiteness-

preserving

Page 13: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

13

UnCAL-1. Regular Tree Transformation

• {finite graphs}/bisimilarity {regular trees}→Graph transformations as regular tree

transformations• All UnCAL queries are well-defined

w.r.t. bisimilarityg1g2 f(g1)f(g2)

Page 14: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

14

Graph Model

bisimulation = strong bisim.+ -eliminationd

dab

c &y

&

G=(V,B,I ) whereunfold

duplicate

dd

d c

2 3 4

1

-elimination

c

d

dc

d

d

cd

d

cd

d

V ={1,2,3,4},B ={1{E(d,2),E(a,4)},

2{E(c,3)},3{E(d,2)}, 4{E(b,3),O(&y)}},

I ={(&1)}

Graph Model Graph Equivalence

Page 15: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

15

g1 g2 g

&x1 &x2 &y1 &y2 &x1 &x2 &y1&y2

Graph Constructors

g1

g2

g

&x1 &x2

&y1 &y2&y1 &y2

g1

g2

&x1 &x2

@

{} & ()

gg0

&y1 &y2

&y1 &y2

&y1 &y2

cycle

g&x g0

&y1 &y2 &x.&y1 &x.&y2

:=

&y&

&yl

g1 g1

{_:_} g

&

&l

g2g1g1 g2

&x1 &x2 &x1 &x2

&x1&x2

Page 16: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

16

UnCAL-2: Structural Recursion

• Functional style programming / reasoning

f {} = {}

f ({l:G}) = e(l,G)@ f G

f (G1G2) = (f G1)(f G2)

For f = srec(e)For example:

Page 17: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

17

UnCAL-3:Termination and Finiteness-Preserving

• Bulk semantics

RN 4RN 3RN 2

RN 1

RE 5 (1,d,2)

RE 6 (1,d,2)d

RE 3 (2,c,3)

RE 4 (2,c,3)

RE 5 (4,b,3)

RE 6 (4,b,3)bRE 5 (3,d,2)

RE 6 (3,d,2)

RE 1(1,a,4)

RE 2 (1,a,4)d

d

a2d_xc=srec((l,g). if l=a then {d:&}else if l=c then {:&}else             {l:&})

&y

dd

ab

c &y2 3 4

1

Page 18: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

18

Example: A Customer-Order Graph

Page 19: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

19

Compositional User Language

• SQL-like graph query language

select {tables : $table} where$persistentClass in

(* select classes *)(select $class where

{Association.(src|dest).Class : $class} in $db,{is_persistent : {Boolean : true}} in $class),

$table in(* replace Attribute *)(replace attrs -> $g

by (select {Column : $a} where{attrs.Attribute : $a} in $persistentClass)

in $persistentClass)

select {tables : $table} where$persistentClass in

(* select classes *)(select $class where

{Association.(src|dest).Class : $class} in $db,{is_persistent : {Boolean : true}} in $class),

$table in(* replace Attribute *)(replace attrs -> $g

by (select {Column : $a} where{attrs.Attribute : $a} in $persistentClass)

in $persistentClass)

Page 20: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

20

GUI of the GRoundTRamImplementation

• Fwd/bwd transformation by 1 click• Invalid modification on the target is

reported.• Corresponding source and target nodes are

highlighted

Page 21: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

21

Applications

Page 22: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

22

Application to Software Engineering

Co-evolution of models and codes “Invoking GrondTram...doing backward transformation ...”

Proposal:’Undo’ of the programmer’s change is represented by the forward transformation of BX. Model updates are propagated using backward transformation.

Background:Codes generated from models are often modified by the programmers. Models are also updated.

Problem:Changes by the programmar are lost when the codes are regenerated from the updated model

Contribution:Consistent evolution of models and codes Integrated

into Eclipse

Y. Yu, Y. Lin, Z. Hu, S. Hidaka, H. Kato, L. Montrieux, Maintaining Invariant Traceability through Bidirectional Transformations, (ICSE 2012) pp.540-550

Page 23: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

23

Collaborative development of Bio-models

J. R. Wilson-Kanamori, S. Hidaka, A Bidirectional Collaboration Framework for Bio-Model Development, BX’13, Mar 2013

Page 24: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

24

Bidirectional graph transformation (non-bijective)

Bijective transformation (conversion/translation)

Common model representation

Edge-labelled graph representation

computationalmodeller

experimental biologist

shared knowledge

base

UnQL query(ex: extract

interested parts)

stochasticallysimulable

representation

High-level query

High-level query

UnQL query(ex: extract

interested parts)visual model

representation

refined view

refined

view

Collaborative development of Bio-models

J. R. Wilson-Kanamori, S. Hidaka, A Bidirectional Collaboration Framework for Bio-Model Development, BX’13, Mar 2013

Page 25: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

25

Feedback of verification results to designed activity

Counterexample or

correct execution sequence

programming test case generation

start to start

finish to finish

Extracted from [Zalila et al. ISoLA’12]

Formal verification

tool

Bwdt’

Fwd.t

s’

sTool specific model

Tool specific model

with scenario

Scenario

injection

Behavioral

model

Designer

Behavioral model ⇔Formal model TX

F. Zalila, S. Hidaka, Facilitating Verification Results Feedback on DSM Verification Context Using Bidirectional Model Transformation, submitted for publication, Oct 2013

Counterexample or

correct execution sequence

programming test case generation

start to start

finish to finish

Extracted from [Zalila et al. ISoLA’12]

Formal verification

toolTool specific model

Behavioral

model

designer

Behavioral model⇒Formal Model TX

I don’t understand what

the tool says.

Now I can understand!

Page 26: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

26

Integration with Unidirectional Transformation

transformation in subset of ATL

model M1 model M2

encode

graph g1

transformation in UnQL

graph g2

encode

GRoundTram

decode encodedecode

• BXing model transformation language ATL (INRIA, Shibaura Institute of Technology/NII)

Cf. BiQuery/iGRT by Zan Tao et al.

I. Sasano, Z. Hu, S. Hidaka, K. Inaba, H. Kato, K. Nakano, Toward bidirectionalization of ATL with GRoundTram, Proc. of the 4th International Conference on Model Transformation (ICMT 2011) LNCS 6707 pp.138-151 Jun 2011

Page 27: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

27

Challenges

Page 28: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

28

Ordered branches and mixed

F. Jouault and J. Bezivin. KM3: A DSL for metamodel specification. In Formal Methods for Open Object-Based Distributed Systems, pp.171–185. LNCS 4037, 2006.

Page 29: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

29

From Unordered to Ordered Graphs

B : V (L VY)B(1)={E(a,4),E(d,2)},...

1

2 3 4

dd

ab

c &y

1

2 3 4

dd

ab

c &y

dd

ab

c &y2 3 4

1

B :V List(L VY)B(1)=[E(a,4),E(d,2)],...

Unordered Graph

Ordered Graph

Page 30: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

30

Ordered branches and mixed

• Our preliminary works– Simple bidirectional transformations on ordered

graphs– Unidirectional transformations with more

expressive sibling transformations

Towards Bidirectional Transformations on Ordered Graphs, Soichiro Hidaka,Kazuyuki Asada, Hiroyuki Kato, Keisuke Nakano, Zhenjiang Hu, Technical Report,GRACE Center, National Institute of Informatics (GRACE-TR-2011-07), Dec. 2011

Soichiro Hidaka, Kazuyuki Asada, Zhenjiang Hu, Hiroyuki Kato, Keisuke Nakano, Structural Recursion for Querying Ordered Graphs, ICFP 2013, pp. 305--318, Sep 2013

Page 31: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

31

Feature-Based Classification of Bidirectional Transformation Approaches

Existing tools

Feature model on BXDomain Analysis

of BX

Apply toolsto the Feature

Model

analysisof missing/ unexplored features

Clarification of BX design space

Proposals of future research directions/themes

Existing tools and literatures

Exhaustive tool survey has not been the main focus

Joint work with Massimo Tisi, Jordi Cabot (Ecole des Mines de Nantes/INRIA), Zhenjiang Hu (NII)

Page 32: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

32

Conclusion

• Framework of compositional and well-bahaved BX of graphs

• Implemented BX platform for graphsGRoundTram– Used by research groups beside us

• Applied to model-code co-evolution, synthetic biology, and other research projects

• Research challenges include BX on orderedgraphs and mixed

Page 33: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

33

Thank you very much for your kind attentions.

More information can be found athttp://research.nii.ac.jp/~hidaka/ and http://www.biglab.org/

Page 34: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

AppendixAppendix

Page 35: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

35

Publications - Foundations

[ICFP’10] S. Hidaka, Z. Hu, K. Inaba, H. Kato, K. Matsuda, K. Nakano, Bidirectionalizing Graph Transformations, 15th ACM SIGPLAN International Conference on Functional Programming, pp.205-216 Sep 2010

[PPDP’11] K. Inaba, S. Hidaka, Z. Hu, H. Kato, K. Nakano, Graph-Transformation Verification using Monadic Second-Order Logic, 13th International ACM SIGPLAN Symposium on Principles and Practice of Declarative Programming, pp.17-28 Jul 2011

[LOPSTR] S. Hidaka, Z. Hu, K. Inaba, H. Kato, K. Matsuda, K. Nakano and I. Sasano, Marker-directed optimization of UnCAL graph transformations, 21st International Symposium on Logic-Based Program Synthesis and Transformation (LOPSTR 2011) LNCS vol. 7225, pp.123-138 Jul 2011

[ICFP’13] S. Hidaka, K. Asada, Z. Hu, H. Kato, K. Nakano, Structural Recursion for Querying Ordered Graphs, 18th ACM SIGPLAN International Conference on Functional Programming, to appear, Sep 2013

[PPDP’13] K. Asada, S. Hidaka, H. Kato, Z. Hu, K. Nakano, A Parameterized Graph Transformation Calculus for Finite Graphs with Monadic Branches,15th International Symposium on Principles and Practice of Declarative Programming, to appear, Sep 2013

[JSSST.J] K. Nakano, S. Hidaka, Z. Hu, K. Inaba, H. Kato, View Updatability Checking with Simulation-based Graph Schema,, JSSST Computer Software 29(2) pp.174-192 Apr 2012

Page 36: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

36

Publications - Framework

[PI] S. Hidaka, Z. Hu, K. Inaba, H. Kato, K. Nakano: GRoundTram: An Integrated Framework for Developing Well-Behaved Bidirectional Model Transformations, Progress in Informatics, No. 10, Apr 2013

[ASE] S. Hidaka, Z. Hu, K. Inaba, H. Kato and K. Nakano, GRoundTram: An Integrated Framework for Developing Well-Behaved Bidirectional Model Transformations (short paper), 26th IEEE/ACM International Conference on Automated Software Engineering (ASE 2011) pp.480-483 Nov 2011

[ICSE NIER] S. Hidaka, Z. Hu, H. Kato, K. Nakano, A compositional approach to bidirectional model transformation, 31st International Conference on Software Engineering Companion Volume pp.235-238 May 2009

[SAC] S. Hidaka, Z. Hu, H. Kato, K. Nakano, Towards a Compositional Approach to Model Transformation for Software Development, ACM symposium on Applied Computing pp.468-475 Mar 2009

Page 37: Compositional development framework for …...Model Transformations (short paper), ASE 2011 10 Our Approach:Bidirectionalization UnCAL graph algebra structural recursion [Buneman et

37

Publications - Applications

[ICSE] Y. Yu, Y. Lin, Z. Hu, S. Hidaka, H. Kato, L. Montrieux, Maintaining Invariant Traceability through Bidirectional Transformations, 34th International Conference on Software Engineering (ICSE 2012) pp.540-550 Jun 2012

[BX] J. Wilson-Kanamori and S. Hidaka, A Bidirectional Collaboration Framework for Bio-Model Development, Second International Workshop on Bidirectional Transformations (BX 2013), Mar 2013, Rome, Italy, colocatedwith ETAPS 2013

[ICMT] I. Sasano, Z. Hu, S. Hidaka, K. Inaba, H. Kato, K. Nakano, Toward bidirectionalization of ATL with GRoundTram, Proc. of the 4th International Conference on Model Transformation (ICMT 2011) LNCS 6707 pp.138-151 Jun 2011