XQuery Expression Context issues

Dear WG,

Some questions/comments on the Expression Context of XQuery as defined
in section 2.1.1. of the Dec 2001 XQuery WD.

- I think you would help writers of ad-hoc queries and hinder nobody by
creating an initial set of in-scope namespaces (that can be overridden
in the query prolog using namespace declarations), containing the
prefixes "xs", "xf" and "xml" with obvious URIs.  ("xml" should be fixed
as specified in the Namespaces spec.)

- Is there a default namespace for datatype names?

- In-scope collations are specified to be a QName.  The F&O document
specifies collations as anyURI.

- The description of a collation mentions a function that sorts sets of
strings but gives no restriction on that function.  This even allows a
function that would sort a subset of a set of strings in a completely
different way than they are sorted when sorting the superset.  It may be
better to say that a collation is a strict weak ordering on strings.

- The context mentions a default collation, but there is no way for a
user to specify it.  I suggest that you define such a way in the query
prolog.

- A variable is a QName.  Does this really mean that variable names are
compared with namespace-uri and localname instead of textually?  This
seems like overkill to me.  But if so, do they have a default namespace?

- "The focus for the outermost expression is supplied by the environment
..."  What does this mean?  That it is implementation defined?  Can I
(as an implementer) return an error when ".", "position()" or "last()"
are used as top-level expressions or do I have to give them some initial
value?

- Is the focus passed through calls to user defined functions?  I
certainly hope not, because it makes separate compilation and
optimization of user defined functions much more difficult.

- The description of context item fails to mention that it is also set
by "sortby".

- In XPath 1.0, the context position and size are only set by '[]', not
by '/'.

- I would like to add my support to issue 217.  The definition of
context document makes it very difficult to know at query analysis time
to which document an absolute path expression refers.  Not only can it
change, you cannot even determine statically which expression sets the
context document, because it is undecidable in general whether the
context item is part of a tree with a document node as root.  Not
knowing the document that a path expression refers to makes creating a
good query plan much harder.

I realize that this specification is based on the XPath 1.0 description.
However, within XPath 1.0, there was no way to refer to another
document, so every occurrence of '/' as a root had to refer to the same
document.  I would very much prefer if this was also the case in XQuery.

Regards,
Bas de Bakker
X-Hive Corporation

Received on Thursday, 3 January 2002 05:51:58 UTC