W3C home > Mailing lists > Public > www-ql@w3.org > January to March 2005

Re: nodes or atomic values in predicate steps

From: Jerome Simeon <simeon@us.ibm.com>
Date: Thu, 17 Mar 2005 11:53:27 -0500
To: Philippe Michiels <philippe.michiels@ua.ac.be>
Cc: www-ql@w3.org
Message-ID: <OFCF08843A.8C74ED6F-ON85256FC7.005AEB1B-85256FC7.005CC804@us.ibm.com>


The normalization rule you mention applies only to ForwardSteps, which 
return a sequence of nodes.

There is another normalization rule which applies to PrimaryExpr (See 
4.3.2 Filter Expressions):

[PrimaryExpr PredicateList "[" Expr "]"]Expr
let $fs:sequence := [PrimaryExpr PredicateList]Expr return
let $fs:last := fn:count($fs:sequence) return
for $fs:dot at $fs:position in $fs:sequence return
   if [Expr]Predicates then $fs:dot else ()

Primary expressions can return any kind of items, and that rule does not 
to sort by document order and remove duplicates.

- Jerome

www-ql-request@w3.org wrote on 03/17/2005 04:48:57 AM:

> Hi,
> I am confused by the normalization of path expressions that have end 
with a 
> predicate step (e.g. doc("x")/a/b[c]
> The normalization of filter expressions in the FS, enforces the result 
of the 
> step to be a node sequence (because of the fs:distinct-doc-order call).
> For instance, for a numerical predicate it goes as follows:
> [ForwardStep PredicateList "[" Numeric "]"]Expr
>   ==
>   let $fs:sequence := 
> fs:apply-ordering-mode(fs:distinct-doc-order( [ForwardStep 
> PredicateList]Expr )) return
>   fn:subsequence($fs:sequence,Numeric,1)
> But from the XPath 2.0 draft I understand that the result can be a 
> sequence of 
> nodes or a sequence of atomic values:
> from (http://www.w3.org/TR/xpath20/#id-path-expressions)
> Each operation E1/E2 is evaluated as follows: Expression E1 is 
evaluated, and 
> if the result is not a (possibly empty) sequence of nodes, a type error 
> raised. Each node resulting from the evaluation of E1 then serves in 
turn to 
> provide an inner focus for an evaluation of E2, as described in 2.1.2 
> Context. The sequences resulting from all the evaluations of E2 are 
> as follows:
> (1) If every evaluation of E2 returns a (possibly empty) sequence of 
> these sequences are combined, and duplicate nodes are eliminated based 
> node identity. The resulting node sequence is returned in document 
> (2) If every evaluation of E2 returns a (possibly empty) sequence of 
> values, these sequences are concatenated, in order, and returned.
> (3) Otherwise (that is, if the multiple evaluations of E2 return at 
least one 
> node and at least one atomic value), a type error is 
> I'm wondering wheather the distinct-doc-order call in the FS should 
> in fact be 
> a distinct-doc-order-or-atomic-sequence call.
> Thanks,
> Ph
> -- 
> Philippe Michiels
> Universiteit Antwerpen
> ADReM (Advanced Database Research and Modelling)
> http://www.adrem.ua.ac.be/~michiels
Received on Thursday, 17 March 2005 16:54:00 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:43:43 UTC