scxml overview
play

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?


  1. SCXML Overview Jim Barnett Genesys

  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

  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

  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.

  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

  6. <scxml initial=“shopping”> <state id=“shopping”> <transition event=“tocheckout” target=“checkout”/> </state> <state id=“checkout”> <transition event=“toshopping” target=“shopping”/> </scxml> 7/20/13

  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

  8. <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> 7/20/13

  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

  10. <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> 7/20/13

  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

  12. <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> 7/20/13

  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 oDock 7/20/13

  14. <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 oDock”…/> </state> 7/20/13

  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

  16. <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> 7/20/13

  17. Summary • Multimodal logic can be complex • SCXML can represent complex logic – Declaratively – Precisely – Concisely 7/20/13

  18. More Information • SCXML Last Call Draft – http://www.w3.org/TR/scxml/ • Open Source Implementations – www.pyscxml.spyderbrain.com/ – github.com/T ouffy/JSSCxml

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend