Contract-based Discovery and Adaptation of Web Services Luca - - PowerPoint PPT Presentation

contract based discovery and adaptation of web services
SMART_READER_LITE
LIVE PREVIEW

Contract-based Discovery and Adaptation of Web Services Luca - - PowerPoint PPT Presentation

Contract-based Discovery and Adaptation of Web Services Luca Padovani Jointly with Samuele Carpineti, Giuseppe Castagna, Nils Gesbert, Cosimo Laneve 9th International School on Formal Methods for the Design of Computer, Communication and


slide-1
SLIDE 1

Contract-based Discovery and Adaptation

  • f Web Services

Luca Padovani Jointly with Samuele Carpineti, Giuseppe Castagna, Nils Gesbert, Cosimo Laneve 9th International School on Formal Methods for the Design of Computer, Communication and Software Systems: Web Services

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 1 / 65

slide-2
SLIDE 2

Contracts for Web services

We’ve got. . .

  • behavioral descriptions of Web services (wsdl, wscl, ws-bpel, put

your favorite technology here)

  • repositories of Web services descriptions (uddi)

We’d like to. . .

  • look for Web services with a given behavior
  • see if it’s safe to replace a service with another one
  • if not, see whether we can adapt one service to safely replace

another We’re gonna use. . .

  • contracts = abstractions of Web services’ behavior

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 2 / 65

slide-3
SLIDE 3

Finding Web services by contract

Compliance = client’s satisfaction ρ ⊣ σ Running a query with compliance Q(ρ) = {σ | ρ ⊣ σ} Running a query with duality ρ⊥ and subcontract σ τ Q(ρ) = {σ | ρ⊥ σ}

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 3 / 65

slide-4
SLIDE 4

The quest for

Desired properties of

  • reduction of nondeterminism (a ⊕ b a)
  • extension of functionalities (a a + b)
  • some permutation of messages (a.c c.a)

The problem

  • reduction alone is too strict
  • extension is unsafe
  • extension;reduction is not transitive
  • permutation is not allowed

The solution

  • use (simple) orchestrators

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 4 / 65

slide-5
SLIDE 5

Summary

1 contracts 2 simple orchestrators 3 simple orchestrators with buffers 4 duality 5 recursive behaviors 6 orchestrator synthesis 7 related and ongoing work

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 5 / 65

slide-6
SLIDE 6

Oh no! More ws-bpel!

<process> <sequence> <receive operation="Order" variable="Request"/> <flow> <invoke operation="Deposit" inputVariable="Request" outputVariable="Deposit"/> <invoke operation="Charge" inputVariable="Request" outputVariable="Charge"/> </flow> <switch> <case condition="getVariableData(Deposit) == true && getVariableData(Charge) == true)"> <invoke operation="Ship" inputVariable="Request"/> <reply operation="Order" value="OK"/> </case> <case condition="getVariableData(Charge) == true)"> <invoke operation="Refund" inputVariable="Request"/> <reply operation="Order" value="NO"/> </case> <otherwise> <reply operation="Order" value="NO"/> </otherwise> </switch> </sequence> </process> Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 6 / 65

slide-7
SLIDE 7

What’s in a contract

Actions O Order D Deposit C Charge S Ship R Refund Traces {ODCSO, OCDSO, ODCRO, OCDRO, ODCO, OCDO} Branching points

  • OD . . . and OC . . . is an external choice
  • . . . SO, . . . RO, and . . . O is an internal choice

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 7 / 65

slide-8
SLIDE 8

Basic theory of contracts

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 8 / 65

slide-9
SLIDE 9

Contracts

Syntax σ

::=

contract (null) | α.σ (action prefix) | σ + σ (external choice) | σ ⊕ σ (internal choice) α

::=

action a (input) | a (output) Example O.(D.C.D.C.(S.O ⊕ R.O ⊕ O) + C.D.D.C.(S.O ⊕ R.O ⊕ O))

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 9 / 65

slide-10
SLIDE 10

Operational semantics

α.σ

α

→ σ σ ⊕ τ → σ σ

α

→ σ ′ σ + τ

α

→ σ ′ σ → σ ′ σ + τ → σ ′ + τ

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 10 / 65

slide-11
SLIDE 11

Compliance, formally

