- From: Michael Brundage <xquery@comcast.net>
- Date: Tue, 23 Sep 2003 12:18:45 -0700
- To: "'Jan Hidders'" <jan.hidders@ua.ac.be>, <www-ql@w3.org>
? It is not possible for child nodes to be in anything other than document order. The point is that nodes have a deterministic document order only when they are placed in the same tree. Nodes from different trees have a non-deterministic implementation-dependent document order. A FLWOR statement whose return clause is a constructor always returns a sequence of (unrelated) trees. for $i in (1, 2, 3) return <x id="{$i}"/> returns a sequence of three (unrelated) x elements. It always returns this sequence in the same order: <x id="1"/><x id="2"/><x id="3"/> by the definition of FLWOR. However, the relative document order of any two of these nodes is implementation-defined. let $nodes := (for $i in (1, 2, 3) return <x id="{$i}"/>) return $nodes[1] << $nodes[2] may return true or false, depending on the implementation. -----Original Message----- From: www-ql-request@w3.org [mailto:www-ql-request@w3.org] On Behalf Of Jan Hidders Sent: Tuesday, September 23, 2003 10:09 AM To: www-ql@w3.org Subject: Re: creation order vs. document order Hello Michael, Michael Brundage wrote: > > Completely separately from this, every node in the data model is ordered > relative to every other one. Your query happens to be creating a sequence > of c elements, each in its own fragment. Consider the two queries below: > > let $tree1 := (<x><y/><y/></x>)/y > return $tree1[1] << $tree1[2] > > always returns true. The two y child elements of x are siblings of one > another, and the first one always comes before the second in document order. That's actually true regardless of whether the children of the x element are in document order or not because the let clause uses a path expression which returns always a result in document order. -- Jan Hidders .---------------------------------------------------------------------. | Post-doctoral researcher e-mail: jan.hidders@ua.ac.be | | Dept. Math. & Computer Science tel: (+32) 3 218 08 73 | | University of Antwerp fax: (+32) 3 218 07 77 | | Middelheimlaan 1, BE-2020 Antwerpen, BELGIUM room: G 3.21 | `---------------------------------------------------------------------'
Received on Tuesday, 23 September 2003 15:12:05 UTC