Thursday, April 28, 2011

XML for UML State diagrams

W3C again...

"..Harel State Tables are a state machine notation that was developed by the mathematician David Harel [Harel and Politi] and is included in UML [UML 2.3]. They offer a clean and well-thought out semantics for sophisticated constructs such as a parallel states. They have been defined as a graphical specification language, however, and hence do not have an XML representation. The goal of this document is to combine Harel semantics with an XML syntax that is a logical extension of CCXML's state and event notation.."
State Chart XML (SCXML): State Machine Notation for Control Abstraction

I like the microwave example:
<scxml datamodel="ecmascript" initial="off" version="1.0" xmlns="">

    <data expr="5" id="cook_time">
    <data expr="true" id="door_closed">
    <data expr="0" id="timer">

  <state id="off">
    <transition event="turn.on" target="on">

  <state id="on">
        <transition target="idle">

    <transition event="" target="off">
    <transition cond="timer >= cook_time" target="off">

    <state id="idle">
      <transition cond="door_closed" target="cooking">
      <transition event="door.close" target="cooking">
        <assign expr="true" location="door_closed">

    <state id="cooking">
      <transition event="" target="idle">
        <assign expr="false" location="door_closed">

      <transition event="time">
        <assign expr="timer + 1" location="timer">



No comments: