jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eugene Porubaev (JIRA)" <j...@apache.org>
Subject [jira] Created: (JCR-578) QueryParser.parse(...) parses wrong the ".[@a=3 and @b=3 or @c=3]" XPath statement.
Date Sat, 23 Sep 2006 16:32:22 GMT
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
            Reporter: Eugene Porubaev
            Priority: Critical


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

        

Mime
View raw message