'Xeme' means 'XML Scheme', it's a nickname for expressions inspired by Lisp (and especially Scheme) that do return a value (as the '__result__' field of the workitem they received).
'POOL' means 'Process Oriented OpenWFE Lisp' or 'Process Oriented OpenWFE Language'. 'Xeme' and 'Pool' are sometimes used one for the other. Usually people say the 'process definition language' (of OpenWFE).
The 'xeme' expressions will always try to return a content that is XML. The concept behind this is to be able to user 'car', 'cdr', 'xons' and co on the result of a[nother] xeme expression.
The xeme expressions are fully used in the section called “A self extension case : reversing a list” for example.
Xeme expressions tend to 'return' XmlAttribute instances that they store in the '__result__' field of their outgoing workitem.
This expression will store its xml content in the __result__ field of its workitem. Thus
<set field="some_text">
<quote>
Mary had a little lamb
</quote>
</set>
<set field="some_xml">
<q>
<customer
name="Arturo Bragghetti"
>
<account id="23423" balance="-45.00" />
<account id="23432" balance="+1500.00" />
</customer>
</q>
</set>
will store the text "Mary had a little lamb" in the field named 'some_text' and an XML fragment whose root element is named 'customer' in the field 'some_xml'. The 'quote' (and its 'q' abbreviation) expression prevents the evaluation of its content.
Use <a> to wrap workitem attribute values within the process definition. Usually StringAttribute values are 'set' within the payload of the workitem, but this xeme expressions allows for more depth.
<set field="term_list">
<a>
<list>
<string>nada</string>
<string>nadie</string>
<string>jamas</string>
</list>
</a>
</set>
Of course, you can do nastier things :
<set field="customer">
<a>
<smap>
<entry>
<string>name</string>
<string>Shostakovitch</string>
</entry>
<entry>
<string>city</string>
<string>Petrograd</string>
</entry>
<entry>
<string>car</string>
<smap>
<entry>
<string>make</string>
<string>Alfa-Romeo</string>
</entry>
<entry>
<string>model</string>
<string>147</string>
</entry>
</smap>
</entry>
</smap>
</a>
</set>
This is somehow the equivalent of ${field:customer_name}. Somehow because it's not for text substitution, it's for returning the content of a field in the field named '__result__'. Thus :
<set field="my_field"><f>other_field</f></set>
<!-- is equivalent to -->
<set field="my_field" field-value="other_field" />
Currently, the ${field:f.x.y.z} (allowing things like ${f:customer.address.street}) has no equivalent with this 'f' expression.
Like the 'f' expression is the equivalent of ${field:customer_name}, the 'v' expression is somehow the equivalent of ${my_variable}.
<set field="my_field"><v>that_variable</v></set>
<!-- is equivalent to -->
<set field="my_field" variable-value="that_variable" />
Using <v> instead of the dollar notations may be advantageous in certain situations.
<sequence>
<set variable="v0">
<list>a, b, c, d</list>
</set>
<print><cdr>${v0}</cdr></print>
<!-- will yield an error -->
<print><cdr><v>v0</v></cdr></print>
<!-- will yield :
<list>
<string>b</string>
<string>c</string>
<string>d</string>
</list>
-->
</sequence>
Where the 'attribute' (a) expression ensures that its content will be stored as an Attribute in the outgoing '__result__' field, this expression will ensure that its content will be stored in an XmlAttribute.
<set field="f0">
<list>a, b, c, d</list>
</set>
Why isn't this expression named something like 'xml' instead of 'list' ? Well, with it's ability to turn a string like 'a, b, c, d' into a 4 elements list, it's not limited to quote XML fragments.
This expression will return the first element of the list passed to it.
<sequence>
<set field="f0">
<list>a, b, c, d</list>
</set>
<set field="f1">
<car><f>f0</f></car>
</set>
<!-- will store 'a' in f1 -->
</sequence>
'car', 'cdr' and 'cons' are well-known Lisp expressions.
This expression returns a copy of the list passed as parameter, but without the first element.
<sequence>
<set field="f0">
<list>a, b, c, d</list>
</set>
<set field="f2">
<cdr><f>f0</f></cdr>
</set>
<!-- will store 'b, c, d' in f2 -->
<set field="f3">
<car><f>f2</f></car>
</set>
<!-- will store 'b' in f3 -->
</sequence>
'cons' takes two input, an element and a list. It returns a new list whose first element is the first input item.
<sequence>
<set field="f0">
<list>b, c, d</list>
</set>
<set field="f1">
<cons><q>a</q><f>f0</f></cons>
</set>
<!-- will store 'a, b, c, d' in f1 -->
</sequence>
'xar', 'xdr' and 'xons' are methods for extracting / manipulating name and attributes of XML input.
'xar' returns the element name of its input
<sequence>
<set field="f0"><xar>
<q>
<list>
<string>${f:f0}</string>
<string>nada</string>
</list>
</q>
</xar></set>
<!-- will store 'list' in the field f0 -->
<set variable="v0">
<q>
<customer id="xv45s">
<name>Roger Federer</name>
<address>
<city>Basel</city>
</address>
</customer>
</q>
</set>
<set field="f1">
<xar><v>v0</v></xar>
</set>
<!-- will put 'customer' in f1 -->
</sequence>
This expression extracts the attributes of an XML fragement as a list.
<sequence>
<set variable="v0">
<q>
<customer id="xv45s">
<name>Roger Federer</name>
<address>
<city>Basel</city>
</address>
</customer>
</q>
</set>
<set field="f1">
<xdr><v>v0</v></xdr>
</set>
<!-- will put
<customer>
<id>xv45s</id>
</customer>
in f1 -->
<set field="f2">
<car><car><f>f1</f></car></car>
</set>
<!-- will store 'xv45s' in f2 -->
</sequence>
Use this expression to change the name of an XML element or to add attributes to it.
<sequence>
<set variable="v0"><xons>
<q><name>nada</name></q>
<q><customer/></q>
</xons></set>
<!-- will yield
<customer name="nada" />
in v0 -->
<set variable="v1"><xons>
<q>client</q>
<q><customer id="toto"/></q>
</xons></set>
<!-- will yield
<client id="toto" />
in v1 -->
</sequence>
Consolidates two XML elements into one.
<set field="f1">
<append>
<q>
<item count="2">
<name>Confiture</name>
<label>Quality</label>
</item>
</q>
<q>
<fragment type="xyz">
<price value="4.50" currency="CHF" />
<color value="white" />
</fragment>
</q>
</append>
</set>
will store the following XML in the field 'f1' :
<item count="2">
<name>Confiture</name>
<label>Quality</label>
<price value="4.50" currency="CHF" />
<color value="white" />
</item>
This expression will return the size of the list (or XML content) passed to it as first child.
<sequence>
<set field="f0">
<q>
<item0/>
<item1/>
<item2/>
</q>
</set>
<!--
will store '3' in the field 'f1' :
-->
<set field="f1">
<size><f>f0</f></size>
</set>
</sequence>
<nth> takes two children paramters, an index and a list (or some XML content). It will return the content found at the 'index' position in the given list (or XML content).
<sequence>
<set variable="index" value="2" />
<set variable="data-tree">
<q>
<customers>
<customer>
<name>Toto</name>
<country>Bordurie</country>
</customer>
<customer>
<name>Tournesol</name>
<country>Syldavie</country>
</customer>
<customers>
<customer>
<name>Ramses</name>
<country>Egypt</country>
</customer>
<customer>
<name>Seti</name>
<country>Andromeda</country>
</customer>
</customers>
<customer>
<name>Flupke</name>
<country>Belgium</country>
</customer>
</customers>
</q>
</set>
<!--
will put
<customers>
<customer>
<name>Ramses</name>
<country>Egypt</country>
</customer>
<customer>
<name>Seti</name>
<country>Andromeda</country>
</customer>
</customers>
in the field 'content' of the workitem
-->
<set field="content">
<nth>
<v>index</v>
<v>data-tree</v>
</nth>
</set>
<!--
will send a workitem to participant 'cto' :
-->
<eval>
<nth>
<q>1</q>
<list>
<participant ref="cfo" />
<participant ref="cto" timeout="2d" />
</list>
</nth>
</eval>
</sequence>