You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by "Craig S. Dickson" <cr...@thejuggernautgroup.com> on 2011/04/12 21:02:18 UTC
Query for nodes based on presence of descendant nodes
Hi,
I would like to query for nodes based on the presence of a descendant node. In psuedo code, something like:
select * from nt:base where hasDescendant('./relative/path/to/descendant/node')
I am trying to create the query with SQL2 and I can see the ischild() and isdescendant() constraints, but I am not clear how to use them to query for and return the parent/ancestor nodes, instead of the child/descendant nodes.
Is this possible? I would prefer and SQL2 answer, but can use QOM or XPath if necessary.
Thanks in advance.
Craig
Re: Query for nodes based on presence of descendant nodes
Posted by Alex Parvulescu <al...@gmail.com>.
Hi Craig,
I don't think sql2 has something like that.
could you be a bit more specific with your usecase? I can't figure out what
you are trying to do :)
are you looking for a certain parent of a node? or parents of node types?
wouldn't it be easier to have a property on the parent node to indicate the
presence of certain child node(s) / (types)?
alex
On Tue, Apr 12, 2011 at 9:02 PM, Craig S. Dickson <
craig@thejuggernautgroup.com> wrote:
> Hi,
>
> I would like to query for nodes based on the presence of a descendant node.
> In psuedo code, something like:
>
> select * from nt:base where
> hasDescendant('./relative/path/to/descendant/node')
>
> I am trying to create the query with SQL2 and I can see the ischild() and
> isdescendant() constraints, but I am not clear how to use them to query for
> and return the parent/ancestor nodes, instead of the child/descendant nodes.
>
> Is this possible? I would prefer and SQL2 answer, but can use QOM or XPath
> if necessary.
>
> Thanks in advance.
>
> Craig
>
>
RE: Query for nodes based on presence of descendant nodes
Posted by Tomás Temprano <tt...@Toyota.com.ve>.
I'm not sure I fully understand your requrirement but you could query the descendant node and use node.getParent() to get its parent...
-----Mensaje original-----
De: Craig S. Dickson [mailto:craig@thejuggernautgroup.com]
Enviado el: Martes, 12 de Abril de 2011 02:32 p.m.
Para: users@jackrabbit.apache.org
Asunto: Query for nodes based on presence of descendant nodes
Hi,
I would like to query for nodes based on the presence of a descendant node. In psuedo code, something like:
select * from nt:base where hasDescendant('./relative/path/to/descendant/node')
I am trying to create the query with SQL2 and I can see the ischild() and isdescendant() constraints, but I am not clear how to use them to query for and return the parent/ancestor nodes, instead of the child/descendant nodes.
Is this possible? I would prefer and SQL2 answer, but can use QOM or XPath if necessary.
Thanks in advance.
Craig
**************************************************************************************
La informacion contenida en este mail es de caracter confidencial o para uso exclusivo
del Grupo TOYOTA DE VENEZUELA en sus procesos y actividades de negocio. Los puntos de
vista u opiniones presentes en el mismo son responsabilidad del remitente y no
representan una posicion formal del grupo TOYOTA DE VENEZUELA (TOYOTA DE VENEZUELA, C.A.
o TOYOTA INDUSTRIAL DE VENEZUELA, C.A.). Si UD. no es el destinatario o recibio esta
informacion por error, agradecemos destruirla de inmediato y notificar al remitente por
esta misma via, debido a que su copia, distribucion o uso esta reservado solo para
personas autorizadas.
***************************************************************************************
The information contained in this mail is strictly confidential or for the exclusive use
by TOYOTA DE VENEZUELA Group in its process and business activities. The points of view
or present opinions contained in the mail, are the senders responsibility and dont
represent a formal opinion of TOYOTA DE VENEZUELA Group (TOYOTA DE VENEZUELA, C.A. or
TOYOTA INDUSTRIAL DE VENEZUELA, C.A.) If you are not the destined user or received this
information by mistake, we appreciate if you destroy it inmediately and notify the
sender by this same way, because its copying, distributing and use is allowed only for
authorized people.