You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Dave Brosius <db...@mebigfatguy.com> on 2008/03/26 06:49:11 UTC

Path Constrained queries

I am interested in doing descendant based patch constrained queries.


I read section "6.6.3.4 Path Constraint", and infer that in order to specify 
path constraints, you must know the full path to the node at which you are 
constraining. These seems odd to me. Why doesn't jcr follow the pattern set 
by xpath, that being the availability of relative and absolute xpaths 
(queries).


Why doesn't the query object have a


query.setContextNode(node), which specifies from which node the query 
begins?



How does one determing the absolute path of a node that you have retreived 
by uuid? Do we really need to do a recursive getParent search to the root? 
Or, do i really need to store the absolute path of each node in a node 
property? This seems really painful. I see the property jcr:path, but this 
is apparently only a pseudo property available only from within the query 
itself.


So the question is how do people do a descendent path constraining query 
when you want to start the search at any arbitrary node that is retrieved by 
UUID? 


RE: Path Constrained queries

Posted by Ard Schrijvers <a....@onehippo.com>.
> 
> Wow that was stupendously stupid on my part. Thanks for 
> helping idiots too.

:-)

>

Re: Path Constrained queries

Posted by Dave Brosius <db...@mebigfatguy.com>.
Wow that was stupendously stupid on my part. Thanks for helping idiots too.

----- Original Message ----- 
From: "Ard Schrijvers" <a....@onehippo.com>
To: <us...@jackrabbit.apache.org>
Sent: Wednesday, March 26, 2008 2:28 AM
Subject: RE: Path Constrained queries


Hello Dave,

> 
> How does one determing the absolute path of a node that you 
> have retreived 
> by uuid? Do we really need to do a recursive getParent search 
> to the root? 

No, just use node.getPath()

> Or, do i really need to store the absolute path of each node 
> in a node 
> property? This seems really painful. I see the property 
> jcr:path, but this 
> is apparently only a pseudo property available only from 
> within the query 
> itself.

Obviously, you don't need this, and it would be very much against the
architecture of Jackrabbit: A node does not know its path/location by
itself: all it knows, are its children and its parent. The hierarchical
structure is derived from this. 

> 
> 
> So the question is how do people do a descendent path 
> constraining query 
> when you want to start the search at any arbitrary node that 
> is retrieved by 
> UUID? 

Think this one is clear with the getPath, right?

Regards Ard


RE: Path Constrained queries

Posted by Ard Schrijvers <a....@onehippo.com>.
Hello Dave,

> 
> How does one determing the absolute path of a node that you 
> have retreived 
> by uuid? Do we really need to do a recursive getParent search 
> to the root? 

No, just use node.getPath()

> Or, do i really need to store the absolute path of each node 
> in a node 
> property? This seems really painful. I see the property 
> jcr:path, but this 
> is apparently only a pseudo property available only from 
> within the query 
> itself.

Obviously, you don't need this, and it would be very much against the
architecture of Jackrabbit: A node does not know its path/location by
itself: all it knows, are its children and its parent. The hierarchical
structure is derived from this. 

> 
> 
> So the question is how do people do a descendent path 
> constraining query 
> when you want to start the search at any arbitrary node that 
> is retrieved by 
> UUID? 

Think this one is clear with the getPath, right?

Regards Ard


Re: Path Constrained queries

Posted by Alexander Klimetschek <ak...@day.com>.
The normal solution would be - as you already noted - to start the  
xpath query with baseNode.getPath(). You are right that resolving the  
parent path is not needed in the overall use case "search below a  
given node", but it shouldn't be a performance killer, since the path  
to the root normally consists of only a handful nodes. Or do you see a  
performance issue in your environment?

Regards,
Alex


Am 26.03.2008 um 06:49 schrieb Dave Brosius:
> I am interested in doing descendant based patch constrained queries.
>
>
> I read section "6.6.3.4 Path Constraint", and infer that in order to  
> specify path constraints, you must know the full path to the node at  
> which you are constraining. These seems odd to me. Why doesn't jcr  
> follow the pattern set by xpath, that being the availability of  
> relative and absolute xpaths (queries).
>
>
> Why doesn't the query object have a
>
>
> query.setContextNode(node), which specifies from which node the  
> query begins?
>
>
>
> How does one determing the absolute path of a node that you have  
> retreived by uuid? Do we really need to do a recursive getParent  
> search to the root? Or, do i really need to store the absolute path  
> of each node in a node property? This seems really painful. I see  
> the property jcr:path, but this is apparently only a pseudo property  
> available only from within the query itself.
>
>
> So the question is how do people do a descendent path constraining  
> query when you want to start the search at any arbitrary node that  
> is retrieved by UUID?

--
Alexander Klimetschek
alexander.klimetschek@day.com