summaryrefslogtreecommitdiffstats
path: root/test/samples/uscxml/test-prolog.scxml
blob: def23dbde84156227270145a442eb0182abbadef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<scxml datamodel="prolog">
  <datamodel>
		<data src="" />
    <data id="father">
      bob, jim.
      bob, john.
    </data>
    <data id="">
      mother(martha, jim).
      mother(martha, john).
    </data>
    <data id="household">
      {
        name: "The Bobsons",
        members: ['bob', 'martha', 'jim', 'john']
      }
    </data>
    <data id="childs">
      <child name="jim" father="bob" />
      <child name="john" father="bob" />
    </data>
  </datamodel>
  <state id="s1">
    <onentry>
      <assign location="">
        retract(father(bob, jim)).
        assert(father(steve, jim)).
        assert(father(bob, jack)).
      </assign>
      <log label="index" expr="listing." />
      <foreach array="father(bob, X)"
               item="child"
               index="index">
        <log label="index" expr="index(X)" />
        <log label="child" expr="child(X)" />
      </foreach>
    </onentry>
    <transition target="s2"
                cond="mother(martha, X), father(bob, X), in(s1)"/>
  </state>
  <state id="s2">
    <onentry>
      <send type="basichttp"
            targetexpr="ioprocessors(basichttp(location(X)))"
            event="foo">
        <content>
          <p>Snippet of XML</p>
        </content>
      </send>
    </onentry>
    <transition 
      target="end"
      event="foo"
      cond="member(element('p',_,_), X), event(data(X))" />
  </state>

  <state id="end" final="true" />
</scxml>