jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@day.com>
Subject Re: select all nodes not having certain subnodes?
Date Thu, 19 Aug 2010 13:09:30 GMT
On Thu, Aug 19, 2010 at 14:57, Will Scheidegger <willscheidegger@mac.com> wrote:
> Thanks Alex for the help!
> If it was only that easy... but unfortunately it's not. I need to find all rooms not
having a reservation subnode which touches the specified timespan, not all rooms which have
reservations for some other time than the one specified.

Ah, I see, rooms can have multiple reservations, which makes sense ;-)

> Your query would not return any room not having any reservation or it would also return
any room having a reservation outside of the specified timespan ignoring the fact that it
also might have one in that timespan.
> So what I really would need would be a query like
> /jcr:root/path/to/rooms/element(*,rooms)[count(/reservations/element(*,reservation)[@endTime
> xs:dateTime(x) and @startTime < xs:dateTime(y)]) == 0]
> but afaik
> - the count() function is not implemented by Jackrabbit
> - XPaht does not allow "subqueries" like this

Yes, I think you won't be able to do such a query with JCR Xpath. It
might be possible with JCR 2.0 SQL2's join feature. Otherwise you have
to do that join yourself by doing multiple queries, ie. find all rooms
first and take out all that have a reservation for the given time


Alexander Klimetschek

View raw message