On Thu, May 6, 2010 at 2:36 PM, Fabrizio Morbini <fmorb...@gmail.com> wrote: > Hi Martin, following Rahul advice and explanation the initial problem > is now solved. However i would like to follow-up on your reply. > According to the SCXML standard (i.e. > http://www.w3.org/TR/scxml/#datamodel) > in particular: > > "Logically, there is a single globally visible data model for the > entire state machine. As an authoring convenience, however, we allow > <datamodel> as a child of any <state>, thus allowing parts of the data > model to be distributed throughout the document closer to the > locations where the data will be accessed. However, all instances of > the <data> element are created and initialized when the state machine > is instantiated and may be accessed from any state at any time." > > do you mean that the implementation of datamodel in Apache Commons > SCXML is different from the working draft? <snip/>
The Commons SCXML implementation is actually more extensible in that it can support various kinds of datamodel and/or scoping behavior. The default behavior in v0.9 if you pick up one of the provided evaluator implementations is different from the single logical datamodel (it provides a cascading datamodel, much like the block scopes in procedural languages such as Java). I mentioned in a previous note how to provide an evaluator that produces a single / global data model. > or that the use of src (and > in the future xinclude?) invalidates the above statement (i.e. one > single logical datamodel)?. > <snap/> Use of the src attribute of <state> or XInclude is orthogonal to how datamodel scopes are structured. -Rahul > thanks, > fabrizio. > > On Thu, May 6, 2010 at 11:18, Martin Gainty <mgai...@hotmail.com> wrote: >> >> Fabrizio- >> >> from what ive read in the scxml doc you need to configure the datamodel and >> their respective data node children directly under the scm root node e.g. >> <scxml xmlns="http://www.w3.org/2005/07/scxml" >> version="1.0" >> initialstate="init-travel-plan"> >> >> <datamodel> >> <data name="airlineticket"> >> //you can use the Data macro to reference the current value of the requested >> parameters e.g. >> //Commons SCXML defines a Data() >> function for use in JEXL or EL expressions, for example: >> <var name="arrival" expr="Data(hotelbooking, 'hotel/stay/arrival')" /> >> >> // The above expression extracts the arrival date from the hotelbooking >> // data in the documents datamodel and stores it in a scratch space >> variable >> // named "arrival". The first argument is value of the name attribute of >> the >> // <data> element and the second is the String value of the XPath >> // expression. If more than one matching nodes are found, the first one >> // is returned. //this is different from your current implementation >> which uses data elements associated with a state e.g. >> <scxml xmlns="http://www.w3.org/2005/07/scxml" >> version="1.0" >> initialstate="airline-ticket"> >> >> <state id="airline-ticket"> >> <datamodel> >> <data...> >> the association of this data would be to airline-ticket and could not be >> used in hotel or restaurant >> a complete scxml tutorial is available at >> http://commons.apache.org/scxml/guide/datamodel.html >> >> HTH >> Martin Gainty >> ______________________________________________ >> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité >> >> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene >> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte >> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht >> dient lediglich dem Austausch von Informationen und entfaltet keine >> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von >> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. >> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le >> destinataire prévu, nous te demandons avec bonté que pour satisfaire >> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie >> de ceci est interdite. Ce message sert à l'information seulement et n'aura >> pas n'importe quel effet légalement obligatoire. Étant donné que les email >> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter >> aucune responsabilité pour le contenu fourni. >> >> --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org