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

RE: Prolog Datamodel for SCXML

From: Jim Barnett <Jim.Barnett@genesyslab.com>
Date: Wed, 10 Jul 2013 14:10:40 +0000
To: Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de>, "www-voice@w3.org (www-voice@w3.org)" <www-voice@w3.org>
CC: Torbjörn Lager <torbjorn.lager@ling.gu.se>
Message-ID: <57A15FAF9E58F841B2B1651FFE16D281058B21@GENSJZMBX01.msg.int.genesyslab.com>
It would be interesting to see how the logic of a natural language processing application would be divided up between SCXML and  prolog.  Off the top of my head, I would think that scxml would be good for the underlying task model, while prolog would be better for interpreting utterances.  However the interpretation of an utterance may depend on where you are in the task model.  As long as prolog has the In() predicate, the logic can be sensitive to the state configuration, but I wonder if you would find that you wanted certain rules to be scoped to certain states.  

In early drafts of the spec, we had an <anchor> tag that was suggested by people who were working on natural language apps.  It was intended to make it easy to implement "cancel" or "go back".  It was a bit like a <history> tag, except that it rolled back the datamodel as well.  I wonder if that is still useful if you have prolog.

Anyhow, it will be very interesting to see how scxml + prolog works in practice.  We can certainly standardize the data model if there is interest.  It could be done in a separate document, and wouldn't require re-publishing the scxml spec.  

- Jim

-----Original Message-----
From: Stefan Radomski [mailto:radomski@tk.informatik.tu-darmstadt.de] 
Sent: Tuesday, July 09, 2013 10:50 AM
To: www-voice@w3.org (www-voice@w3.org)
Cc: Torbjörn Lager
Subject: Prolog Datamodel for SCXML

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 Wednesday, 10 July 2013 14:11:12 UTC

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