chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject RE: OpenCMIS SQL Parsing Question
Date Fri, 25 Jul 2014 21:13:41 GMT
Hello Jens,

Thank you for your input, I am now using the Example Query code for the basis of my Query
processing and it has gotten me past the particular problem I was experiencing.

Since my starting point for this CMIS Server was the OpenCMIS FileShare server, I had to also
create a typeDefinitionContainerImpl instance as the last step in the constructor of my repository
specific TypeManager.

These two changes allow me to successfully parse the following CMIS SQL statement:  Select
* from cmis:document where cmis:name = 'My_Document-0-0'

Unfortunately, when I attempt to parse the CMIS SQL statement that references a child type
of cmis:document, such as, Select WLS_DocType from WLS_General where WLS_DocType Like '*',
I get the following response:

         <faultstring>Query parsing failed: Syntax error in query: Line 1:59 rule query
failed predicate: {WLS_General is neither a type query name nor an alias.}?</faultstring>

The following is partial output for a getTypeDefinition request for WLS_General.   So, it
looks like it is there.

Is this due to the fact that TypeManager from the FileShare server uses a TypeManagerFactory
and there is an issue with the typeDefinitionContainerImpl creation?

Thanks in advance for your help!

         <type xsi:type="ns2:cmisTypeDocumentDefinitionType" xmlns:xsi="">
            <ns2:displayName>Content Manager - WLIS Item Type WLS_General</ns2:displayName>
            <ns2:description>Content Manager - WLIS Item Type WLS_General</ns2:description>
               <ns2:displayName>Document Type</ns2:displayName>
               <ns2:description>Document Type</ns2:description>
               <ns2:defaultValue propertyDefinitionId="WLS_DocType"/>

-----Original Message-----
From: Huebel, Jens []
Sent: Friday, July 25, 2014 9:45 AM
To:; Williams, Robert
Subject: Re: OpenCMIS SQL Parsing Question

Yes, please try to use the QueryUtilStrict class. We did at some point a certain refactoring
for those cases where server implementations want to to enhancements to the grammar. The sample
is the most up-to-date code we have. This should be a good starting point.

The error message indicates that your query string has some characters at the end after the
query string ends.


On 25/07/14 15:34, "<>"
<<>> wrote:

>I am new to CMIS and I am presently looking at handling query
>functionality in our CMIS Server,.  To this end, I am attempting to
>implement the code specified  in section 1.7 entitled "Parsing a CMIS
>Query" in chapter 14 of the text CMIS and Apache Chemistry in Action.
>While this example code seems very straight forward, I am getting the
>following error when invoking it for the CMIS SQL statement:  Select *
>from cmis:document where cmis:name = 'My_Document-0-0'.  I have tried
>variations such as ending the SQL statement with a semicolon and
>others, but the result has been the same.
>         <faultstring>Query String has illegal tokens after end of
>statement: [@15,63:63='&lt;EOF>',&lt;-1>,1:63]</faultstring>
>         <detail>
>            <cmisFault:cmisFault
>               <type>invalidArgument</type>
>               <code>0</code>
>               <message>Query String has illegal tokens after end of
>statement: [@15,63:63='&lt;EOF>',&lt;-1>,1:63]</message>
>               <stacktrace:stacktrace
>Query String has illegal tokens after end of statement:
>        at
>        at
>Based on debugging that I've performed, the CMIS SQL statement looks
>like it is getting into the code unaltered, but it goes off the rails
>The following is the QueryUtil::getWalker() method that is failing,
>specifically the highlighted code:
>    public static CmisQueryWalker getWalker(String statement) throws
>RecognitionException {
>        CharStream input = new ANTLRStringStream(statement);
>        TokenSource lexer = new CmisQlStrictLexer(input);
>        TokenStream tokens = new CommonTokenStream(lexer);
>        CmisQlStrictParser parser = new CmisQlStrictParser(tokens);
>        CommonTree parserTree; // the ANTLR tree after parsing phase
>        query_return parsedStatement = parser.query();
>        if (parser.hasErrors()) {
>            throw new
>        } else if ( tokens.index()!=tokens.size() ) {
>            throw new  CmisInvalidArgumentException("Query String has
>illegal tokens after end of statement: " + tokens.get(tokens.index()));
>        }
>        parserTree = (CommonTree) parsedStatement.getTree();
>        CommonTreeNodeStream nodes = new CommonTreeNodeStream(parserTree);
>        nodes.setTokenStream(tokens);
>        CmisQueryWalker walker = new CmisQueryWalker(nodes);
>        return walker;
>    }
>I did notice that the QueryUtil class is deprecated.  Further, as a
>result of digging around, I have discovered an OpenCMIS Query Parser
>Example directory.  The parsing done in these files uses the
>QueryUtilStrict class and seems to be done a little differently.
>Should I use this example code for CMIS SQL parsing instead of the
>example in the text?
>Thanks in advance for any and all assistance!

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message