You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Robin Wyles <ro...@jacaranda.co.uk> on 2011/07/21 11:57:08 UTC

jcr:deref predicates and child nodes

Hi All,

I'm having some issues using jcr:deref within predicates - I need to perform queries like the following:

 //element(*, nt:unstructured)[(jcr:deref(@someprop, '*')/somechildren/*/@otherprop = 'somevalue')]

This query returns no nodes, whereas this query works just fine:

 //element(*, nt:unstructured)[(jcr:deref(@someprop, '*')/@otherprop = 'somevalue')]

Is my query syntax incorrect, or is it simply the case that the childnode axis of the de-referenced node is not available, or only a certain depth of that axis is available?

I've had a look at JCR-977 [1] and the supplied patch, but cannot tell whether this sort of query should be supported. None of the tests seem to cover it....

I'm also trying to make queries like the following:

 //element(*, nt:unstructured)[jcr:contains(jcr:deref(@someprop, '*')/@otherprop, 'somevalue')]

This throws the following exception...

javax.jcr.query.InvalidQueryException: Unsupported location for jcr:deref()

I see there was a discussion on the mailing list [2] relating to JCR-977 and jcr:contains, and I also see that some tests for this type of query are commented out in the supplied patch - so I take it this was never implemented.

If anyone could provide any info as to how I can get the above working, either by using one of the other query languages, or by creating a patch myself I'd appreciate it!

Thanks,

Robin

[1] https://issues.apache.org/jira/browse/JCR-977
[2] http://jackrabbit.510166.n4.nabble.com/jcr-deref-in-predicate-with-jcr-contains-td544921.html