[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Issue - 147 - Proposal For Vote
147 - Serial and Parallel Foreach
Proposal: Introduce a foreach to BPEL with both serial and parallel
semantics.
Rationale: Just check the issue list for issue 147. There is a whole
series of mails attesting to how important this activity is.
Introduce a section 12.6
12.6 - foreach
<forEach counterName="ncname" parallel="yes|no" standard-attributes>
standard-elements
<iterator>
<startCounterValue expressionLanguage="anyURI">
...
</startCounterValue>?
<finalCounterValue expressionLanguage="anyURI">
...
</finalCounterValue>?
</iterator>
Scope
</foreach>
The foreach activity is an iterator that will repeat its contained scope
activity exactly N+1 times where N equals the <finalCounterValue> minus
the <startCounterValue>.
When the foreach activity is started the expressions in
<startCounterValue> and <finalCounterValue> are evaluated for the first
and only time. That is, once the two values are returned they remain
constant for the lifespan of the activity. Both expressions MUST each
return a TII (meaning they contain at least one character) that can be
validated as a xs:unsignedint and the startCounterValue MUST be less
than or equal to the finalCounterValue, if any of these restrictions are
violated then the bpws:forEachCounterError fault MUST be thrown. If the
expression language used in either element happens to be
urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0 then the expressions
contained in the two elements MUST be wrapped in implicit calls to the
round(number()) functions.
The Scope activity MUST NOT have a variable explicitly declared in it
with the same name as contained in the counterName attribute, a
violation of this requirement MUST be statically enforced.
If parallel="no" then this is a serial foreach where the enclosed scope
activity will be repeated N+1 times. During each repetition a variable
of type xs:unsignedint will be created on the enclosed scope activity
with the name specified in the counterName attribute. The counter
variable's creation and initialization MUST occur before any other
variables on the enclosed scope activity are declared, therefore other
variables declared on the enclosed scope activity MAY refer to the
counter variable in their own initializations. The counter variable is
local to the enclosed scope and although its value can be changed during
an iteration that value will be lost when the enclosed scope exits and
will not affect the value that the next iteration's counter will be set to.
The first iteration of the scope will see the counter variable set to
the startCounterValue. The next iteration will cause the counter
variable to be set to the startCounterValue plus one. Each subsequent
iteration will increment the previously initialized counter value by one
until the final iteration where the counter will be set to the
finalCounterValue.
If parallel="yes" then this is a parallel foreach where the N+1
instances of the enclosed scope activity will occur in parallel. In
essence an implicit flow is dynamically created with N+1 copies of the
foreach's enclosed scope activity as children. Each copy of the scope
activity will have the same counter variable defined in the same manner
as specified for serial foreach with the exception that each counter
variable will be uniquely initialized to one of the integer values
starting with startCounterValue and covering all integer values,
incremented by one, up to and including finalCounterValue.
Both the start and final counter values are optional in the schema but
this is only to allow for future use of extension elements. A
non-extended version of the forEach activity MUST include both the
startcountervalue and the finalCounterValue.
Add to Appendix A:
forEachCounterError - Either the startCounterValue or finalCounterValue
returned non-unsigned integer values or the start value was greater than
the final value.
Add to Schema:
Add the following to the 'activity' type:
<element name="forEach" type="bpws:tForEach"/>
Then add the following into the main body of the schema:
<complexType name="tForEach">
<complexContent>
<extension base="bpws:tActivity">
<sequence>
<element name="iterator" type="bpws:tIterator"/>
<element name="scope" type="bpws:tScope"/>
</sequence>
<attribute name="counterName" type="NCName"
use="required"/>
<attribute name="parallel" type="bpws:tBoolean"
use="required"/>
</extension>
</complexContent>
</complexType>
<complexType name="tIterator">
<complexContent>
<extension base="bpws:tExtensibleElements">
<sequence>
<element name="startCounterValue"
type="bpws:tExpression" minOccurs="0"/>
<element name="finalCounterValue"
type="bpws:tExpression" minOccurs="0"/>
</sequence>
</extension>
</complexContent>
</complexType>
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]