Lists Home |
Date Index |
On Thu, 11 Apr 2002, Michael Kay wrote:
> > I have a question about view construction in xml.
> > Problem Setting
> > ===============
> > Given a XML database DB, and a query Q1, either XQuery or
> > XSLT, we refer
> > to the result of Q1(DB) (the result of running query Q1
> > against database
> > DB) as a view, say V, whose schema is Sv.
> In XQuery, the result of a query is not an XML document, it is a sequence of
> items, where each item may be either an atomic value or a node. It's
> meaningful to talk about the type of the result, but not about its schema.
> In XSLT, the result of a transformation is indeed an XML document. In
> general, though, the result document has no schema.
> > Question
> > ========
> > Suppose we have another query Q2 (either XQuery or XSLT) which is
> > formulated against schema Sv (the schema of the view V) and the
> > size of view V too big to fit in memory, my questions are:
> > 1) Is it possible that we evaluate Q2(V), (that is running Q2
> > against the
> > result of Q1(DB)), without materializing (or write back to
> > hard disk) the
> > result of Q1(DB)?
> In XSLT this is normal practice: see the JAXP interfaces, which allows a
> pipeline of transformations to be run as filters. However, although the
> intermediate result does not need to be written to disk, all existing
> processors require that it exists as a tree in memory.
Does it mean that if the tree (the intermediate result) is too big to fit
in the memory, then we have to write the tree back to harddisk first and
then start running query Q2? Or in other words, can we start runing query Q2
before the processing of Q1(DB) finish?
In relational database, since tuples are processed in pipeline, we can start
running Q2 without having the complete result of Q1(DB). I am afraid it is
not true in xml, right?
> For XQuery the same notion is likely to be supported - that the result of
> one query can be used as input to another - but the implementations and APIs
> aren't yet as advanced.
> > As we know, in relational database, Q2(V) can be evaluated without
> > materializing the view V. However, I am not sure if it is
> > still hold in
> > XML database.
> Actually, SQL has another interesting property, which as that Q1 and Q2 can
> be combined statically into a single query and optimized as a unit. I think
> XQuery will also have that property, because it is a fully compositional
> language. You can't to the same thing with XSLT, because template rules
> aren't fully compositional expressions in the same way.
> Michael Kay
> Software AG
> home: Michael.H.Kay@ntlworld.com
> work: Michael.Kay@softwareag.com
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
> The list archives are at http://lists.xml.org/archives/xml-dev/
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>