Hi Randy,

you are right. This restriction has been added in one of the later revisions of 
the spec.

If you need more operators than just "=" with "ANY" you can use the extended 
grammar which is provided as an example how to enhance the CMIS grammar. The 
extended grammar should support your example and is even part of the 
distribution. So it is even simpler than Florent has pointed out. The code is 
there you would just have to enable it (just by chance your case matches the 
extension example).

The two unit tests TestParserStrict.java and TestParserExt.java should give you 
an idea how to do this (don't be confused by the reflection magic, this is only 
needed for simplifying the test code). Basically you need to replace the Lexer 
and Parser class names.


Jens


-----Original Message-----
From: Speakman, Randy [mailto:[email protected]] 
Sent: Montag, 18. April 2011 14:52
To: Florent Guillaume; [email protected]
Subject: RE: OpenCMIS Query Parsing Failure with Repeating Attribute and Not 
Equal Operator

Hi Florent, thank you for responding. I think the problem was that I had been 
basing the query on an older document from EMC 
https://community.emc.com/docs/DOC-1582, when I should have been referring to 
the 1.0 specs from OASIS directly.

Inside of this document it has the following description which differs from the 
OASIS spec.

<quantified comparison predicate> ::= <literal> <comp op> ANY 
<multi-valued-column reference>

<comp op> ::= "=" | "<>" | "<" | ">" | "<=" | ">="

So this led me to believe that the query I had written was a valid query. This 
query was just part of a Junit test suite that I had written to test my custom 
repository connector. It was one of many queries that I wrote to test my code. 
The query always failed and I was never able to determine why.

Many thanks,

Randy

-----Original Message-----
From: Florent Guillaume [mailto:[email protected]] 
Sent: Sunday, April 17, 2011 11:33 AM
To: [email protected]
Cc: Speakman, Randy
Subject: Re: OpenCMIS Query Parsing Failure with Repeating Attribute and Not 
Equal Operator

The BNF grammar of the CMIS 1.0 specification (§ 2.1.10.2.1 at
http://docs.oasis-open.org/cmis/CMIS/v1.0/cmis-spec-v1.0.html) has:

<quantified comparison predicate> ::= <literal> "=" ANY
<multi-valued-column reference>

So only the "=" operator is allowed by the strict spec, not "<>".

Your query would be a straightforward extension that OpenCMIS could
very reasonably allow in non-strict mode (if the server chooses to
support it), but it's not in it at the moment.

Florent

PS: are you sure that you don't want to write ... WHERE NOT('keyword1'
= ANY keywords), which is legal? This is the semantics people usually
want.


On Fri, Apr 15, 2011 at 8:29 PM, Speakman, Randy <[email protected]> wrote:
> Hi,
>
> I am having an issue with a specific type of CMISQL query that fails to be 
> parsed in OpenCMIS 0.3.0 by the CmisQlStrictParser class. I have checked the 
> CMIS 1.0 specs and believe the query I have written is valid, however I would 
> like someone else to look at the query and double check it. The query 
> criteria filters on a repeating attribute that is not equal to a specific 
> value. In the query below, the keywords attribute is a repeating string. The 
> exception is thrown when QueryUtil.getWalker(...) is called and hits line 57, 
> where it checks the parser for errors. The error message in the parser says 
> "line 1:114 mismatched input '&lt;&gt;' expecting EQ".
>
> /*
> Lines 56 to 59 from QueryWalker class
> */
>        query_return parsedStatement = parser.query();
>        if (parser.hasErrors()) {
>            throw new CmisInvalidArgumentException(parser.getErrorMessages());
>        }
>
> /*
> My query
> */
> select cmis:objectId, cmis:name, cmis:contentStreamLength, keywords from 
> my_doc_type where 'keyword1' <> any keywords
>
>
>
> Thanks,
>
> Randy
>



-- 
Florent Guillaume, Director of R&D, Nuxeo
Open Source, Java EE based, Enterprise Content Management (ECM)
http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87

Reply via email to