soichiro hidaka* national institute of informatics eassy ......2 overview of works in nii control...

33
Bidirectional Graph Transformation Infrastructure and its Applications Soichiro Hidaka* National Institute of Informatics EASSy 2013 September 10 th , 2013 *and collaborators

Upload: others

Post on 26-Apr-2021

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

Bidirectional Graph Transformation Infrastructure

and its Applications

Bidirectional Graph Transformation Infrastructure

and its Applications

Soichiro Hidaka*National Institute of Informatics

EASSy 2013September 10th, 2013

*and collaborators

Page 2: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

2

Overview of works in NII

Control loop for cleaning

Collect

Battery maintained

Object found

Battery level observed

Battery charged

Current position detected

Dust disposed

Dust picked up

Dust swept

Dust appearance and cleaning result

observed

Analyze & Decide

Analyze & DecideConditional Act

Act Collect

Got close to object

Analyze& Decide

Collect

Control loop for battery maintenance

Object reachable

ActCollect

Dust reachable

Station reachable

Act

Act

Control loop for approaching object

Dust appearance

Cleaning result

Cleaning method

Battery level

Migration direction

Object position

Current position

Collect

Battery maintained

Object and obstacle found

Battery level observed

Battery charged

Current position detected

Dust disposed

Dust picked up

Dust swept

Dust appearance and cleaning

result observed

Analyze & Decide

Analyze & Decide

Conditional Act

Act Collect

Got close to object

Analyze& Decide

Collect

Control loop for battery maintenance

Object reachable with

avoiding obstacles

Act

Load capacity not exceeded

Load amount observed

Dust unloaded into dustbin

Analyze & DecideAct CollectControl loop for load amount management

Collect

Dustbin reachable

Dust reachable

Station reachable

Act

Act

Act

Control loop for approaching object

Dust appearance

Cleaning result

Control loop for cleaning

Cleaning method

Battery level

Migration direction

Object position

Current position

Load amount

・Exploration of adaptation spaceFuyuki Ishikawa

・Composition‐based interaction designfor adaptable distributed software systemsKenji Tei

Adaptation space analysis

Traceability maintenance to localize changes

traceab

ility link

adaptation

ArchitectureDesign

DetailedDesign

Req.analysis Impl.

deploymentCondition = ALL

: MemberRole

encryption = NONEcompress = NONEtransmissionCondition = 10 minsendDataType = TEMPERATUREprotocol = CTP

: SendingTask

samplingCondition = 10 mindataType = TEMPERATURE

: SamplingTask

deploymentCondition = ALL

: MemberRole

encryption = NONEcompress = NONEtransmissionCondition = 10 minsendDataType = HUMIDITYprotocol = CTP

: SendingTask

samplingCondition = 10 mindataType = HUMIDITY

: SamplingTask

deploymentCondition = ALL

: MemberRole

encryption = NONEcompress = HuffmantransmissionCondition = 30 secsendDataType = ACCELERATIONprotocol = CTP

: SendingTask

samplingCondition = 0.2 secdataType = ACCELERATION

: SamplingTask

deploymentCondition = ALL

: MemberRole

encryption = NONEcompress = NONEtransmissionCondition = 10 minsendDataType = DEFORMATIONprotocol = CTP

: SendingTask

samplingCondition = 10 mindataType = DEFORMATION

: SamplingTask

duration = 10 mintimeWindow = 100 minfunction = AVERAGEinputDataType = DEFORMATION

: TemporalAggregationTask

location = 3Fid = 153

: Node

location = 3Fid = 141

: Node

location = 3Fid = 146

: Node

deploymentCondition = ALL

: MemberRole

encryption = NONEcompress = NONEtransmissionCondition = 10 minsendDataType = TEMPERATUREprotocol = CTP

: SendingTask

samplingCondition = 10 mindataType = TEMPERATURE

: SamplingTask

deploymentCondition = ALL

: MemberRole

encryption = NONEcompress = NONEtransmissionCondition = 10 minsendDataType = HUMIDITYprotocol = CTP

