synthesis of state machine diagrams from communication ...€¦ · synthesis of state machine...

39
UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009) Synthesis of State Machine Diagrams from Communication Diagrams by Using Petri Nets T. Miyamoto, H. Kurahata, T. Fujii, R. HosokawaOsaka University, Japan Osaka Gas Information System Research Institute, Japan c 2009 T. Miyamoto, Osaka University 1/39

Upload: nguyenkien

Post on 14-May-2018

230 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Synthesis of State Machine Diagrams from CommunicationDiagrams by Using Petri Nets

T. Miyamoto†, H. Kurahata†, T. Fujii‡, R. Hosokawa‡

†Osaka University, Japan‡Osaka Gas Information System Research Institute, Japan

c©2009 T. Miyamoto, Osaka University 1/39

Page 2: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Outline

1 Introduction

2 Choreography Realization

3 Construct State Machine by Using Petri Nets

4 Conclusions

c©2009 T. Miyamoto, Osaka University 2/39

Page 3: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Introduction

1 Introduction

2 Choreography Realization

3 Construct State Machine by Using Petri Nets

4 Conclusions

c©2009 T. Miyamoto, Osaka University 3/39

Page 4: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Introduction

SOA (Service Oriented Architecture)

Service Unit providing a specific function

Example Customer management, Shipping, etc.Key Principles by Thomas Erl (2004)

Loose couplingService contractAutonomyReusabilityComposabilityDiscoverability

System Composition of services

Application Business processes, Embedded system

c©2009 T. Miyamoto, Osaka University 4/39

Page 5: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Introduction

Motivation

Not easy to draw a detailed design from req.

Much easier to write an abstract spec.

Great help if a detailed design is generated fromabstract spec.

Improve quality of the developed system ifautomatically generated from a good spec.

Objective

Construct a detailed design from an abstract spec.

Requirements

Abstrat Spec.

Detailed Design

Implementation

c©2009 T. Miyamoto, Osaka University 5/39

Page 6: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Choreography Realization

1 Introduction

2 Choreography Realization

3 Construct State Machine by Using Petri Nets

4 Conclusions

c©2009 T. Miyamoto, Osaka University 6/39

Page 7: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Choreography Realization

Choreography Realization Problem

(C, I):Choreography modelC : Choreography

Messages between servicesObservable events of services

I : Set of service implementations

L(C) : Behavior allowed be choreography C

L(I) : Behavior generated by service implementations I

Realizability problem

Given: CIs C realizable? When realizable, obtain service implementations I.

C is realizable : ∃I, such that L(C) = L(I)

C is weakly realizable : ∃I such that L(C) ⊇ L(I)

c©2009 T. Miyamoto, Osaka University 7/39

Page 8: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Choreography Realization

Choreography Description Languages

ConversationProtocol

Sequence chart

Communication(Collaboration)diagram

Processalgebra

Petri net[J. Su, T. Bultan, X. Fu, and X. Zhao: Towards a Theory of Web Service

Choreographies, 2007]

Partial order among messages

c©2009 T. Miyamoto, Osaka University 8/39

Page 9: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Choreography Realization

Service Implementation Description Language

Statechart

Mealey automaton

UML state machine

Labelled transition system

Petri net

[T. Bultan, X. Fu, R. Hull, and J. Su: Conversation Specification: A New Approach to Design and Analysis of

E-Service Composition, 2003]

c©2009 T. Miyamoto, Osaka University 9/39

Page 10: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Choreography Realization

Related Works on Service Implementation Construction

Authors Choreography Service Impl.

T. Bultan et al.[9] Collabo. Diagram Mealy AutomatonG. Salaun et al. Process Algebra -J. Hanson et al. Mealy Automaton Mealy Automaton

D. Harel[2] LSC StatechartJ. Whittle et al.[3] MSC & OCL StatechartS. Leue et al.[4] MSC ROOM modelR. Lorenz et al.[7] Po-set Petri net

c©2009 T. Miyamoto, Osaka University 10/39

Page 11: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Choreography Realization

Conversation Protocol [J. Hanson et al.]

