You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Szymon Kuzniak (JIRA)" <ji...@apache.org> on 2006/10/16 14:58:38 UTC

[jira] Commented: (JCR-578) QueryParser.parse(...) parses wrong the ".[@a=3 and @b=3 or @c=3]" XPath statement.

    [ http://issues.apache.org/jira/browse/JCR-578?page=comments#action_12442591 ] 
            
Szymon Kuzniak commented on JCR-578:
------------------------------------

hello,
the same issue was created earlier, and is now reolved:
http://issues.apache.org/jira/browse/JCR-562

> QueryParser.parse(...) parses wrong the ".[@a=3 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