You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Tamara Coutinho <tc...@nexen.com.br> on 2008/04/14 11:36:54 UTC

How to filter a query by attributes from children nodes

I would like to know wether exists a way to filter a parent node by a 
child attribute.

E.g. : /jcr:root/site/Notícias//element(*,mtx:content) this query 
returns parent nodes, I would like to filter the query using 
mpt:fileGroup attribute from children nodes mtx:file.

Thanks in advance,

Tamara Coutinho.

Re: How to filter a query by attributes from children nodes

Posted by Tamara Coutinho <tc...@nexen.com.br>.
Marcel Reutegger escreveu:
> Hi Tamara,
>
> Tamara Coutinho wrote:
>> I would like to know wether exists a way to filter a parent node by a 
>> child attribute.
>>
>> E.g. : /jcr:root/site/Notícias//element(*,mtx:content) this query 
>> returns parent nodes, I would like to filter the query using 
>> mpt:fileGroup attribute from children nodes mtx:file.
>
> I'm not sure I understand your node type model, but that would be 
> something like:
>
> /jcr:root/site/Notícias//element(*,mtx:content)[*/@jcr:primaryType = 
> 'mtx:file' and */@mpt:fileGroup = 'some value']
>
> or if mtx:file is the name of a node:
>
> /jcr:root/site/Notícias//element(*,mtx:content)[mtx:file/@mpt:fileGroup 
> = 'some value']
>
> for further questions please use the user list 
> (users@jackrabbit.apache.org)
>
> regards
>  marcel
>
>
Marcel,

Thank you!!

Tamara Coutinho






Re: How to filter a query by attributes from children nodes

Posted by Marcel Reutegger <ma...@gmx.net>.
Hi Tamara,

Tamara Coutinho wrote:
> I would like to know wether exists a way to filter a parent node by a 
> child attribute.
> 
> E.g. : /jcr:root/site/Notícias//element(*,mtx:content) this query 
> returns parent nodes, I would like to filter the query using 
> mpt:fileGroup attribute from children nodes mtx:file.

I'm not sure I understand your node type model, but that would be something like:

/jcr:root/site/Notícias//element(*,mtx:content)[*/@jcr:primaryType = 'mtx:file' 
and */@mpt:fileGroup = 'some value']

or if mtx:file is the name of a node:

/jcr:root/site/Notícias//element(*,mtx:content)[mtx:file/@mpt:fileGroup = 'some 
value']

for further questions please use the user list (users@jackrabbit.apache.org)

regards
  marcel