In XQuery 3.0 for $review in collection($sp:reviewsColl)//review group by $review/@person where count($review) = 1 return f:render($review)
Michael Kay Saxonica On 6 Jan 2014, at 10:58, Ihe Onwuka <[email protected]> wrote: > Let me give a bit of background to the use case motivating the question. > > I want to find all reviews written by people that only wrote 1 review. I wrote > > collection($sp:reviewsColl)/descendant::reviews[not(review[2])] > > but reviews has a @person attribute and that person may have 1 or more > reviews in another collection - so that doesn't work. > > The thing that seemed most natural to fix this was to supplement the > predicate to say there should be no sibling review by the same > reviews/@person. > > > > > > On Sun, Jan 5, 2014 at 8:54 PM, Michael Kay <[email protected]> wrote: > > On 5 Jan 2014, at 16:50, Ihe Onwuka <[email protected]> wrote: > > > If x is the document element of a document in a collection, is it the > > sibling of y that is the document element of another document in the same > > collection? > > No. > > > > If not why not? > > "Why" questions are very difficult to answer. Do you want a historically > accurate answer (was the question debated at a WG meeting, who argued which > position, how did the vote go, and why did individual members vote as they > did?) - because it's very rarely possible to give one. Or do you want a > post-hoc justification (can you think of a sensible reason that anyone might > have designed it this way?) > > One post-hoc justification is that collections are unordered, whereas axes > are always ordered. > > Another is that documents may belong to more than one collection. > > Michael Kay > Saxonica > >
_______________________________________________ [email protected] http://x-query.com/mailman/listinfo/talk
