jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting" <jukka.zitt...@gmail.com>
Subject Re: How to select nodes that do NOT have a given child in JackRabbit
Date Wed, 26 Jul 2006 17:47:45 GMT
Hi,

On 7/26/06, Shane O'Sullivan <shaneosullivan1@gmail.com> wrote:
> I need to be able to run an XPATH query on jackrabbit that will allow me to
> select all nodes that do not have a particular child.

You'd need the child axis support as requested in JCR-247 to do that
with XPath. It's not required by the JSR-170 nor supported by
Jackrabbit, so the only way to achieve something like that is with a
workaround. Some ideas:

* Use an explicit property to flag the presence or absence of the
child nodes you're interested. Whenever you add or remove such child
nodes, you also update the flag property. You can use observation to
trigger the update to avoid mixing this workaround with normal code.

* Use a partial XPath query (get all "A" nodes) and filter the results
with Node.hasNode("B").

* Vote for JSR-247 or contribute a patch that adds this functionality.
This is likely quite hard, as the current Jackrabbit query index isn't
really optimized for such access.

BR,

Jukka Zitting

-- 
Yukatan - http://yukatan.fi/ - info@yukatan.fi
Software craftsmanship, JCR consulting, and Java development

Mime
View raw message