W3C home > Mailing lists > Public > www-ql@w3.org > October to December 2005

RE: [bdbxml] xquery puzzle

From: Michael Kay <mhk@mhk.me.uk>
Date: Sat, 10 Dec 2005 15:37:33 -0000
To: "'L.G. Meredith'" <lgreg.meredith@gmail.com>, <www-ql@w3.org>
Message-ID: <E1El6n9-0000IY-BT@lisa.w3.org>

Suppose we have two predicates, p1, p2, holding of collections of elements
and
we have a collection, <coll><e0/>...<en/></coll>. Is it possible to write an

xquery that returns all the splittings of the collection such that the
collection of the left part of the split satisfies p1 and the collection of
the
right part of the split satisfies p2. So, if we name the function with the 
semantics of xquery we seek, decompose, then we have

decompose(p1,p2,<coll><e0/>...<en/></coll>)  
 
Firstly, XQuery does not support higher-order functions: predicates
therefore cannot be passed as arguments to a function.
 
Secondly, it looks to me as if <coll> is an element, not a collection of
elements.
 
You seem to be talking about operations like "union" in a way that has no
relationship to the XQuery operator of the same name.
 
Michael Kay
http://www.saxonica.com/
 
 =

<coll>
    <coll>
       <coll><ei0/>...<eim0/></coll> 
       <coll><ej0/>...<ejn0/></coll>
    </coll>
    ...
    <coll>
       <coll><eiN/>...<eimN/></coll>
       <coll><ejN/>...<ejnN/></coll> 
    </coll>
</coll>

each element of the outermost collection is a pair of collections such that

1. the total set of elements of the pair unions to the original collection,
e.g.
   <coll><ei0/>...<eim0/></coll> U <coll><ej0/>...<ejn0/></coll> 
    = <coll><e0/>...<en/></coll> (ignoring order)
2. the pairs are disjoint, e.g.
   <coll><ei0/>...<eim0/></coll> /\ <coll><ej0/>...<ejn0/></coll> = <coll/>
(the
empty collection)
3. the first part of the pair satisfies the predicate p1 and the second
satisfies p2; e.g.
   <coll><ei0/>...<eim0/></coll> satisfies p1; and
   <coll><ej0/>...<ejn0/></coll> satisfies p2. 

i'm not worried about complexity, right now. i expect it to be horrible. But
i
am worried about doing this in `memory' as opposed to in `the db'. If i have
to
drag everything into memory, then i may well write my own query language
that 
has this sort of thing as a primitive.

Best wishes,

--greg



------------------------------------------
To remove yourself from this list, send an
email to xml-unsubscribe@sleepycat.com



-- 
L.G. Meredith

505 N 72nd St
Seattle, WA 98103

+1 206.650.3740 
Received on Saturday, 10 December 2005 15:37:54 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:43:44 UTC