Systems ρ σ System transitions ρ → ρ′ ρ σ → ρ′ σ σ → σ ′ ρ σ → ρ σ ′ ρ

α

→ ρ′ σ

α

→ σ ′ ρ σ → ρ′ σ ′ Compliance ρ ⊣ σ

def

⇐ ⇒ ρ σ ⇒ ρ′ σ ′ → implies ρ′

e

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 11 / 65

slide-12
SLIDE 12

Compliance, examples

a.e ⊣ ? a

  • a.e ⊕ b.e

⊣ ? a + b

  • e

⊣ ? σ

  • a.e ⊕ b.e

⊣ ? a ⊕ b

  • a.e

⊣ ? a ⊕ 0

  • ⊣ ?

σ

  • Contract-based Discovery and Adaptation of Web Services (Luca Padovani)

SFM’09 12 / 65

slide-13
SLIDE 13

Subcontract, formally

Set-theoretic interpretation of contracts

σs def

= {ρ | ρ ⊣ σ} Subcontract σ ⊑ τ

def

⇐ ⇒ σs ⊆ τs ≃ = ⊑ ∩ ⊒

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 13 / 65

slide-14
SLIDE 14

Subcontract, (counter)examples

a.e a + b ⊑ a ⊕ b a.e a ⊑ e + a ⊑ a Reduction of nondeterminism σ ⊕ τ ⊑ σ

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 14 / 65

slide-15
SLIDE 15

Properties of strong subcontract

Internal choice = intersection

σ ⊕ τs = σs ∩ τs

External choice = union

  • there are clients in a + bs that are not in as ∪ bs:

a.e ⊕ b.e ∈ a + bs a.e ⊕ b.e ∈ as a.e ⊕ b.e ∈ bs

  • sometimes + is ⊕ in disguise:

α.σ + α.τ ≃ α.(σ ⊕ τ)

  • interferences:

a.e + b ∈ as a.e + b ∈ a + bs

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 15 / 65

slide-16
SLIDE 16

Properties of strong subcontract

Proposition

⊑ is a precongruence σ ⊑ τ ⇒        α.σ ⊑ α.τ σ ⊕ σ ′ ⊑ τ ⊕ σ ′ σ + σ ′ ⊑ τ + σ ′ + nice axiomatization + can be used for safe replacement of parts of services

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 16 / 65

slide-17
SLIDE 17

Strong subcontract: axioms

(e1) σ + σ = σ (e2) σ + τ = τ + σ (e3) σ + (σ ′ + σ ′′) = (σ + σ ′) + σ ′′ (e4) σ + 0 = σ (i1) σ ⊕ σ = σ (i2) σ ⊕ τ = τ ⊕ σ (i3) σ ⊕ (σ ′ ⊕ σ ′′) = (σ ⊕ σ ′) ⊕ σ ′′ (d1) σ + (σ ′ ⊕ σ ′′) = (σ + σ ′) ⊕ (σ + σ ′′) (d2) σ ⊕ (σ ′ + σ ′′) = (σ ⊕ σ ′) + (σ ⊕ σ ′′) (d3) α.σ + α.τ = α.(σ ⊕ τ) (d4) α.σ ⊕ α.τ = α.(σ ⊕ τ) (red) σ ⊕ τ ≤ σ

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 17 / 65

slide-18
SLIDE 18

Orchestrators

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 18 / 65

slide-19
SLIDE 19

Limitations of ⊑

⊑ does not support extensions. . . a ⊑ a + b . . . because extra actions may cause interferences a.e + b ⊣ a a.e + b ⊣ a + b

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 19 / 65

slide-20
SLIDE 20

Why not all failures are equal

Failure due to client nondeterminism a.e ⊕ b.e a → b.e a Failure due to service nondeterminism a.e a ⊕ b → a.e a Failure due to “system” nondeterminism a.e + b.c.e a + b.d → c.e d a.e + b.c.e a + b.d → e 0

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 20 / 65

slide-21
SLIDE 21

Idea: orchestrated interaction

client ⇆

  • rchestrator

⇆ service a → a, a → a a ← a, a ← a α α α α, α

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 21 / 65

slide-22
SLIDE 22

Synchronous orchestrators

f

::=

  • rchestrator

(null) | µ.f (action prefix) | f ∨ f (disjunction) µ

