W3C home > Mailing lists > Public > www-voice@w3.org > July to September 2013

Prolog Datamodel for SCXML

From: Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de>
Date: Tue, 9 Jul 2013 14:50:11 +0000
To: "www-voice@w3.org (www-voice@w3.org)" <www-voice@w3.org>
CC: Torbjörn Lager <torbjorn.lager@ling.gu.se>
Message-ID: <D95F588A-4BF4-4F0C-9600-154354EA22B7@tk.informatik.tu-darmstadt.de>
Hi there,

as we have hinted at earlier, we implemented a Prolog datamodel for SCXML. We have already been accepted to publish at this year's SIGDial [1][2] and would like the SCXML community to have a look at it. Ultimately, we can envision to standardize this as an optional SCXML datamodel, given enough interest.

There are a few areas, where the concepts of SCXML do not map naturally to the language features of Prolog and different approaches to do so nevertheless. If there is indeed some interest to get this standardized, I would start by outlining the boldest design decisions and we would welcome a discussion/critique of the approach we described in [2]. 

We attached a simple SCXML document with our Prolog datamodel from the SIGDial paper that will run to completion to give a better idea of the approach.

Best regards
Stefan Radomski

[1] http://www.sigdial.org/workshops/conference14/
[2] http://atlas.tk.informatik.tu-darmstadt.de/Publications/2013/TUD-CS-2013-0190.pdf

-----

<scxml datamodel="prolog">
  <datamodel>
    <!-- data is evaluated in non-query mode as verbatim prolog -->
    <data id="">
      mother(martha, jim).
      mother(martha, john).
    </data>
    <!-- id attribute is taken as name of predicate with dot seperated facts -->
    <data id="father">
      bob, jim.
      bob, john.
    </data>
    <!-- JSON data is parsed by SWI JSON parser -->
    <data id="household">
      {
        name: "The Bobsons",
        members: ['bob', 'martha', 'jim', 'john']
      }
    </data>
    <!-- XML data is parsed by SWI SRGS parser -->
    <data id="childs">
      <child name="jim" father="bob" />
      <child name="john" father="bob" />
    </data>
  </datamodel>
  <state id="s1">
    <onentry>
      <!-- assign is always evaluated in query mode -->
      <assign location="">
        retract(father(bob, jim)).
        assert(father(steve, jim)).
        assert(father(bob, jack)).
      </assign>
      <log label="index" expr="listing." />
      <!-- foreach will iterate solutions of a query -->
      <foreach array="father(bob, X)" item="child" index="index">
        <!-- Single free variable bound to an atomic term can be evaluated as a string -->
        <log label="index" expr="index(X)" />
        <log label="child" expr="child(X)" />
      </foreach>
    </onentry>
    <!-- any query can be used at "if" and "cond"; true if there is at least one solution -->
    <transition target="s2" cond="mother(martha, X), father(bob, X)"/>
  </state>
  <state id="s2">
    <onentry>
      <!-- system variables are facts; send ourself an event -->
      <send type="basichttp" targetexpr="ioprocessors(basichttp(location(X)))" event="foo">
        <content>
          <p>Snippet of XML</p>
        </content>
      </send>
    </onentry>
    <!-- current event is a fact -->
    <transition target="end" event="foo" cond="member(element('p',_,_), X), event(data(X))" />
  </state>
  <state id="end" final="true" />
</scxml>
Received on Tuesday, 9 July 2013 14:50:39 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:04:01 UTC