You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by gft <gi...@gmail.com> on 2010/06/04 09:22:34 UTC

strange query

I'm working with jackrabbit 2.0.1

I have the following query (that I thought should be correct):
//element(*, xyz:tag)[@xyz:owner = '%s' and jcr:deref(@xyz:documentRef,
'*')/@xyz:public = 'true']

where xyz is a namespace I defined and xyz:documentRef's type is 'Reference'

I get an error during the compilation of the query


I found that this other query works:
//element(*, xyz:tag)[@xyz:owner = '%s'][jcr:deref(@xyz:documentRef,
'*')/@xyz:public = 'true']

but I don't find any documentation about this feature.

can somebody help me? why it works?

thank you 
-- 
View this message in context: http://jackrabbit.510166.n4.nabble.com/strange-query-tp2242779p2242779.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: strange query

Posted by Alexander Klimetschek <ak...@day.com>.
On Fri, Jun 4, 2010 at 08:22, gft <gi...@gmail.com> wrote:
>
> I'm working with jackrabbit 2.0.1
>
> I have the following query (that I thought should be correct):
> //element(*, xyz:tag)[@xyz:owner = '%s' and jcr:deref(@xyz:documentRef,
> '*')/@xyz:public = 'true']

I guess you have to wrap the jcr:deref part in brackets:

//element(*, xyz:tag)[@xyz:owner = '%s' and
(jcr:deref(@xyz:documentRef, '*')/@xyz:public = 'true')]


> where xyz is a namespace I defined and xyz:documentRef's type is 'Reference'
>
> I get an error during the compilation of the query
>
>
> I found that this other query works:
> //element(*, xyz:tag)[@xyz:owner = '%s'][jcr:deref(@xyz:documentRef,
> '*')/@xyz:public = 'true']

Multiple predicates ([...]) are possible in Xpath and they are
combined with AND, eg. "[a][b]" is the same as "a AND b".

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com