::=

  • rchestration action

a, a (input/output) | a, a (output/input)

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 22 / 65

slide-23
SLIDE 23

Orchestrator semantics

Orchestrator transitions µ.f

µ

→ f f

µ

→ f ′ f ∨ g

µ

→ f ′ Trace semantics for orchestrators

f

def

= {µ1 · · · µn | ∃g : f

µ1

→ · · ·

µn

→ g}

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 23 / 65

slide-24
SLIDE 24

Orchestrated compliance, formally

Orchestrated systems ρ f σ Orchestrated system transitions ρ → ρ′ ρ f σ → ρ′ f σ σ → σ ′ ρ f σ → ρ f σ ′ ρ

α

→ ρ′ f

α,α

→ f ′ σ

α

→ σ ′ ρ f σ → ρ′ f ′ σ ′ Weak compliance f : ρ ⊣ σ

def

⇐ ⇒ ρ f σ ⇒ ρ′ f ′ σ ′ → implies ρ′

e

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 24 / 65

slide-25
SLIDE 25

Weak compliance, examples

a, a

:

a.e ⊣ ? a + b

  • a, a ∨ b, b

:

a.e ⊣ ? a + b

  • a, a ∨ b, b

:

a.e ⊕ b.e ⊣ ? a + b

  • :

e + a ⊣ ? a

  • f

:

a.e ⊕ b.e ⊣ ? a ⊕ b

  • Contract-based Discovery and Adaptation of Web Services (Luca Padovani)

SFM’09 25 / 65

slide-26
SLIDE 26

Weak subcontract, formally

Set-theoretic interpretation of contracts

σw def

= {ρ | ∃f : f : ρ ⊣ σ} Weak subcontract σ τ

def

⇐ ⇒ σs ⊆ τw A few doubts. . .

  • is the subcontract relation we’re looking for?
  • is a preorder?

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 26 / 65

slide-27
SLIDE 27

Universal orchestrators

σ τ ⇐ ⇒ for every ρ, ρ ⊣ σ implies f : ρ ⊣ τ for some f Universal orchestrator f : σ τ

def

⇐ ⇒ for every ρ, ρ ⊣ σ implies f : ρ ⊣ τ f is the universal orchestrator for σ τ

Proposition (existence of universal orchestrator)

σ τ if and only if f : σ τ for some orchestrator f

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 27 / 65

slide-28
SLIDE 28

Orchestrators as morphisms

Orchestrator application f (σ) f σ f (σ) a, a ∨ b, b a + b a + b a, a ∨ b, b a ⊕ b a ⊕ b a, a a + b a a, a a ⊕ b a ⊕ 0 σ

Theorem

f : ρ ⊣ σ if and only if ρ ⊣ f (σ)

Corollary

f : σ τ if and only if σ ⊑ f (τ)

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 28 / 65

slide-29
SLIDE 29

Weak subcontract, examples

Reduction of nondeterminism ( embeds ⊑) a, a ∨ b, b : a ⊕ b a

  • a ⊕ b ⊑ (a, a ∨ b, b)(a) = a

Width extension a, a : a a + b

  • a ⊑ a, a(a + b) = a

Depth extension 0 : 0 σ

  • 0 ⊑ 0(σ) = 0

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 29 / 65

slide-30
SLIDE 30

On transitivity of

Is transitive? f : σ σ ′ g : σ ′ τ

?

⇒ h : σ τ a, a ∨ b, b.c, c

:

a ⊕ b.c

  • a

a, a

:

a

  • a + b.d

??? :

a ⊕ b.c

  • a + b.d

Proposition (Orchestrator application is monotone)

σ ⊑ τ implies f (σ) ⊑ f (τ) σ ⊑ f (σ ′) σ ′ ⊑ g(τ) ⇒ σ ⊑ f (g(τ)) is transitive if f ◦ g is an orchestrator

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 30 / 65

slide-31
SLIDE 31

Orchestrator composition and transitivity of

Orchestrator composition f ∧ g

  • f ∧ g permits the traces permitted by f and by g
  • f ∧ g forbids the traces forbidden by either f or by g

f ∧ g

def

= f ∩ g

Proposition

f (g(σ)) ≃ (f ∧ g)(σ)

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 31 / 65

