jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Reutegger <marcel.reuteg...@gmx.net>
Subject Re: union queries
Date Fri, 28 Apr 2006 16:01:27 GMT
David Kennedy wrote:
> It appears that xpath union queries are not supported, but it also appears 
> as though this cannot be accomplished by SQL either.  I get exceptions 
> stating an invalid path clause.  My queries look like this:
> 
> 
> (s1)      statement = "/jcr:root/a/b/c/d union /jcr:root/a/e/f"
> s1 will execute without exception, however will return 0 hits, but the 
> nodes exist in the repository.  Is xpath union supported with the 
> jackrabbit implementation?

no, jackrabbit currently does not support the union operator. but this 
is certainly an enhancement that we will implement in the near future.
See also the following thread:
http://thread.gmane.org/gmane.comp.apache.jackrabbit.devel/6476

> (s2)      statement = "SELECT * FROM nt:base WHERE jcr:path = 
> '/jcr:root/a/b/c/d' OR jcr:path = '/jcr:root/a/e/f'"
> s2 will fail with javax.jcr.query.InvalidQueryException: Invalid 
> combination of jcr:path clauses which results from an 
> IllegalArgumentException because there is no merging path (%).  Why is a 
> merging path necessary if I am using '='? 

the sql query parser basically tries to create a xpath equivalent query 
from the sql statement. that's why it tries to merge multiple jcr:path 
clauses into a unified one.
in the end jackrabbit only implements one abstract query tree which is 
more or less syntax independent. though it is very similar to XPath. See 
also:
http://jackrabbit.apache.org/doc/arch/operate/query.html

> (s3)      statement = "SELECT * FROM nt:base WHERE jcr:path LIKE 
> '/jcr:root/a/b/c/d' OR jcr:path LIKE '/jcr:root/a/e/f'"
> s2 will fail with javax.jcr.query.InvalidQueryException: Invalid 
> combination of jcr:path clauses which results from an 
> IllegalArgumentException because there is no merging path (%). 
> 
> (s4)      statement = "SELECT * FROM nt:base WHERE jcr:path = 
> '/jcr:root/a/b/c/d' OR jcr:path LIKE '/jcr:root/a/e/f/%'"
> s2 will fail with javax.jcr.query.InvalidQueryException: Invalid 
> combination of jcr:path clauses which results from an 
> NoSuchElementException because the two specified paths are not sharing the 
> same path.  Similar failure if I use LIKE for both and wildcard both paths 
> (/%).

the reason why s3 and s4 fail are the same as above.

> Why don't any of these work?  Is xpath union expected to be supported?

not yet, but I hope we can implement it in the near future.

regards
  marcel

Mime
View raw message