On Thu, Aug 19, 2010 at 10:48, Will Scheidegger <[email protected]> wrote: > I have "room" nodes with "calendar" subnodes (i.e. reservations). Now I would > like to find all rooms not having any reservations between x and y. The > opposite is fairly easy: > > /jcr:root/path/to/rooms/element(*,rooms)/reservations/element(*,reservation)[...@endtime > > xs:dateTime(x) and @startTime < xs:dateTime(y)] > > Is there any efficient way to reverse this?
Plain de Morgan's Law applied, I think: ! (end > x and start < y) = !(end > x) or !(start < y) = end <= x or start >= y Hence: /jcr:root/path/to/rooms/element(*,rooms)/reservations/element(*,reservation)[...@endtime <= xs:dateTime(x) or @startTime >= xs:dateTime(y)] This has the same level of efficiency as the other query. Regards, Alex -- Alexander Klimetschek [email protected]