slide-32
SLIDE 32

Towards a deduction system for

Problem: is not a precongruence w.r.t. +

  • a

a.b

  • a.b

a.b +

  • a.b

+ a ≃ a.(b ⊕ 0)

Proposition (distributivity of orchestration application)

1 f (σ) + f (τ) ≃ f (σ + τ) 2 f (σ) ⊕ f (τ) ≃ f (σ ⊕ τ)

Corollary

f : σ1 τ1 and f : σ2 τ2 implies f : σ1 + σ2 τ1 + τ2

  • precongruence is granted if the orchestrator is oblivious of the

particular branch taken

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 32 / 65

slide-33
SLIDE 33

Deduction system for

(red) I(σ) : σ ⊕ τ ≤ σ (width)

I(σ) ∧ I(τ) = {ε}

I(σ) : σ ≤ σ + τ (trans) f : σ ≤ σ ′ g : σ ′ ≤ σ ′′ f ∧ g : σ ≤ σ ′′ (prefix) f : σ ≤ τ α, α.f : α.σ ≤ α.τ (int) f : σ ≤ σ ′ f : τ ≤ τ′ f : σ ⊕ τ ≤ σ ′ ⊕ τ′ (ext) f : σ ≤ σ ′ f : τ ≤ τ′ f : σ + τ ≤ σ ′ + τ′ The deduction system is sound and complete f : σ τ ⇐ ⇒ f : σ ≤ τ

  • completeness regards orchestrators too

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 33 / 65

slide-34
SLIDE 34

Interpretations of orchestrators

As mediators ρ f σ As morphisms/behavioral coercions f : σ τ ⇐ ⇒ σ ⊑ f (τ) f : τ → σ As assumptions on the environment a, a : a a + b

  • it is safe to replace a with a + b if nobody ever tries to perform b

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 34 / 65

slide-35
SLIDE 35

Buffered orchestrators

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 35 / 65

slide-36
SLIDE 36

Buffered orchestrators

client ⇆

  • rchestrator

⇆ service a → a, ε σ . . . ρ ε, a → a ρ ε, a ← a . . . a ← a, ε σ

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 36 / 65

slide-37
SLIDE 37

Syntax of buffered orchestrators

f

::=

  • rchestrator

(null) | µ.f (action prefix) | f ∨ f (disjunction) µ

::=

  • rchestration action

a, a (input/output) | a, a (output/input) | α, ε (action/–) | ε, α (–/action)

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 37 / 65

slide-38
SLIDE 38

Valid k-orchestrators

Not every orchestrator makes sense

  • rchestrator

valid rank ε, a.a, ε

  • ≥ 1

a, ε.a, ε

  • ≥ 2

a, ε

  • ε, a
  • a, ε.a, ε
  • Valid k-orchestrators are. . .
  • directional
  • finite-state
  • fair

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 38 / 65

slide-39
SLIDE 39

Weak k-compliance, formally

Orchestrated systems ρ f σ Orchestrated system transitions · · · ρ

α

→ ρ′ f

α,ε

→ f ′ ρ f σ → ρ′ f ′ σ f

ε,α

→ f ′ σ

α

→ σ ′ ρ f σ → ρ f ′ σ ′ Weak k-compliance f : ρ ⊣k σ

def

⇐ ⇒ ρ f σ ⇒ ρ′ f ′ σ ′ → implies ρ′

e

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 39 / 65

slide-40
SLIDE 40

Weak k-compliance, an example

a, ε.b, ε.ε, b.ε, a.c, c : a.b.c.e ⊣1 b.a.c

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 40 / 65

slide-41
SLIDE 41

Weak k-subcontract, formally

Set-theoretic interpretation of contracts

σw

k def

= {ρ | ∃f : f : ρ ⊣k σ} Weak subcontract σ τ

def

⇐ ⇒ σs ⊆ τw

k

Proposition (existence of universal orchestrator)

σ k τ if and only if f : σ k τ for some k-orchestrator f

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 41 / 65

slide-42
SLIDE 42

Orchestrators as morphisms

Orchestrator application f (σ) f σ f (σ) a, ε.b, b b a.b ε, a.b, b a.b b a, ε.b, ε.ε, b.ε, a b.a a.b

Theorem

