SCXML Overview
Jim Barnett
Genesys
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?
Genesys
– Don’t know what user will do next
– What does “cancel” mean?
7/20/13
– Check-out : approve cart, select
– “I want this” <click>
7/20/13
– Example: A Shopping Cart
7/20/13
7/20/13
<scxml initial=“shopping”> <state id=“shopping”> <transition event=“tocheckout” target=“checkout”/> </state> <state id=“checkout”> <transition event=“toshopping” target=“shopping”/> </scxml>
– Example: shopping cart
– Data model is pluggable
7/20/13
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>
– Example: in the shopping state
7/20/13
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>
– Example: no shipping charges for
– Example: send data to reporting server
7/20/13
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>
– Consists of: checking inventory, pulling the
– At any point the order can be cancelled – Parent State: inShipping
updateInventory, packageItems, sendT
7/20/13
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
</state>
– 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
– A) They share a data model – B) They see each other’s events – C) They can see each other’s state
7/20/13
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>
– Declaratively – Precisely – Concisely
7/20/13
– http://www.w3.org/TR/scxml/
– www.pyscxml.spyderbrain.com/ – github.com/T