tamie message
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
| [List Home]
Subject: Re: [tamie] Groups - eTSM XML Schema (etsm-0-1.xsd) modified
- From: Stephen Green <stephen.green@documentengineeringservices.com>
- To: tamie@lists.oasis-open.org
- Date: Wed, 12 Aug 2009 22:32:27 +0100
The namespaces need adjusting, of course, in the Core Use Case examples
from Chuck before they will validate with the draft Schema:
<!-- ============== Core Use Case: 1 ================= -->
<!--
- synchronous scriplet invocation, passing parameters.
- compose effects of several scriplets.
- use the "eval" operator for expression evaluation.
NOTE: the "effect" of the entire execution is supposed to go on the standard output.
EXPECTED OUTPUT:
<report:totalUpdate>
<report:previous>1000</report:previous>
<report:new>1330</report:new>
</report:totalUpdate>
-->
<etsm:monitoringScript xmlns:etsm="http://docs.oasis-open.org/tamie/etsm/draft/20090812"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://docs.oasis-open.org/tamie/etsm/draft/20090812 http://www.oasis-open.org/committees/download.php/33775/etsm-0-1.xsd"
xmlns:myapp="http://www.abc.com/TBD/myapp"
xmlns:report="http://www.abc.com/TBD/report"
name="CUC-1">
<etsm:executionContext>
<!-- some namespaces to be used in XML fragments generated as effect -->
<etsm:nmsbinding prefix="myapp">http://www.abc.com/TBD/myapp</etsm:nmsbinding>
<etsm:nmsbinding prefix="report">http://www.abc.com/TBD/report</etsm:nmsbinding>
<!-- starting point -->
<etsm:startwith scriplet="test1"/>
<!-- a global variable -->
<etsm:var name="currentTotal" type="double">1000</etsm:var>
</etsm:executionContext>
<!-- ======= scriplet: test1 ======= -->
<etsm:scriplet name="test1">
<etsm:var name="totalpos" type="double" expr="$currentTotal"/>
<etsm:var name="mynewpo" type="xml">
<myapp:po>
<myapp:ref>123456</myapp:ref>
<myapp:product>greenbike</myapp:product>
<myapp:qty>2</myapp:qty>
<myapp:price>165</myapp:price>
</myapp:po>
</etsm:var>
<report:totalUpdate>
<etsm:start scriplet="addpo">
<etsm:with-param name="mypo" expr="$mynewpo"/>
<etsm:with-param name="previoustotal" expr="$totalpos"/>
</etsm:start>
</report:totalUpdate>
</etsm:scriplet> <!-- test1 -->
<!-- ======= scriplet: addpo ======= -->
<etsm:scriplet name="addpo">
<etsm:param name="mypo"/>
<etsm:param name="previoustotal"/>
<report:previous><etsm:eval expr="$previoustotal"/></report:previous>
<report:new><etsm:eval expr="$previoustotal + ($mypo/myapp:po/myapp:price * $mypo/myapp:po/myapp:qty)"/></report:new>
</etsm:scriplet> <!-- addpo -->
</etsm:monitoringScript>
<!-- ============== Core Use Case: 2 ================= -->
<!--
- loop execution
- date functions
XSLT translation: Core-2-xslt.xsl
NOTE: the "effect" of the entire execution is supposed to go on the standard output.
EXPECTED OUTPUT:
<report:traceloop xmlns:etsm="http://www.oasis-open.org/tamie/">
<report:startingdate>2009-10-08T11:12:00</report:startingdate>
<report:currentcnt>0</report:currentcnt>
<report:currentdate>2009-10-08T11:12:00</report:currentdate>
<report:currentcnt>1</report:currentcnt>
<report:currentdate>2009-10-09T16:42:00</report:currentdate>
<report:currentcnt>2</report:currentcnt>
<report:currentdate>2009-10-10T22:12:00</report:currentdate>
<report:currentcnt>3</report:currentcnt>
<report:currentdate>2009-10-12T03:42:00</report:currentdate>
<report:currentcnt>4</report:currentcnt>
<report:currentdate>2009-10-13T09:12:00</report:currentdate>
<report:finaldate>2009-10-14T14:42:00</report:finaldate>
<report:elapsedtime>P6DT3H30M</report:elapsedtime>
</report:traceloop>
-->
<etsm:monitoringScript xmlns:etsm="http://docs.oasis-open.org/tamie/etsm/draft/20090812"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://docs.oasis-open.org/tamie/etsm/draft/20090812 http://www.oasis-open.org/committees/download.php/33775/etsm-0-1.xsd"
xmlns:report="http://www.abc.com/TBD/report"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
name="CUC-2">
<etsm:executionContext>
<!-- some namespaces to be used in XML fragments generated as effect -->
<etsm:nmsbinding prefix="report">http://www.abc.com/TBD/report</etsm:nmsbinding>
<!-- starting point -->
<etsm:startwith scriplet="test2"/>
<!-- global variables -->
<etsm:var name="totaliter" type="integer">5</etsm:var>
<etsm:var name="startdate" type="dateTime">2009-10-08T11:12:00</etsm:var>
</etsm:executionContext>
<!-- ======= scriplet: test2 ======= -->
<etsm:scriplet name="test2">
<report:traceloop> <!-- XML fragment to be produced as "effect" -->
<etsm:start scriplet="counting">
<etsm:with-param name="maxiter" expr="$totaliter"/>
<etsm:with-param name="initdate" expr="$startdate"/>
</etsm:start>
</report:traceloop>
</etsm:scriplet> <!-- test2 -->
<!-- ======= scriplet: counting ======= -->
<etsm:scriplet name="counting">
<etsm:param name="maxiter" type="integer"/>
<etsm:param name="initdate" type="dateTime"/>
<!-- this scriplet just iterate and increment some counter and some date, wile producing some XML fragement as effect. -->
<etsm:loop>
<etsm:onstart>
<etsm:loopvar name="mycounter" type="integer">0</etsm:loopvar>
<etsm:loopvar name="currentdate" type="dateTime" expr="$initdate"/>
</etsm:onstart>
<!-- etsm:until expr="op:dateTime-greater-than( etsm:time(), $deactivationDate)"/ -->
<etsm:until expr="$mycounter ge $maxiter"/>
<report:currentcnt><etsm:eval expr="$mycounter"/></report:currentcnt>
<report:currentdate><etsm:eval expr="$currentdate"/></report:currentdate>
<etsm:nextval name="mycounter" expr="$mycounter + 1 "/>
<etsm:nextval name="currentdate" expr="($currentdate + xs:dayTimeDuration('P1DT5H30M0S'))"/>
<etsm:onfinal>
<report:finaldate><etsm:eval expr="$currentdate"/></report:finaldate>
<report:elapsedtime><etsm:eval expr="$currentdate - $startdate"/></report:elapsedtime>
</etsm:onfinal>
</etsm:loop>
</etsm:scriplet> <!-- counting -->
</etsm:monitoringScript>
<!-- ============== Core Use Case: 3 ================= -->
<!--
- Close to CUC1, but includes Exit statement.
- compose effects of several scriplets, around the Exit as well.
NOTE: the "effect" of the entire execution is supposed to go on the standard output.
EXPECTED OUTPUT:
When no Exit:
<report:totalUpdate>
<report:pochange>
<report:previous>1000</report:previous>
<report:new>1330</report:new>
</report:pochange>
</report:totalUpdate>
When Exiting (as is the case in the coding below):
<report:totalUpdate>
<report:error name="ERR01"/>
</report:totalUpdate>
-->
<etsm:monitoringScript xmlns:etsm="http://docs.oasis-open.org/tamie/etsm/draft/20090812"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://docs.oasis-open.org/tamie/etsm/draft/20090812 http://www.oasis-open.org/committees/download.php/33775/etsm-0-1.xsd"
xmlns:myapp="http://www.abc.com/TBD/myapp"
xmlns:report="http://www.abc.com/TBD/report"
name="CUC-3">
<etsm:executionContext>
<!-- some namespaces to be used in XML fragments generated as effect -->
<etsm:nmsbinding prefix="myapp">http://www.abc.com/TBD/myapp</etsm:nmsbinding>
<etsm:nmsbinding prefix="report">http://www.abc.com/TBD/report</etsm:nmsbinding>
<!-- starting point -->
<etsm:startwith scriplet="test3"/>
<!-- a global variable -->
<etsm:var name="currentTotal" type="double">1000</etsm:var>
<etsm:var name="justaTest" type="double">123</etsm:var>
</etsm:executionContext>
<!-- ======= scriplet: test3 ======= -->
<etsm:scriplet name="test3">
<etsm:var name="totalpos" type="double" expr="$currentTotal"/>
<etsm:var name="mynewpo" type="xml">
<myapp:po>
<myapp:ref>123456</myapp:ref>
<myapp:product>greenbike</myapp:product>
<myapp:qty>2</myapp:qty>
<myapp:price>165</myapp:price>
</myapp:po>
</etsm:var>
<report:totalUpdate>
<etsm:start scriplet="addpo">
<etsm:with-param name="mypo" expr="$mynewpo"/>
<etsm:with-param name="previoustotal" expr="$totalpos"/>
</etsm:start>
</report:totalUpdate>
</etsm:scriplet> <!-- test3 -->
<!-- ======= scriplet: addpo ======= -->
<etsm:scriplet name="addpo">
<etsm:param name="mypo"/>
<etsm:param name="previoustotal"/>
<report:pochange>
<report:previous>
<etsm:eval expr="$previoustotal"/>
</report:previous>
<etsm:if expr="$mypo/myapp:po/myapp:price > 100">
<etsm:exit>
<report:error name="ERR01"/>
</etsm:exit>
</etsm:if>
<report:new>
<etsm:eval expr="$previoustotal + ($mypo/myapp:po/myapp:price * $mypo/myapp:po/myapp:qty)"/>
</report:new>
</report:pochange>
</etsm:scriplet> <!-- addpo -->
</etsm:monitoringScript>
<!-- ============== Core Use Case: 4 ================= -->
<!--
- nested loops.
EXPECTED OUTPUT:
Numbers from 1.1 to 10.10 followed by "Final i: 11"
-->
<etsm:monitoringScript xmlns:etsm="http://docs.oasis-open.org/tamie/etsm/draft/20090812"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://docs.oasis-open.org/tamie/etsm/draft/20090812 http://www.oasis-open.org/committees/download.php/33775/etsm-0-1.xsd" name="CUC-4">
<etsm:scriplet name="main">
<etsm:loop>
<etsm:onstart>
<etsm:loopvar name="i">1</etsm:loopvar>
</etsm:onstart>
<etsm:until expr="$i > 10"/>
<etsm:loop>
<etsm:onstart>
<etsm:loopvar name="j">1</etsm:loopvar>
</etsm:onstart>
<etsm:until expr="$j > 10"/>
<etsm:message><etsm:eval expr="concat($i, '.', $j)"/></etsm:message>
<etsm:nextval name="j" expr="$j + 1"/>
</etsm:loop>
<etsm:nextval name="i" expr="$i + 1"/>
<etsm:onfinal>
<etsm:message>Final i: <etsm:eval expr="$i"/></etsm:message>
</etsm:onfinal>
</etsm:loop>
</etsm:scriplet>
</etsm:monitoringScript>
<!-- ============== Core Use Case: 5 ================= -->
<!--
- Close to CUC1, but includes Exit statement.
- compose effects of several scriplets, around the Exit as well.
NOTE: the "effect" of the entire execution is supposed to go on the standard output.
EXPECTED OUTPUT:
When no Exit:
<report:totalUpdate xmlns:p="http://www.ws-i.org/2002/08/12/ProfileDoc-2.0.xsd"
...
xmlns="http://www.oasis-open.org/2009/tamie">
<report:pochange>
<report:previous>1000</report:previous>
<report:newtotal>1730</report:newtotal>
<report:discount>173</report:discount>
<report:wrap>
<report:morediscount>346</report:morediscount>
</report:wrap>
</report:pochange>
</report:totalUpdate>
When Exiting :
<report:totalUpdate xmlns:p="http://www.ws-i.org/2002/08/12/ProfileDoc-2.0.xsd"
...
xmlns="http://www.oasis-open.org/2009/tamie">
<report:error name="ERR02" description="price less than 200"/>
</report:totalUpdate>
-->
<etsm:monitoringScript xmlns:etsm="http://docs.oasis-open.org/tamie/etsm/draft/20090812"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://docs.oasis-open.org/tamie/etsm/draft/20090812 http://www.oasis-open.org/committees/download.php/33775/etsm-0-1.xsd"
xmlns:myapp="http://www.abc.com/TBD/myapp"
xmlns:report="http://www.abc.com/TBD/report"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name="CUC-3">
<etsm:executionContext>
<!-- some namespaces to be used in XML fragments generated as effect -->
<etsm:nmsbinding prefix="myapp">http://www.abc.com/TBD/myapp</etsm:nmsbinding>
<etsm:nmsbinding prefix="report">http://www.abc.com/TBD/report</etsm:nmsbinding>
<!-- starting point -->
<etsm:startwith scriplet="test5"/>
<!-- a global variable -->
<etsm:var name="currentTotal" type="double">1000</etsm:var>
<etsm:var name="justaTest" type="double">123</etsm:var>
</etsm:executionContext>
<!-- ======= scriplet: test5 ======= -->
<etsm:scriplet name="test5">
<etsm:var name="totalpos" type="double" expr="$currentTotal"/>
<etsm:var name="mynewpo" type="xml">
<myapp:po>
<myapp:ref>123456</myapp:ref>
<myapp:product>greenbike</myapp:product>
<myapp:qty>2</myapp:qty>
<myapp:price>165</myapp:price>
</myapp:po>
</etsm:var>
<etsm:var name="previoustotal" type="xml">
<etsm:if expr="xsd:double($totalpos) lt 0">
<etsm:exit>
<report:error name="ERR00" description="total is negative"/>
</etsm:exit>
</etsm:if>
<etsm:eval expr="$totalpos"/>
</etsm:var>
<report:totalUpdate>
<etsm:start scriplet="addpo" bubblexit="false">
<etsm:with-param name="mypo" expr="$mynewpo"/>
<etsm:with-param name="previoustotal" expr="$previoustotal"/>
</etsm:start>
</report:totalUpdate>
</etsm:scriplet> <!-- test5 -->
<!-- ======= scriplet: addpo ======= -->
<etsm:scriplet name="addpo">
<etsm:param name="mypo"/>
<etsm:param name="previoustotal"/>
<report:pochange>
<report:previous>
<etsm:eval expr="$previoustotal"/>
</report:previous>
<etsm:if expr="xsd:integer($mypo/myapp:po/myapp:price) lt 100">
<etsm:exit>
<report:error name="ERR01" description="price less than 100"/>
</etsm:exit>
</etsm:if>
<etsm:var name="newtotal" expr="$previoustotal + ($mypo/myapp:po/myapp:price * $mypo/myapp:po/myapp:qty)"/>
<report:newtotal>
<etsm:eval expr="$newtotal"/>
</report:newtotal>
<report:discount>
<etsm:eval expr="($newtotal * 10) div 100 "/>
</report:discount>
<etsm:if expr="xsd:integer($mypo/myapp:po/myapp:price) lt 200">
<etsm:exit>
<report:error name="ERR02" description="price less than 200"/>
</etsm:exit>
</etsm:if>
<report:wrap>
<etsm:if expr="xsd:integer($mypo/myapp:po/myapp:price) lt 300">
<etsm:exit>
<report:error name="ERR03" description="price less than 300"/>
</etsm:exit>
</etsm:if>
<report:morediscount>
<etsm:eval expr="($newtotal * 20 ) div 100 "/>
</report:morediscount>
</report:wrap>
</report:pochange>
</etsm:scriplet> <!-- addpo -->
</etsm:monitoringScript>
<!-- ==== Function === -->
<etsm:monitoringScript xmlns:etsm="http://docs.oasis-open.org/tamie/etsm/draft/20090812"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://docs.oasis-open.org/tamie/etsm/draft/20090812 http://www.oasis-open.org/committees/download.php/33775/etsm-0-1.xsd"
xmlns:xyz="xyz">
<etsm:function name="xyz:factorial">
<etsm:param name="num"/>
<etsm:decide>
<etsm:if expr="$num eq 1">1</etsm:if>
<etsm:else>
<etsm:eval expr="$num * xyz:factorial($num - 1)"/>
</etsm:else>
</etsm:decide>
</etsm:function>
<etsm:scriplet name="main">
<etsm:message>5! is <etsm:eval expr="xyz:factorial(5)"/></etsm:message>
</etsm:scriplet>
</etsm:monitoringScript>
<!-- ============== Loop and Exit ================= -->
<etsm:monitoringScript xmlns:etsm="http://docs.oasis-open.org/tamie/etsm/draft/20090812"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://docs.oasis-open.org/tamie/etsm/draft/20090812 http://www.oasis-open.org/committees/download.php/33775/etsm-0-1.xsd">
<etsm:scriplet name="main">
<etsm:loop>
<etsm:onstart>
<etsm:loopvar name="i">1</etsm:loopvar>
</etsm:onstart>
<etsm:until expr="$i > 10"/>
<etsm:loop>
<etsm:onstart>
<etsm:loopvar name="j">1</etsm:loopvar>
</etsm:onstart>
<etsm:until expr="$j > 10"/>
<etsm:message><etsm:eval expr="concat($i, '.', $j)"/></etsm:message>
<etsm:if expr="$i = 5 and $j = 5">
<etsm:exit/>
</etsm:if>
<etsm:nextval name="j" expr="$j + 1"/>
</etsm:loop>
<etsm:nextval name="i" expr="$i + 1"/>
<etsm:onfinal>
<etsm:message>Final i: <etsm:eval expr="$i"/></etsm:message>
</etsm:onfinal>
</etsm:loop>
</etsm:scriplet>
</etsm:monitoringScript>
---
Stephen D Green
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
| [List Home]