f : ρ ⊣k σ if and only if ρ ⊣ f (σ)

Corollary

f : σ k τ if and only if σ ⊑ f (τ)

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 42 / 65

slide-43
SLIDE 43

Orchestrator composition and transitivity of k

We’ve got a problem σ

def

= b + d f

def

= a, ε.c, ε.(ε, a.b, b ∨ ε, c.d, d) g

def

= a, ε.b, b ∨ c, ε.d, d f (g(σ)) ≃ f (a.b + c.d) ≃ a.c.(b ⊕ d) No single orchestrator can turn b + d into a.c.(b ⊕ d) Idea Find an orchestrator f · g such that f (g(σ)) ⊑ (f · g)(σ)

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 43 / 65

slide-44
SLIDE 44

Orchestrator composition, formally

f · g

def

=

  • f

α,ε

→ f ′

α, ε.(f ′ · g) ∨

  • g

ε,α

→ g′

ε, α.(f · g′) ∨

  • f

ϕ,α

→ f ′,g

α,ϕ′

→ g′,ϕϕ′=ε

ϕ, ϕ′.(f ′ · g′) ∨

  • f

ε,α

→ f ′,g

α,ε

→ g′

(f ′ · g′)

Theorem

f (g(σ)) ⊑ (f · g)(σ)

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 44 / 65

slide-45
SLIDE 45

Deduction system for k

No complete deduction system for k is known

(swap-inputs)

a.b.σ = b.a.σ

(swap-outputs)

a.b.σ = b.a.σ

(postpone-input)

a.b.σ ≤ b.a.σ

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 45 / 65

slide-46
SLIDE 46

Duality

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 46 / 65

slide-47
SLIDE 47

Duality

ρ⊥ the -smallest service that satisfies ρ

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 47 / 65

slide-48
SLIDE 48

Duality, examples

ρ ρ⊥ a.e a a.e ⊕ b.e a + b a.e + b.e a ⊕ b e a.b.e + a.c.e a.(b + c)

  • a.e ⊕ 0
  • a.0
  • . . .

Definition (viable contract)

ρ is viable if there exists σ such that ρ ⊣ σ

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 48 / 65

slide-49
SLIDE 49

Duality, formally

ρ⊥ def =

  • ρ⇓r,e∈r
  • α∈r,viable(ρ(α))

α.ρ(α)⊥

Theorem

Let ρ be a viable client contract. Then

1 ρ ⊣ ρ⊥ 2 ρ ⊣ σ implies ρ⊥ 0 σ

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 49 / 65

slide-50
SLIDE 50

Recursive behaviors

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 50 / 65

slide-51
SLIDE 51

Finite syntax for finite behaviors

σ

::=

contract (null) | α.σ (action prefix) | σ + σ (external choice) | σ ⊕ σ (internal choice) α

::=

action a (input) | a (output) What about recursive behavior?

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 51 / 65

slide-52
SLIDE 52

Describing recursive behavior

Many different ways. . . rec X.a.X ⊕ b.0 X = a.X ⊕ b.0 σ ∗ . . . but it’s just syntax!

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 52 / 65

slide-53
SLIDE 53

Infinite syntax for infinite behaviors

σ

::=

contract (null) | α.σ (action prefix) | σ + σ (external choice) | σ ⊕ σ (internal choice) α

::=

action a (input) | a (output)

Definition

The set of contracts is the set of possibly infinite trees generated by the grammar above such that

1 they have finitely many different subtrees 2 every infinite branch has infinitely many prefixes

Every finite contracts satisfies these conditions

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 53 / 65

slide-54
SLIDE 54

Examples

X = a.X = a.a.X = · · ·

  • X

= a.X ⊕ b.0 = a.(a.X ⊕ b.0) ⊕ b.0 = a.(a.(a.X ⊕ b.0) ⊕ b.0) ⊕ b.0 = a.(a.(a.(a.X ⊕ b.0) ⊕ b.0) ⊕ b.0) ⊕ b.0 = · · ·

  • X

= X + X

  • X

= X ⊕ X

  • X

= X

  • Contract-based Discovery and Adaptation of Web Services (Luca Padovani)

SFM’09 54 / 65

slide-55
SLIDE 55

Recursion: summary

  • all the results stated previously still hold (coinduction)
  • use your own preferred syntax (but beware of Kleene ∗)