[J. Su, T. Bultan, X. Fu, and X. Zhao: Towards a Theory of Web Service Choreographies, 2007]

c©2009 T. Miyamoto, Osaka University 11/39

Page 12: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Choreography Realization

Direct Projection [T. Bultan et al.[9]]

M s : a set of messages and observableevents of service s

⇒s : partial order on M s

State machine (Σ, S, s0, δ, F )

Σ = Ms

S ⊆ 2Ms

s0 = Ms

δ : S × Σ → SF = {∅}

a

b c

d

{a,b,c,d}

{b,c,d}

{c,d} {b,d}

{d}

a

b

b

c

c

d

c©2009 T. Miyamoto, Osaka University 12/39

Page 13: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Construct State Machine by Using Petri Nets

1 Introduction

2 Choreography Realization

3 Construct State Machine by Using Petri Nets

4 Conclusions

c©2009 T. Miyamoto, Osaka University 13/39

Page 14: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Construct State Machine by Using Petri Nets

Our Method

Problem

Input C = {(M,⇒)} : choreographyM : a set of messages⇒ : a partial order relation on M

Output I = SM : a set of state machines

Subject to L(C) ⊆ L(I)

Use communication diagram and message relation table todefine partial order

Use Petri nets to marge partial orders

Try to use composite state of state machine for readability

c©2009 T. Miyamoto, Osaka University 14/39

Page 15: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Construct State Machine by Using Petri Nets

Construction Flow

MPN Model

service1

service2

MPN Model

Merged MPN Modelservice1

Merged MPN Modelservice2

Extended ROOM Model

service1service2

service3

a

b

State Machine Model

Communication Diagram

(service1)

Message Relation Table1.define message relation tables

2.make message Petri nets

3. merge message Petri nets

5. convert to state machine

Reachability Graph

4. construct reachability graph

c©2009 T. Miyamoto, Osaka University 15/39

Page 16: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Construct State Machine by Using Petri Nets

Communication Diagram to Draw Global Behavior

c©2009 T. Miyamoto, Osaka University 16/39

Page 17: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Construct State Machine by Using Petri Nets

Use Table to Define Partial Order

c©2009 T. Miyamoto, Osaka University 17/39

Page 18: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Construct State Machine by Using Petri Nets

Derive a Petri Net for Each Service from a CD

c©2009 T. Miyamoto, Osaka University 18/39

Page 19: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Construct State Machine by Using Petri Nets

Gather Petri Nets for Each Service

c©2009 T. Miyamoto, Osaka University 19/39

Page 20: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Construct State Machine by Using Petri Nets

Marge Nodes on Petri Net

c©2009 T. Miyamoto, Osaka University 20/39

Page 21: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Construct State Machine by Using Petri Nets

Marge Nodes on Petri Net

c©2009 T. Miyamoto, Osaka University 21/39

Page 22: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Construct State Machine by Using Petri Nets

Marge Nodes on Petri Net

c©2009 T. Miyamoto, Osaka University 22/39

Page 23: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Construct State Machine by Using Petri Nets

Marge Nodes on Petri Net

c©2009 T. Miyamoto, Osaka University 23/39

Page 24: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Construct State Machine by Using Petri Nets

Construct Reachability Graph of Petri Net

c©2009 T. Miyamoto, Osaka University 24/39

Page 25: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Construct State Machine by Using Petri Nets

Simplify the Reachability Graph

c©2009 T. Miyamoto, Osaka University 25/39

Page 26: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Construct State Machine by Using Petri Nets

Simplify the Reachability Graph

c©2009 T. Miyamoto, Osaka University 26/39

Page 27: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Construct State Machine by Using Petri Nets

Simplify the Reachability Graph

c©2009 T. Miyamoto, Osaka University 27/39

Page 28: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Construct State Machine by Using Petri Nets

Simplify the Reachability Graph

c©2009 T. Miyamoto, Osaka University 28/39

Page 29: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Construct State Machine by Using Petri Nets

Simplify the Reachability Graph

c©2009 T. Miyamoto, Osaka University 29/39

