Bidirectionalization of ATL with GRoundTram : Transformation algorithms (ongoing work)

20
Bidirectionalization of ATL with GRoundTram: Transformation algorithms (ongoing work) Isao Sasano Shibaura Institute of Technology AtlanMod-BiG Joint workshop 15-16 September 2012 Joint work with AtlanMod and BiG group

description

Bidirectionalization of ATL with GRoundTram : Transformation algorithms (ongoing work). Joint work with AtlanMod and BiG group. Isao Sasano Shibaura Institute of Technology. AtlanMod -BiG Joint workshop 15-16 September 2012. O bjective of this work. - PowerPoint PPT Presentation

Transcript of Bidirectionalization of ATL with GRoundTram : Transformation algorithms (ongoing work)

Page 1: Bidirectionalization  of ATL with  GRoundTram : Transformation  algorithms (ongoing work)

Bidirectionalization of ATL with GRoundTram: Transformation algorithms

(ongoing work)

Isao Sasano Shibaura Institute of Technology

AtlanMod-BiG Joint workshop 15-16 September 2012

Joint work with AtlanMod and BiG group

Page 2: Bidirectionalization  of ATL with  GRoundTram : Transformation  algorithms (ongoing work)

Objective of this work

We aim to show correspondence between ATL system and GRoundTram system, providing a way to bidirectionalize ATL.

Model driven development in

ATL system

Bidirectional graph transformation in

GRoundTram system

(Currently uni-direction, Rule based)

(function from graph to graph)

Page 3: Bidirectionalization  of ATL with  GRoundTram : Transformation  algorithms (ongoing work)

Toward Bidirectionalization of ATL

A core subset of

ATL

The full set of ATL

UnQLencode

Page 4: Bidirectionalization  of ATL with  GRoundTram : Transformation  algorithms (ongoing work)

Ongoing work

• Connect ATL system and GRoundTram system– Encoding and decoding between models in ATL

system in xmi format and graphs in GRoundTram system

– Encoding ATL rules in ATL system into unql queries in GRoundTram system

– Basic algorithms are presented in ICMT 2011

Page 5: Bidirectionalization  of ATL with  GRoundTram : Transformation  algorithms (ongoing work)

Bidirectionalizing a subset of ATL by GRoundTram

ATLmodel M1 model M2

encode

graph g1

UnQLgraph g2

encode

GRoundTram

decode encodedecode

updateupdate

Page 6: Bidirectionalization  of ATL with  GRoundTram : Transformation  algorithms (ongoing work)

A simple model (by Massimo)

Page 7: Bidirectionalization  of ATL with  GRoundTram : Transformation  algorithms (ongoing work)

Encoding models into graphs

• We have to be able to transform the graph representation back into a representation in the original form

• We embed some ID’s in the graphs as edge labels to keep correspondence with models (this might not be necessary by Massimo’s ID embedding)

Page 8: Bidirectionalization  of ATL with  GRoundTram : Transformation  algorithms (ongoing work)

(Example) Encoding a model into a graph

Class Attributename=“Person”

attr name=“name”

Class Attribute

name

“Person”

attr

owner

owner

name

“name”

1 2

12

Page 9: Bidirectionalization  of ATL with  GRoundTram : Transformation  algorithms (ongoing work)

Encoding algorithm(1) Assign numbers 1, . . . , n to all the model elements and let them be s1, . . . , sn .(2) Visit the elements s1, . . . , sn . For each si , let (ni , {f1 , . . . , fk}) = si , gi = &mi := {ni : (trans (f1) ∪ …∪ trans (fk))}} g0 = &src := { : &m1, … , : &mt}Return &src @ cycle (g0 g1 … gn) .trans (l = atom) = {l : {atom}} trans (reference l --> sj) = {l : &mj}

Page 10: Bidirectionalization  of ATL with  GRoundTram : Transformation  algorithms (ongoing work)

A subset of ATL (by Massimo)

