[ 
https://issues.apache.org/jira/browse/OAK-1067?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13784961#comment-13784961
 ] 

Thomas Mueller commented on OAK-1067:
-------------------------------------

I think the behavior of Oak is correct (that is, according to the JCR 
specification), and also compatible with Jackrabbit. At least for this test 
case. 

As far as I understand, the condition {{@prop = 'false' or not(@prop)}} means 
"the property value of 'prop' is either false, or the property 'prop' does not 
exist". I would expect the result of the query to be at least /content and 
/content/two, but not /content/one. 

This is also the result I get. I have re-written the test using the JCR API and 
ran it against Oak and Jackrabbit 2.x, and got the same result for both:

{code}
    public void testNotProp() throws Exception {
        Session session = getHelper().getReadWriteSession();
// OAK:        Session session = getAdminSession();
        Node content = session.getRootNode().addNode("content");
        content.addNode("one").setProperty("prop", true);
        content.addNode("two");
        session.save();
        String query = "//*[@prop = 'false' or not(@prop) ]";
        QueryResult r = session.getWorkspace().getQueryManager().createQuery(
                query, Query.XPATH).execute();
        NodeIterator it = r.getNodes();
        System.out.println("query: " + query);
        while (it.hasNext()) {
            String path = it.nextNode().getPath();
            if (path.startsWith("/content")) {
                System.out.println("   " + path);
            }
        }
    }
{code}

> XPath query fails on negated boolean properties 
> ------------------------------------------------
>
>                 Key: OAK-1067
>                 URL: https://issues.apache.org/jira/browse/OAK-1067
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core, query
>            Reporter: Alex Parvulescu
>            Assignee: Thomas Mueller
>         Attachments: OAK-1067-test.patch
>
>
> The issue can be seen when running an xpath query for nodes that have a 
> boolean property set to false:
> bq. //*[(child/@prop = 'false' or not(child/@prop))]
> this translates into 
> bq. select [jcr:path], [jcr:score], * from [nt:base] as a where [child/prop] 
> = false or [child/prop] is null
> the second _or_ part is wrong and selects more than it should: 'or 
> [child/prop] is null'



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to