bidirectionalization of atl with groundtram : transformation algorithms (ongoing work)

Post on 02-Jan-2016

37 Views

Category:

Documents

3 Downloads

Preview:

Click to see full reader

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

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

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)

Toward Bidirectionalization of ATL

A core subset of

ATL

The full set of ATL

UnQLencode

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

Bidirectionalizing a subset of ATL by GRoundTram

ATLmodel M1 model M2

encode

graph g1

UnQLgraph g2

encode

GRoundTram

decode encodedecode

updateupdate

A simple model (by Massimo)

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)

(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

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}

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.

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 )}

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 )}

Algorithm for encoding ATL in UnQL

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

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)} | …..

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)))

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.

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)

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.

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).)

Thank you

top related