RE: XQuery vs XML Query Algebra

> -----Original Message-----
> From: www-ql-request@w3.org [mailto:www-ql-request@w3.org]On Behalf Of
> Michael Dyck
> Sent: Samstag, 3. Marz 2001 07:18
> To: www-ql@w3.org
> Subject: XQuery vs XML Query Algebra
>
>
> Reading through the XQuery Semantics, I was struck by how similar
> XQuery is
> to the XML Query Algebra -- often, the mapping is just a trivial change of
> syntax.

Good observation. I think the similarity is by design rather than
by accident. The algebra and XQuery work on the same datamodel,
respond to the same set of functional requirements,
are both functional, closed (from forests of XML fragments to
to forests of XML fragments) and fully compositional. If this
does not already sufficiently narrow the design space, the
WG's general strive for consensus certainly does.

> So that got me wondering: if we have the Algebra, why do we need
> XQuery?

The algebra and XQuery tackle the design space from different angles.

The main goal of the algebra working draft is to provide a
formal framework for specifying the dynamic and static
(type) semantics of the query language(s). To this end you
typically want to fit the number of built-in operators,
for which you need to provide a formal semantics, on one slide.
Concrete syntax is not the primary concern of the algebra,
although I'd like to point out that there was no concious effort
to make it unparsable/unreadable, e.g., by using greek letters,
multiple levels of subscripts, list comprehension, or other beloved
devices of "mathematical" specification.

Some of the additional goals of XQuery are
(see http://www.w3.org/TR/xquery/#section-Introduction) are
conciseness and understandibility, and human readability, even
for rather complex queries. Thus concrete syntax IS a primary
concern of the XQuery working draft - focussing on the first part of
requirement 3.2.1 (Query Language Syntax): "The XML Query Language
MAY have more than one syntax binding. One query language syntax
MUST be convenient for humans to read and write. One query language
syntax MUST be expressed in XML in a way that reflects the underlying
structure of the query." Granted, convenience, understandability etc.
are all rather subjective features - as we have seen on various
mailing lists;).

> Or, to put it another way, does XQuery fulfill the XML Query
> Requirements any better than the Algebra would?

As pointed out above, the goals of the XQuery WD, and the
the goals of the XML Query Algebra WD are complementary, so
the question of which is "better" is hard to ask/answer. But indeed the
more they agree syntax wise without compromising their purpose
(readability vs. straightforward formalizability) the better.

>
> Not contentious, just curious,
> -Michael Dyck
>
Hope this clarifies a bit,

Peter

(speaking for myself).

Received on Saturday, 3 March 2001 06:45:06 UTC