: SendingTask

samplingCondition = 10 mindataType = HUMIDITY

: SamplingTask

deploymentCondition = ALL

: MemberRole

encryption = NONEcompress = HuffmantransmissionCondition = 30 secsendDataType = ACCELERATIONprotocol = CTP

: SendingTask

samplingCondition = 0.2 secdataType = ACCELERATION

: SamplingTask

deploymentCondition = ALL

: MemberRole

encryption = NONEcompress = NONEtransmissionCondition = 10 minsendDataType = DEFORMATIONprotocol = CTP

: SendingTask

samplingCondition = 10 mindataType = DEFORMATION

: SamplingTask

duration = 10 mintimeWindow = 100 minfunction = AVERAGEinputDataType = DEFORMATION

: TemporalAggregationTask

location = 3Fid = 153

: Node

location = 3Fid = 141

: Node

location = 3Fid = 146

: Node

・Putback‐based Bidirectional ProgrammingZhenjiang Hu・Bidirectional Graph Transformation Infrastructureand its ApplicationsSoichiro Hidaka

Change propagation

・Designing  Self‐adaptive System using Control Loops Shinichi Honiden

Page 3: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

3

Bidirectional Transformation

Page 4: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

4

Bidirectional Transformation (BX)

src tgt

tgt’

mod

src’

src tgt

tgt’

mod

src’

get

put

[Nate Foster, et al: POPL 2005]

Page 5: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

5

Roundtrip Properties

src tgt

tgt’

mod

src’

get

put

Get-Put: put s (get s) = s

Put-Get:get (put s t) = t

Get-Put: put s (get s) = s

Put-Get:get (put s t) = t

Page 6: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

6

Pervasive Bidirectional Transformation

src tgt

tgt’

mod

src’

get

put

DB View

View Updating (80’)

Data Synchronization (2006)

ModelModel

CodeCode

Model Code Coevolution (2012)

Page 7: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

7

Bidirectional GraphTransformation

Page 8: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

8

BX on Graphs is Wanted!

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 9: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

9

Bidirectional Model TransformationExample

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

Can We Design a Language for BiG?

Page 10: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

10

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 11: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

11

Limitations in Existing Approaches

• Database/programming languages field– Targeted to tables, lists, trees– Graphs have not been

addressed directly– Why? Graphs have: cycles and

sharing• Software engineering field

(models = graphs)– Difficult to guarantee well-

behavedness (round-trip) in compositional settings

DB approach

PLapproach

SE approach

Termination,Equality,

Back-propagation

Page 12: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

12

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 13: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

13

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 14: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

14

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 15: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

15

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 16: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

16

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 17: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

17

Graph Model

• Rooted Edge-labeled Graph

Page 18: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

18

Structuring Graphs as Regular Trees

• Graph Equivalence based on Bisimulation

Page 19: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

19

Example: A Customer-Order Graph

Page 20: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

20

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 21: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

21

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 22: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

22

Applications

Page 23: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

23

Application to Software Engineering

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

Demo at ICSE’12

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 popular development environment

Page 24: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

24

Collaborative development of Bio-models

J. R. Wilson-Kanamori, S. Hidaka, A Bidirectional Collaboration Framework for Bio-Model Development, 2nd International Workshop on Bidirectional Transformations, Mar 2013

Page 25: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

25

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, 2nd International Workshop on Bidirectional Transformations, Mar2013

Page 26: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

26

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, May 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 27: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

27

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 de-facto 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 28: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

28

Conclusion

• First framework of compositional and well-bahaved BX of graphs– Can be considered as infrastructure of

adaptation by propagating changes forward and backaward

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

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

Page 29: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

29

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 30: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

AppendixAppendix

Page 31: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

31

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 32: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

32

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 33: Soichiro Hidaka* National Institute of Informatics EASSy ......2 Overview of works in NII Control loop for cleaning Collect Battery maintained Object found Battery level observed Battery

33

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