W3C home > Mailing lists > Public > www-ql@w3.org > April to June 2005

RE: Re: Variable references in path expressions

From: Michael Rys <mrys@microsoft.com>
Date: Tue, 26 Apr 2005 08:49:05 -0700
Message-ID: <BAE415CEAA831548800F68C44E905AF501F4DC07@RED-MSG-60.redmond.corp.microsoft.com>
To: "Henry Luo" <henryluo@vibrasoft.net>, "Michael Kay" <mhk@mhk.me.uk>, <www-ql@w3.org>

The later should probably be <a10/>/<a5/>. 

This expression itself does not make much sense, but since composability
allows this, it would be hard to disallow in the language. And one major
difference is that we have node ids and an order relation for the nodes
but not for atomic values and the semantics for / needs both.

If XQuery would only allow homogeneous sequences of either atomic values
or nodes, you could define / to mean something useful for 10/5, but the
problem is that you can have heterogeneous mixes of atomic values and
nodes for which the semantics of / is not well defined.

Best regards
Michael

> -----Original Message-----
> From: www-ql-request@w3.org [mailto:www-ql-request@w3.org] On Behalf
Of
> Henry Luo
> Sent: Tuesday, April 26, 2005 8:33 AM
> To: Michael Kay; www-ql@w3.org
> Subject: Re: Re: Variable references in path expressions
> 
> 
> Latest working draft of XQuery Section 3.2, does not allow atomic
values
> to
> be returned in the path except the last step.
> That is expression like   (1, 2, 3)/(1, 2, 3) is not allowed.
> I've asked this question, and the reason given by the WG is that
someone
> found 10/5 giving 5 is useless.
> 
> However, as in the previous discussion, expr like
>     (<a1/>, <a2/>, <a3/>)/(<b1/>, <b2/>, <b3/>) giving (<b1/>, <b2/>,
> <b3/>)
> which is valid. But there's really no major difference between 10/5
vs.
> <a10>/<a5>.
> 
> Why should we allow latter but not the former?
> 
> Henry
> 
> ----- Original Message -----
> From: "Michael Kay" <mhk@mhk.me.uk>
> To: <www-ql@w3.org>
> Sent: Tuesday, April 26, 2005 10:05 PM
> Subject: FW: Re: Variable references in path expressions
> 
> 
> >
> > (Resending from the appropriate email address)
> >
> > Someone has corrected me off-list on part of my answer:
> >
> > >
> > > However, will
> > >
> > >     let
> > >       $a := (<a1/>, <a2/>, <a3/>),
> > >       $b := (<b1/>, <b2/>, <b3/>)
> > >     return
> > >       $a/$b
> > >
> > > return
> > >
> > >     (<b1/>, <b2/>, <b3/>, <b1/>, <b2/>, <b3/>, <b1/>, <b2/>,
<b3/>)
> > >
> > > because the expression bound to $b constructs unique elements
> > > each time it is evaluated?
> >
> > I answered incorrectly: Yes.
> >
> > I was thinking of a different case, $a/b() where the function b()
> returns
> > three elements. In that case, b() must be evaluated three times, and
> returns
> > three different elements each time. With a variable reference,
however,
> the
> > variable must be evaluated exactly once, and the same value is used
each
> > time. So the result is
> > (<b1/>, <b2/>, <b3/>) or some permutation thereof (since these
elements
> are
> > not in the same tree, their relative document order is
unpredictable).
> >
> > Michael Kay
> > http://www.saxonica.com/
> >
> >
> >
> >
> 
Received on Tuesday, 26 April 2005 15:49:16 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:17:17 UTC