Hi Yaron and Danny,
Danny:
Originally I also had a similar concern in my mind. However, XPath 1.0
is a very weak-typed language. The round() function application here is
actually consistent with other XPath 1.0 situation.
See: http://www.w3.org/TR/xpath#function-substring
See: substring("12345", 1.5, 2.6) returns "234"
Yaron:
+1 from me in general. :-)
I hope my preference of having two activities on 147.4 would be
accepted as a friendly amendent. Here are the changes related to this
amendment.
============================
<forEach counterName="ncname" standard-attributes>
standard-elements
<iterator>
<startCounterValue expressionLanguage="anyURI">
...
</startCounterValue>?
<finalCounterValue expressionLanguage="anyURI">
...
</finalCounterValue>?
</iterator>
Scope
</foreach>
<parallelForEach counterName="ncname" standard-attributes>
standard-elements
<iterator>
<startCounterValue expressionLanguage="anyURI">
...
</startCounterValue>?
<finalCounterValue expressionLanguage="anyURI">
...
</finalCounterValue>?
</iterator>
Scope
</parallelForEach>
============================
FROM:
-----------------------------------
If parallel="no" then this is a serial foreach where the enclosed scope
activity will be repeated N+1 times. ...
-----------------------------------
TO:
-----------------------------------
<forEach> is a serial version of iteration activity where the
enclosed scope activity will be repeated N+1 times. ...
-----------------------------------
FROM:
-----------------------------------
If parallel="yes" then this is a parallel foreach where the N+1
instances of the enclosed scope activity will occur in parallel.
-----------------------------------
TO:
-----------------------------------
<parallelForEach> is a parallel version of iteration activity
where the N+1 instances of the enclosed scope activity will occur in
parallel.
-----------------------------------
XSD Changes.
================================
Add the following to the 'activity' group:
<element name="forEach" type="bpws:tGenericForEach"/>
<element name="parallelForEach" type="bpws:tGenericForEach"/>
Then add the following into the main body of the schema:
<complexType name="tGenericForEach">
<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"/>
</extension>
</complexContent>
</complexType>
[Note: the parallel attribute is now dropped.]
<complexType name="tIterator">
<complexContent>
<extension base="bpws:tExtensibleElements">
<sequence minOccurs="0">
<element name="startCounterValue"
type="bpws:tExpression"/>
<element name="finalCounterValue"
type="bpws:tExpression"/>
</sequence>
</extension>
</complexContent>
</complexType>
[Note: I change the location of minOccurs to better reflect
Yaron's intended syntactic requirement of these expressions.]
================================
Thanks!
Regards,
Alex Yiu
Danny van der Rijn wrote:
Looks
good. One small nit/question: Why do you require a call to round() if
it's XPath? I would think that it would be more valuable if a counter
value of, say, 2.1, would be an error, rather than 2.
Danny
Yaron Y. Goland wrote:
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>
---------------------------------------------------------------------
To unsubscribe from this mail list, you must leave the OASIS TC that
generates this mail. You may a link to this group and all your TCs in
OASIS
at:
https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php
---------------------------------------------------------------------
To unsubscribe from this mail list, you must leave the OASIS TC that
generates this mail. You may a link to this group and all your TCs in
OASIS
at:
https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php
|