SCXML Overview Jim Barnett Genesys Multimodal Applications Are: - - PowerPoint PPT Presentation

scxml overview
SMART_READER_LITE
LIVE PREVIEW

SCXML Overview Jim Barnett Genesys Multimodal Applications Are: - - PowerPoint PPT Presentation

SCXML Overview Jim Barnett Genesys Multimodal Applications Are: Unpredictable Dont know what user will do next Procedural languages a bad choice Event processing is the paradigm Stateful What does cancel mean?


slide-1
SLIDE 1

SCXML Overview

Jim Barnett

Genesys

slide-2
SLIDE 2

Multimodal Applications Are:

  • Unpredictable

– Don’t know what user will do next

  • Procedural languages a bad choice
  • Event processing is the paradigm
  • Stateful

– What does “cancel” mean?

7/20/13

slide-3
SLIDE 3

Multimodal Applications (2)

  • Sub-Stateful

– Check-out : approve cart, select

address, payment type, and shipping

  • Cross-Stateful

– “I want this” <click>

  • This is Not a Simple Event Loop
  • JavaScript + HTML will get ugly in a hurry

7/20/13

slide-4
SLIDE 4

State Chart XML

A State Machine Language

Based on work of David Harel (Harel State Charts) Related to UML state machine diagrams

Good For Reactive Systems

Event driven Statefull Event order not predictable.

slide-5
SLIDE 5

Basic State Machine Concepts

  • States, events, transitions

– Example: A Shopping Cart

  • States: shopping, checkout
  • Event: toCheckout, toShopping
  • If you’re in the shopping state and get the

toCheckout event, go to the checkout state

  • If you’re in the checkout state and get the

toShopping event, go to the shopping state

7/20/13

slide-6
SLIDE 6

7/20/13

<scxml initial=“shopping”> <state id=“shopping”> <transition event=“tocheckout” target=“checkout”/> </state> <state id=“checkout”> <transition event=“toshopping” target=“shopping”/> </scxml>

slide-7
SLIDE 7

Harel Extensions. 1

  • Data model

– Example: shopping cart

  • When you get the addItem event
  • Update the cartValue variable with the

value of the item that is added

– Data model is pluggable

  • Specification defines JScript and XPath

models

7/20/13

slide-8
SLIDE 8

7/20/13

<scxml initial=“shopping”> <datamodel> <data id=“cartValue” expr=“0”/> </datamodel> <state id=“shopping”> <transition event=“tocheckout” target=“checkout”/> <transition event=“addItem”> <assign location=“cartValue” expr=“cartValue + _event.itemValue”/> </transition> </state> <state id=“checkout”> <transition event=“toshopping” target=“shopping”/> </state> </scxml>

slide-9
SLIDE 9

Harel Extensions. 2

  • Conditions on transitions

– Example: in the shopping state

  • When you get the toCheckout event
  • If cartValue > $100 go to goldCheckout
  • Otherwise go to regularCheckout

7/20/13

slide-10
SLIDE 10

7/20/13

<scxml initial=“shopping”> <datamodel> <data id=“cartValue” expr=“0”/> </datamodel> <state id=“shopping”> <transition event=“tocheckout” cond=“cartValue > 100” “target=“goldCheckout”/> <transition event=“tocheckout” target=“regularCheckout”/> <transition event=“addItem”> <assign location=“cartValue” expr=“cartValue + _event.itemValue”/> </transition> </state> <state id=“goldCheckout”> <transition event=“toshopping” target=“shopping”/> </state> <state id=“regularCheckout”> <transition event=“toshopping” target=“shopping”/> </state> </scxml>

slide-11
SLIDE 11

Harel Extensions. 3

  • Executable content

– Example: no shipping charges for

goldCheckout

– Example: send data to reporting server

when checkout is done

  • Some Executable content is built in
  • Platforms may add their own

7/20/13

slide-12
SLIDE 12

7/20/13

<state id=“goldCheckout”> <onentry> <assign location=“shippingFee” expr=“0”/> </onentry> <transition event=“toshopping” target=“shopping”/> <transition event=“checkoutDone” target=“Finished”> <send target=“reportingServer” namelist=“shoppingCart;…”/> </transition> <onexit> <ext:freeCheckoutResources/> </onexit> </state>

slide-13
SLIDE 13

Compound (Nested) States

  • Example: shipping an order

– Consists of: checking inventory, pulling the

items, updating the inventory, packaging the items and sending them to the shipping dock

– At any point the order can be cancelled – Parent State: inShipping

  • Can be target of a transition
  • Can contain transitions
  • Substates: checkInventory, pullItems,

updateInventory, packageItems, sendT

  • Dock

7/20/13

slide-14
SLIDE 14

7/20/13

<state id=“inShipping”> <transition event=“cancelOrder” target=“rollBackOrder”/> <state id=“checkInventory> <transition event=“inventoryCheckDone” cond=“_event.checkResult=“success” target=“pullItems”/> <transition event=“inventoryCheckDone” target=“waitForInventory”/> </state> <state id=“waitForInventory”> <transition event=“inventoryArrived” target=“checkInventory”/> </state> <state id=“pullItems” …../> <state id=“updateInventory”…./> <state id=“packageItems”…./> <state id=“sendT

  • Dock”…/>

</state>

slide-15
SLIDE 15

Parallel States

  • Example: multimodal interface

– Audio states: user is speaking user is listening,… – Visual states: user is browsing, user is entering text,… – Can be in any audio state and any visual state

  • Audio and visual modalities may operate separately
  • BUT:

– A) They share a data model – B) They see each other’s events – C) They can see each other’s state

7/20/13

slide-16
SLIDE 16

7/20/13

<parallel id=“shoppingAndInterfaces”> <state id=“shopping” ……/> <state id=“audioInterface”> <state id=“userSpeaking” …/> <state id=“userListening”…/> </state> <state id=“graphicalInterface”> <state id=“userBrowsing” …/> <state id=“userEnteringT ext”> <transition event=“utterance”…./> </state> </state> </parallel>

slide-17
SLIDE 17

Summary

  • Multimodal logic can be complex
  • SCXML can represent complex logic

– Declaratively – Precisely – Concisely

7/20/13

slide-18
SLIDE 18

More Information

  • SCXML Last Call Draft

– http://www.w3.org/TR/scxml/

  • Open Source Implementations

– www.pyscxml.spyderbrain.com/ – github.com/T

  • uffy/JSSCxml