RE: Concern: XQuery <> valid XML

Michael,

> Ingo Macherius <macherius@darmstadt.gmd.de> wrote:
> >
> > If XQuery was XML itself, more structured construction becomes feasible,
> > e.g. by using the DOM API or XSLT.
>
> When it comes to query construction, XML-ized syntax is a
> hindrance.

This largely depends on how you consider XQuery expressions to be
constructed.

If you start at the XML Query Algebra level, you'll find a functional
expression language with strong typing. Functional languages, e.g.
XML-Query-Algebra or XSLT, inherently are constructed by nesting
subexpressions into more complex expressions. And that's what XML is all
about: nesting. Thus XML syntax is natural if you approach from
compositional assembly of a query from subexpressions. Any syntax different
from XML has to come up with a solution for nesting - which I considered
solved by XML already.

A nice side effect is the ease of implementation for XQuery processors,
which else would require three sub-parsers: one for XPath, one for XQuery
expressions and one for XML construction sections. This makes for a large
and clumsy grammar (and thus code), which is an issue for e.g. small
devices. XML syntax also yields extensibility of XQuery, as no keywords need
to be reserved: namespaces do this job then.

On the other hand, writing queries by hand is more easily done if you have a
more terse language, such as sketched by the recent XQuery working draft.
However, this becomes less striking if you actually use an XQuery expression
to construct or compose a result using a Schema significantly different from
what your source(s) are structured. Remember that XML-Queries, unlike
SQL-queries, produce results structured and independently of their sources'
structure, not mere flat tables. You will get large "RETURN" sections which
almost look like XML documents. This forbids complex "ad-hoc" queries in
FLWR-syntax-XQuery using the same arguments you gave for the XML syntax.

> However, one shouldn't confuse the rather trivial issue of producing an
> alternative XML-style syntax and the more basic problem of fitting the
> different components of the language into a coherent framework.

I've discussed XQuery syntax with quite a few people and found good
arguments for both the FLWR and the XML-form. And don't forget they both
share some XPath parts, which are a lightweight query language themselves.
And this is exactly what the working group's requirements document says: let
there be more then one syntax if requested. I think there is demand for an
XML-, a FLWR-like and and XPath-like version. Personally I will surely
prefer XML syntax, but this seems to be a matter of taste, background and
work experience.

Regards,
	Ingo Macherius

Received on Wednesday, 28 February 2001 14:53:42 UTC