RE: [bdbxml] xquery puzzle

Suppose we have two predicates, p1, p2, holding of collections of elements
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
right part of the split satisfies p2. So, if we name the function with the 
semantics of xquery we seek, decompose, then we have

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
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


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,
   <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/>
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
am worried about doing this in `memory' as opposed to in `the db'. If i have
drag everything into memory, then i may well write my own query language
has this sort of thing as a primitive.

Best wishes,


To remove yourself from this list, send an
email to

L.G. Meredith

505 N 72nd St
Seattle, WA 98103

+1 206.650.3740 

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