You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by He...@rsbick.rohde-schwarz.com on 2006/03/17 14:56:22 UTC

Declaration of a data model




Hi,

is it possible to declare a data model like defined in W3C Working Draft? I
tried it but I got a warning for undefined variable (UNDEFINED_VARIABLE (X
= null):).

<?xml version="1.0" encoding="us-ascii"?>
<scxml version="1.0" xmlns="http://www.w3.org/2005/07/scxml">
  <datamodel>
    <data name="X" expr="2"/>
  </datamodel>

  <state id="S1">
    <onentry>
      <assign name="X" expr="X--"/>
    </onentry>
    <transition event="Event1" target="S2"/>
   </state>

  <state id="S2">
    <transition event="Event2" cond= "X>0" target="S1"/>
    <transition event="Event2" cond ="X><0" target="S3"/>
    <onexit>
      <assign name="X" expr="X--"/>
    </onexit>
  </state>

  <state id="S3">
    <onentry>
      <assign name="X" expr="X++"/>
    </onentry>
    <onexit>
      <assign name="Y" expr="0"/>
    </onexit>
  </state>

</scxml>

Regards,

Heiko


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [SCXML] Declaration of a data model

Posted by Rahul Akolkar <ra...@gmail.com>.
Heiko,

Please prefix email subjects since this mailing list is shared by all
of Commons. I've added the [scxml] prefix to the subject for this
thread. Onto your question ...


On 3/17/06, Heiko.Eichberger@rsbick.rohde-schwarz.com
<He...@rsbick.rohde-schwarz.com> wrote:
>
> Hi,
>
> is it possible to declare a data model like defined in W3C Working Draft? I
> tried it but I got a warning for undefined variable (UNDEFINED_VARIABLE (X
> = null):).
>
<snip/>

Not yet. Though incidentally, I just started working on the
<datamodel> section [1] which was added as part of the latest SCXML WD
(24 Jan '06). Given your nudge, I'll try to push some of it out into
the nightlies early next week.


> <?xml version="1.0" encoding="us-ascii"?>
> <scxml version="1.0" xmlns="http://www.w3.org/2005/07/scxml">
>  <datamodel>
>    <data name="X" expr="2"/>
>  </datamodel>
>
<snap/>

The usage above, though quite correct, is really the degenerate case
where your XML data tree has collapsed into a single leaf node. For
such usages, you can simply use the <var> element (which is used to
create similar "scratch space" variables) inside the pertinent
<onentry> to define the variable with an appropriate initial value and
do away with the UNDEFINED_VARIABLE callback on the ErrorReporter (as
well as the <datamodel> -- again, for such degenerate usages).

The data element is really meant to hold XML data trees such as:

 <data name="ticket">
   <origin/>
   <destination/>
   <!-- default values for trip and class -->
   <trip>round</trip>
   <class>economy</class>
   <meal/>
   <!-- and so on -->
 </data>

A <datamodel> can contain more than one of these. Moreover, the
datamodel can be distributed across the SCXML document, and scoping
rules apply to these <data> once they start appearing as children of
<datamodel>s within <state>s.

Furthermore, these XML data trees can now be transported via the
EventDispatcher (<send>) or the Invoker (<invoke> from the latest
SCXML WD, soon to come to Commons SCXML) to any related, even external
process.

Finally, one may think of distributed datamodels as task completion
goals, possibly bubbling up and co-operating to fulfill some supertask
defined at document root.

These are powerful constructs, IMO. We only have the beginnings of
SCXML usecases available [2].

-Rahul

[1] http://www.w3.org/TR/scxml/#data
[2] http://jakarta.apache.org/commons/sandbox/scxml/usecases.html


>
> </scxml>
>
> Regards,
>
> Heiko
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org