- From: Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de>
- Date: Mon, 1 Apr 2013 16:16:01 +0000
- To: Jim Barnett <Jim.Barnett@genesyslab.com>
- CC: "www-voice@w3.org" <www-voice@w3.org>
Hey Jim, On Apr 1, 2013, at 3:52 PM, Jim Barnett <Jim.Barnett@genesyslab.com> wrote: > The Prolog datamodel is interesting. The SCXML group discussed the idea of combining SCXML and Prolog a few years ago. We concluded that it was feasible and an interesting idea, but took it no further. It's great that someone has gone and done it. If you have any observations about the integration that you'd like to post, I would certainly be interested in seeing them. we embedded SWI Prolog. To give you an idea of what is working, the following SCXML snippet runs to completion [1]: <scxml datamodel="prolog" initial="start" binding="late"> <datamodel> <data id="facts"> % see http://www.swi-prolog.org/FAQ/Multifile.html :- multifile animal/1. cat(tom). animal(X):- cat(X). </data> </datamodel> <script> mouse(jerry). animal(X):- mouse(X). </script> <state id="start"> <transition target="end" cond="not(cat(jerry)), cat(tom), mouse(jerry)." /> </state> <state id="end" final="true"> <onentry> <log expr="animal(X)." /> </onentry> </state> </scxml> Off of the top of my head, there are several issues still unsolved: - What to make of the id attribute of the data element? Is it the name of a predicate and will <data> only list its relations? Is it the name of a prolog module in which to establish the predicate? - Which elements are in "fact-definition" as opposed to "evaluation" mode? In evaluation mode, all new facts have to be asserted - What does it mean to evaluate a predicate as a string? Is the result the first valid solution for a given free variable Is it a prolog list with all solutions for the free variable Is it a list with all solutions in a prolog list - How to represent events in prolog? OOP extensions or lisp-like nested lists? - On a technical note, SWI prolog allows only a single context per runtime (due to globals) This means that invoked SCXML session will inherit their parents facts at the moment :( There are way more issues, but these are those, we ran into with our first attempt. Another approach we had our eyes on was to embed Prolog as a logic engine into ECMAScript. While I do prefer a dedicated Prolog datamodel under a puristic point of view, the embedding into ECMAScript might be the right choice from a pragmatic viewpoint. I guess we'll continue to gather some experiences with ECMAScript for now, before we refine the prolog datamodel further. Best regards Stefan [1] https://github.com/tklab-tud/uscxml/blob/master/test/samples/uscxml/test-prolog.scxml
Received on Monday, 1 April 2013 16:16:35 UTC