Fwd: [bdbxml] xquery puzzle

All,

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

<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 Friday, 9 December 2005 21:47:58 UTC