module = module id; create id : id; from id : id; rule+rule = rule id from inPat to outPat+inPat = id : oclType | id : oclType (oclExp)outPat = id : oclType (binding, …)binding = id ← oclExpoclExp = id | oclExp.id | oclExp.id(oclExp, …) | string | …

Imperative features and many of OCL expressions are excluded.

Page 11: Bidirectionalization  of ATL with  GRoundTram : Transformation  algorithms (ongoing work)

An example of ATL rules (by Massimo)

rule Class2Table { from s : ClassDiagram!Class to t : Relational!Table ( name <- s.name, col <- s.attr )}

rule Attribute2Column { from s : ClassDiagram!Attribute ( not s.multiValued )

to t : Relational!Column ( name <- s.name, type <- s.type )}

Page 12: Bidirectionalization  of ATL with  GRoundTram : Transformation  algorithms (ongoing work)

An example of ATL rules (cont.)

rule Datatype2Type { from s : ClassDiagram!DataType to t : Relational!Type ( __xmiID__ <- 'IN'.concat(s.__xmiID__.concat('.Datatype2Type.t')), name <- s.name )}

Page 13: Bidirectionalization  of ATL with  GRoundTram : Transformation  algorithms (ongoing work)

Algorithm for encoding ATL in UnQL

We transform a rule into mutually recursive UnQL functions, with reflecting the encoding of models.

Page 14: Bidirectionalization  of ATL with  GRoundTram : Transformation  algorithms (ongoing work)

Encoding result (Class2Relational) (expected)sfun Class2Table({Class:$s}) = {Table:Class2TableAux($s)} | Class2Table({$l:$s}) = {$l:Class2Table($s)}and sfun Class2TableAux({attr:$s}) = (select {col:$a1} where $a1 in Class2Table($s)) | Class2TableAux({name:$s}) = (select {name:$a1} where $a1 in Class2Table($s)) | Class2TableAux({__xmiID__:$s}) = (select {__xmiID__:$a5} where …. | Class2TableAux({$l:$s}) = {}andsfun Attribute2Column ({Attribute:$s}) = {Column:Attribute2ColumnAux($s)} | …..

Page 15: Bidirectionalization  of ATL with  GRoundTram : Transformation  algorithms (ongoing work)

Whole encoding result (expected) select letrec sfun Class2Table … = … and sfun Class2TableAux … = … and sfun Attribute2Column … = … and sfun Attribute2ColumnAux … = … and sfun DataType2Type … = … and sfun DataType2TypeAux … = … in Datatype2Type (Attribute2Column (Class2Table ($db)))

Page 16: Bidirectionalization  of ATL with  GRoundTram : Transformation  algorithms (ongoing work)

Current restriction

• Currently we only cope with the ATL rules that have only one output pattern.– Now we are considering how to allow multiple

output patterns.

Page 17: Bidirectionalization  of ATL with  GRoundTram : Transformation  algorithms (ongoing work)

Summary

• We have presented an approach to bidirectionalize ATL by:– encoding a subset of ATL into UnQL– encoding models in xmi format into graphs (in dot format)

Page 18: Bidirectionalization  of ATL with  GRoundTram : Transformation  algorithms (ongoing work)

Work in near future

• Implememt the transformation algorithms– Xmi (in Massimo’s format) to graph --- now

implementing (almost finished)– A subset of atl (by Massimo) to unql --- now ready

to implement (with some restrictions)– Graph to xmi --- start implemeting after the above

two finished• Apply to examples including– Simplified version of Class2Relational example.

Page 19: Bidirectionalization  of ATL with  GRoundTram : Transformation  algorithms (ongoing work)

Things to discuss

• Xmi format adapted• how to transform back to xmi from graphs– Graphs (after the forward transformatio) may lose

sharing information.– Should we reflect the original xmi structure?

• (Inside the BiG: how to treat atl rules with multiple output patterns. The problem is to refer to the function in the outer level. This might be coped with by introducing accumulating paraeter (Kato-san’s idea).)

Page 20: Bidirectionalization  of ATL with  GRoundTram : Transformation  algorithms (ongoing work)

Thank you