OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

wsbpel message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: RE: [wsbpel] Issue - 63 - For Each?


Yaron,

I agree with you in that adding a for-each construct, like the one you have
detailed, would both be a good way to solve issue 63 and would also simplify
writing BPEL since iterating over a node list is a very common scenario. I
am just curious why you have added the query as a separate element and not
an attribute, like the <from> construct for example, and why not use the
query language that can be specified on the <process> element?

Regards,

Kristofer

-----Original Message-----
From: Yaron Y. Goland [mailto:ygoland@bea.com] 
Sent: Thursday, March 25, 2004 4:17 PM
To: wsbpeltc
Subject: [wsbpel] Issue - 63 - For Each?

The following are thoughts I've had on how we could address issue 63. 
Although these thoughts are still fairly rough I wanted to release them 
now because 63 is on the agenda for the F2F. Since these are early 
thoughts I reserve the right to disavow them at any time.

I thought an easy way to provide the feature asked for in 63 is to 
provide a macro that has proven its utility in numerous structured 
languages - For Each.

I was thinking of a syntax like:
<foreach sourceVariable="ncname" part="ncname"? \
          iteratorVariableName="ncname" iteratorVariableType="qname"
          standard-attributes>
    standard-elements
    <query language="anyURI">...</query>
    activity
</foreach>

The idea is that the query element would be an expression that generates 
zero or more nodes. Each generated node would be assigned to a local 
variable whose name is given in iteratorVariableName and whose type is 
iteratorVariableType. The foreach would then walk through each node one 
by one in document order. If no nodes are returned then the activity 
would do nothing.

For example:
foreach sourceVariable="orderManifest" part="somePart"\
         iteratorVariableName="anOrder" iteratorVariableType="b:ar"
    query language="http://www.w3.org/TR/1999/REC-xpath-19991116";
       ordermanifest/orders
    ...

Would be a Macro for:
scope
    variables
       variable name="anOrder" type="b:ar"
       variable name="currentInstanceNum" type="xs:int"
    sequence
       assign
          copy
             from
                "1"
             to variable="currentInstanceNum"
       while condition="$currentInstanceNum <=\
                        count($orderList/somePart/ordermanifest/orders)"
          assign
             copy
                from variable="orderList" part="somePart"
                   query
                      "(/ordermanifest/orders)[$currentInstanceNum]"
                to variable="anOrder"
          assign
             copy
               from
                  expression
                     "$currentInstanceNum+1"
               to variable="currentInstanceNum"
          ...

To unsubscribe from this mailing list (and be removed from the roster of the
OASIS TC), go to
http://www.oasis-open.org/apps/org/workgroup/wsbpel/members/leave_workgroup.
php.



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]