jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philipp Bunge <b...@crimson.ch>
Subject Re: JCR-SQL2 subtree query
Date Fri, 04 Dec 2009 09:12:55 GMT
Hi Wes

> I have a bit of a dilemma. I'm working with Jackrabbit 2.0b3 and
> trying to migrate to JCR2.0. However, since the XPATH query syntax is
> deprecated, I'm investigating how to go about writing queries in
> JCR-SQL2. Unfortunately, I haven't come up with many examples or
> tutorials for the new JCR-SQL2 syntax.

There really aren't many tutorial around as far as I know. I use the
railroad diagrams that Thomas Müller created quite a lot as a
reference however: http://www.h2database.com/jcr/grammar.html

> One of the scenarios that I'd like to use frequently is searching a
> subtree, i.e. starting at a particular node and searching all
> descendants for certain property values. This is trivial to accomplish
> in XPATH, but I can't figure out the correct (and efficient) way to do
> it using SQL2. Can any one help me out with an example?

You probably want something as follows:

SELECT * FROM [nt:unstructured]
  WHERE ISDESCENDANTNODE([/the/particular/node])
  AND yourproperty = "foo"


Cheers,
Philipp

Mime
View raw message