You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Marcel Reutegger <ma...@gmx.net> on 2006/07/03 12:14:48 UTC

Re: xpath, sql queries and nested properties

Hi Piotr,

Piotr Maj wrote:
> Query query = queryManager.createQuery("select * from nt:file where 
> jcr:content.pm:description like 'To%'", Query.SQL);
 > [...]
> And I get nothing. The question is: how should the query look like?

Jackrabbit currently does not support 'nested' properties in the where 
clause. This is tracked as an enhancement in jira: 
http://issues.apache.org/jira/browse/JCR-247

> Another question is how should the query look like I wanted to find
> all nt:resource nodes where one of nested pm:annotation.pm:content
> property is equal to 'xxx'?

When this feature is implemented it will probably look different than: 
jcr:content.pm:description because the dot is a valid name character. 
maybe it will look like this:
... where jcr:content/pm:description = 'xxx'

but this is not yet defined.

> I'd appreciate if someone could write for me an SQL version of such
> query as well as XPath one and explain to me why the query I used
> is wrong?

In XPath syntax your query would look like this:
//element(*, nt:file)[jcr:like(jcr:content/@pm:description, 'To%')]

But as mentioned before this is not yet possible because of JCR-247.

regards
  marcel

Re: xpath, sql queries and nested properties

Posted by Piotr Maj <pm...@jcake.com>.
On Mon, 03 Jul 2006 12:14:48 +0200, Marcel Reutegger  
<ma...@gmx.net> wrote:

> Jackrabbit currently does not support 'nested' properties in the where  
> clause. This is tracked as an enhancement in jira:  
> http://issues.apache.org/jira/browse/JCR-247

Marcel,

thank you for your answer. I've added myself to the list of watchers.

-- 
best wishes
piotr maj