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

nodes or atomic values in predicate steps

From: Philippe Michiels <philippe.michiels@ua.ac.be>
Date: Thu, 17 Mar 2005 10:48:57 +0100
To: www-ql@w3.org
Message-Id: <200503171048.57328.philippe.michiels@ua.ac.be>

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 is 
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 Dynamic 
Context. The sequences resulting from all the evaluations of E2 are combined 
as follows:

(1) If every evaluation of E2 returns a (possibly empty) sequence of nodes, 
these sequences are combined, and duplicate nodes are eliminated based on 
node identity. The resulting node sequence is returned in document order.

(2) If every evaluation of E2 returns a (possibly empty) sequence of atomic 
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 raised.[err:XP0018].

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 09:49:01 UTC

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