Page 30: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Construct State Machine by Using Petri Nets

Convert the Reachability Graph to State Machine

c©2009 T. Miyamoto, Osaka University 30/39

Page 31: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Conclusions

1 Introduction

2 Choreography Realization

3 Construct State Machine by Using Petri Nets

4 Conclusions

c©2009 T. Miyamoto, Osaka University 31/39

Page 32: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Conclusions

Conclusions

Construct State Machine from Communication Diagrams

Use communication diagram and message relation table todefine partial order

Use Petri nets to marge partial orders

Try to use composite state of state machine for readability

c©2009 T. Miyamoto, Osaka University 32/39

Page 33: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Appendix

Communication Diagram

Communication diagram Collaboration diagram

UML 2.x 1.xpredecessor No Yes

[OMG Unified Modeling Language, Superstructure]

:Customer

:Vendor

:Shipping

:Invoicing

:Scheduling

1:order A2,B3,C2/2:orderReply

1/A1:shipReq

A2:shipInfo

1/B1:productInfo

A1/B2:shipType

B3:invoice

1/C1:productShcedule

A2/C2:shipShcedule

[T. Bultan and X. Fu, Specification of

Realizable Service Conversations Using

Collaboration Diagrams, 2008]

c©2009 T. Miyamoto, Osaka University 33/39

Page 34: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Appendix

Purchase Order Process [WS-BPEL 2.0]

:Customer

:Vendor

:Shipping

:Invoicing

:Scheduling

1:order A2,B3,C2/2:orderReply

1/A1:shipReq

A2:shipInfo

1/B1:productInfo

A1/B2:shipType

B3:invoice

1/C1:productShcedule

A2/C2:shipShcedule

[T. Bultan and X. Fu, Specification of Realizable Service Conversations Using Collaboration Diagrams, 2008]

c©2009 T. Miyamoto, Osaka University 34/39

Page 35: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Appendix

Partial Order for Vendor Process

1:order

A2,B3,C2/2:orderReply

1/A1:shipReq

A2:shipInfo

1/B1:productInfo

A1/B2:shipType

B3:invoice

1/C1:productShcedule

A2/C2:shipShcedule

[T. Bultan and X. Fu, Specification of Realizable Service Conversations Using Collaboration Diagrams, 2008]

c©2009 T. Miyamoto, Osaka University 35/39

Page 36: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Appendix

Service Implementation for Vendor Process

1

A1

B1

C1

A1

B1

C1

A1

B1 A1

C1A2

C1A2B2 B1 A2 B1

C1

B1C2C1

B2A2

B2C1

A2

B3

B3C1A2 A2

C1B3 B2 C2 B1

B2C2C1B3

A2

B3C2

2

by direct projection

same by our method

not adequate for revise

c©2009 T. Miyamoto, Osaka University 36/39

Page 37: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Appendix

Use Composite States

1

A1 B1

A2

C1

B2

C2

B3

2

(source.oclIsKindOf(Pseudostate)and source.kind = #fork) implies

(target.oclIsKindOf(State)

c©2009 T. Miyamoto, Osaka University 37/39

Page 38: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Appendix

Use Composite States

1

A1 B1

A2

C1

B2

C2

B3

2

(self.kind = #fork) impliesself.outgoing->forAll (t1, t2 |t1<>t2 implies(self.stateMachine.LCA(t1.target,

t2.target).container.isOrthogonal))

c©2009 T. Miyamoto, Osaka University 38/39

Page 39: Synthesis of State Machine Diagrams from Communication ...€¦ · Synthesis of State Machine Diagrams from Communication Diagrams by Using ... Sequence chart ... Synthesis of State

UML & FM 09 @ IME, Rio de Janeiro(Dec. 8, 2009)

Appendix

State Machine Diagram and Activity Diagram

State Machine Diagram Activity Diagram

Concurrency Orthogonal Regions Petri NetsNode State Transition

(Place) (Transition)

[OMG Unified Modeling Language, Superstructure]

c©2009 T. Miyamoto, Osaka University 39/39