[ http://issues.apache.org/jira/browse/JCR-578?page=all ]

Jukka Zitting updated JCR-578:
------------------------------

    Affects Version/s: 1.1
             Priority: Minor  (was: Critical)

"A and B or C" seems ambiguous to me (what's the precedence of and/or), so 
downgrading this from Critical to a Minor issue.

It looks like the query parser is just folding a X1 o X2 o ... o Xn sequence to 
o(X1, X2, ..., X2)  and incorrectly treats "and" and "or" as equal operators. 
Perhaps there is an update available for the W3C XPath grammar files we have in 
src/main/javacc/xpath?

> QueryParser.parse(...) parses wrong the "[EMAIL PROTECTED] and @b=3 or @c=3]" 
> XPath statement.
> -----------------------------------------------------------------------------------
>
>                 Key: JCR-578
>                 URL: http://issues.apache.org/jira/browse/JCR-578
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 1.0.1, 1.1
>            Reporter: Eugene Porubaev
>            Priority: Minor
>
> 1. What I do:
> import org.apache.jackrabbit.core.query.*;
> ...
> QueryRootNode n1, n2;
> String q1 = ".[(@a=3 and @b=3) or @c=3]";
> String q2 = ".[ @a=3 and @b=3  or @c=3]";
> n1 = QueryParser.parse( q1, "xpath", nsRegistry);
> n2 = QueryParser.parse( q2, "xpath", nsRegistry);
> System.out.println( n1.dump() );
> System.out.println( n2.dump() );
> 2. What I expected to:
> I expect the QueryParser parse the both cases with the same result.
> So I expect to see on my console the same AQT dump (for the both n1 and n2 
> cases).
> 3. What have I got:
> The QueryParser has parsed the q1 statement (in right way): 'OR' node has 2 
> operands, one of witch is 'AND' node with its 2 operands.
> However the q2 statement is parsed as an 'OR' node predicate with only 1 
> operand; this one operand is 'AND' node, having in its turn all the 3 
> relation (as its operands).
> The output is the following:
> ...
> + OrQueryNode
>   + AndQueryNode
>     + RelationQueryNode: Op: =  Prop={}a Type=LONG Value=3
>     + RelationQueryNode: Op: =  Prop={}b Type=LONG Value=3
>   + RelationQueryNode: Op: =  Prop={}c Type=LONG Value=3
> ...
> + OrQueryNode
>   + AndQueryNode
>     + RelationQueryNode: Op: =  Prop={}a Type=LONG Value=3
>     + RelationQueryNode: Op: =  Prop={}b Type=LONG Value=3
>     + RelationQueryNode: Op: =  Prop={}c Type=LONG Value=3
> 4. Resume:
> I think the second case is parsed in a wrong way, because it's interpreted as 
> tree operand 'AND' condition:
> "@a=3 and @b=3  and @c=3".

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to