Lists and Arrays In the W3C Choreography Description Language Tony Fletcher, Choreology Introduction I am not aware of anything new in the way of 'virgin' specification here that needs to be added to the main body of the WS-Choreography specification. However, it may be that we will agree that adding an informative Appendix pointing out that you can do things like this using XML Schema and perhaps provide a schema with some useful basic list and array definitions in that could be used directly or extended to meet a particular instance of use scenario. Probably the main place for this material - if anywhere - is in the Primer, where such an Appendix should be expanded upon. Adding Lists and Arrays into CDL The informationType construct references a type or element that is defined in another schema and pulled into an instance of the CDL schema via an Import (/Include) or WSDL reference (?). What sort of schema do we need to specify a list or an array we can use in WS-Choreography instance documents? Lists Suppose we have a type or element that has the following structure: ? or in XML schema This will give us a list of zero to as many as you would like of integers - change the type for string values or any other XML type. An example of this type would be: 1 2 4 8 Note that the only way to reference a particular value is by tag names then position. There is no unique tag name (on their own) reference. The second value in this list can be accessed using the XPath expression: /listA/listItem[2] In general the nth value may be accessed by the expression: /listA/listItem[n] where n is a variable of integer type. Arrays Extending this approach to a two dimensional the n-dimensional array is fairly obvious. Suppose we have a type or element that has the following structure: ? ? or in XML schema This will give us a 2 dimensional array of zero to as many as you would like of integers - change the type for string values or any other XML type. By adding more elements with different types, and removing the minOccurs and maxOccurs, one can generate an array with an arbitrary number of rows, but a fixed number of columns each of which can be given a desired type. Obviously one can also fix the number of rows but have an arbitrary number of columns of the same type and have an array that is fixed in both dimensions, and so forth. An example of this type would be: 1 1 2 4 8 1 16 32 64 128 Note that the only way to reference a particular value is by tag names then position. There is no unique tag name (on their own) reference. The value 64 in this list can be accessed using the XPath expression: /arrayA/dimension1[2]/dimension2[3] In general the n * m value may be accessed by the expression: /arrayA/dimension1[n]/dimension2[m] where m and are variables of integer type. Tailor Made Arrays Within the limitations of schema (and human invention!) one can define arrays tailor made to a particular situation. For example: /> Adding to CDL Could add a few utilitarian arrays and a list to the CDL schema but may be just as well to provide some examples in separate schemas in the specification perhaps in an Appendix, and / or Primer which can be imported or XIncluded. XQuery Apparently XQuery (1.0) uses the same data model and functions as XPath so looks to be a compatible 'upgrade' path if we start from XPath. However, if we specify / mandate XQuery upfront then that would seem quite a burden for implementers as they would have to implement or otherwise incorporate a full XQuery processor. We would also need to choose (possibly) between the verbose XML syntax (XQueryX) and its main, more compact, non-XML syntax. I therefore recommend that we try to limit our proposal to XPath (2.0, though this is not finalised yet), but perhaps allow for XQuery as an option when its power is required. Some examples One example is the case of a Map (in java terminology - hash in perl), where the index value is non-integer. A value of the list might be ace 32 brandX 26 chuck 37 and we want to access chuck's price. This can be accessed using the XPath expression: /quotes/quote[supplier="chuck"]/price of course, you would be more likely to want to get the price of the suppliers whose name is in the variable "chosen", which is just yet more XPath-ery (Actually what you are extremely likely to want to do is find the supplier from that list with the lowest price, then do a lookup on the list of addresses/inferiors to send the confirm Need XPath 2.0 (WD) for min and max functions References http://www.w3schools.com/xpath/ http://www.w3schools.com/xquery/ W3C WS-Choreography Page 1 of 4