Why does it work?

Proposition

Let D(σ)

def

= {σ ′ | σ

ϕ

⇒ σ ′}. Then D(σ) is finite for every σ

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 55 / 65

slide-56
SLIDE 56

Algorithm

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 56 / 65

slide-57
SLIDE 57

Towards an algorithm for deciding k

Problem: the orchestrator is not necessarily unique

:

a ⊕ b ⊕ 0

  • a + b

a, a

:

a ⊕ b ⊕ 0

  • a + b

b, b

:

a ⊕ b ⊕ 0

  • a + b

a, a ∨ b, b

:

a ⊕ b ⊕ 0

  • a + b

f g: g is better (more permissive) than f f g

def

⇐ ⇒ f ⊆ g Idea

  • synthesize the best orchestrator
  • the best orchestrator is unique

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 57 / 65

slide-58
SLIDE 58

Deciding k

ar = {ϕ, ϕ′ | σ

ϕ

⇒, τ

ϕ′

⇒, B ⊢k ϕ, ϕ′} a = {ϕ, ϕ′ ∈ ar | Bϕ, ϕ′ ⊢k fϕ,ϕ′ : σ(ϕ) ⊴ τ(ϕ′)} τ ⇓ s ⇒ (∃r : σ ⇓ r ∧ r ⊆ a ◦ s) ∨ (∅ • a) ∩ s = ∅ B ⊢k

  • µ∈a µ.fµ : σ ⊴ τ

Theorem

The following properties hold:

1 (termination) the algorithm always terminates 2 (correctness) f : σ ⊴k τ implies that f has rank k and f : σ k τ 3 (completeness) f : σ k τ implies g : σ ⊴k τ for some g f

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 58 / 65

slide-59
SLIDE 59

An example from Wil’s lecture (1/3)

σ

def

=

  • rder.(money + food.money)

ρ1

def

=

  • rder.food.money.e

ρ⊥

1

=

  • rder.food.money

f1 =

  • rder, order.food, food.money, money

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 59 / 65

slide-60
SLIDE 60

An example from Wil’s lecture (2/3)

σ

def

=

  • rder.(money + food.money)

ρ2

def

=

  • rder.(food.money.e + money.food.e)

ρ⊥

2

=

  • rder.(food.money ⊕ money.food)

f2 =

  • rder, order.food, food.money, money

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 60 / 65

slide-61
SLIDE 61

An example from Wil’s lecture (3/3)

σ

def

=

  • rder.(money + food.money)

ρ3

def

=

  • rder.money.food.e

ρ⊥

3

=

  • rder.money.food

f3 =

  • rder, order.money, ε.food, food.ε, money

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 61 / 65

slide-62
SLIDE 62

Conclusions

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 62 / 65

slide-63
SLIDE 63

Wrap-up

Subcontract relation

  • tool for searching and reasoning about services by their contracts

(= behavioral types)

  • combines reduction, extension, and permutation into a single

preorder

  • gives safe substitution of services modulo orchestration
  • is decidable

(Simple) orchestrators

  • have nice properties (universality, compositionality)
  • can be automatically synthesized

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 63 / 65

slide-64
SLIDE 64

Contracts vs session types

What is being typed

  • contract = type of a process
  • session type = type of a channel
  • session type = type of a process projected on a channel

Testing approach

  • session types: subtyping preserves correctness
  • contracts: compliance defines subcontracting

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 64 / 65

slide-65
SLIDE 65

Essential bibliography

Contracts with static interfaces and divergence

  • C. Laneve, L. Padovani. The must preorder revisited

(CONCUR’07) Synthesis of orchestrators

  • G. Castagna, N. Gesbert, and L. Padovani. A theory of contracts

for Web services (POPL’08)

  • G. Castagna, N. Gesbert, and L. Padovani. A theory of contracts

for Web Services. (ACM TOPLAS 2009) to appear

  • L. Padovani. Contract-directed synthesis of simple
  • rchestrators (CONCUR’08)

Describing name-passing in contracts

  • G. Castagna, L. Padovani. Contracts for Mobile Processes

(CONCUR’09)

Contract-based Discovery and Adaptation of Web Services (Luca Padovani) SFM’09 65 / 65