chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Robert.Willia...@wellsfargo.com>
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="http://www.w3.org/2001/XMLSchema-instance">
            <ns2:id>WLS_General</ns2:id>
            <ns2:localName>WLS_General</ns2:localName>
            <ns2:localNamespace>https://casinfra.wellsfargo.com/cascmisserver</ns2:localNamespace>
            <ns2:displayName>Content Manager - WLIS Item Type WLS_General</ns2:displayName>
            <ns2:queryName>WLS_General</ns2:queryName>
            <ns2:description>Content Manager - WLIS Item Type WLS_General</ns2:description>
            <ns2:baseId>cmis:document</ns2:baseId>
            <ns2:parentId>cmis:document</ns2:parentId>
            <ns2:creatable>false</ns2:creatable>
            <ns2:fileable>false</ns2:fileable>
            <ns2:queryable>true</ns2:queryable>
            <ns2:fulltextIndexed>false</ns2:fulltextIndexed>
            <ns2:includedInSupertypeQuery>true</ns2:includedInSupertypeQuery>
            <ns2:controllablePolicy>false</ns2:controllablePolicy>
            <ns2:controllableACL>false</ns2:controllableACL>
            <ns2:typeMutability>
               <ns2:create>false</ns2:create>
               <ns2:update>false</ns2:update>
               <ns2:delete>false</ns2:delete>
            </ns2:typeMutability>
            <ns2:propertyStringDefinition>
               <ns2:id>WLS_DocType</ns2:id>
               <ns2:localName>WLS_DocType</ns2:localName>
               <ns2:displayName>Document Type</ns2:displayName>
               <ns2:queryName>WLS_DocType</ns2:queryName>
               <ns2:description>Document Type</ns2:description>
               <ns2:propertyType>string</ns2:propertyType>
               <ns2:cardinality>single</ns2:cardinality>
               <ns2:updatability>readonly</ns2:updatability>
               <ns2:inherited>false</ns2:inherited>
               <ns2:required>true</ns2:required>
               <ns2:queryable>true</ns2:queryable>
               <ns2:orderable>false</ns2:orderable>
               <ns2:openChoice>false</ns2:openChoice>
               <ns2:defaultValue propertyDefinitionId="WLS_DocType"/>
            </ns2:propertyStringDefinition>

-----Original Message-----
From: Huebel, Jens [mailto:j.huebel@sap.com]
Sent: Friday, July 25, 2014 9:45 AM
To: dev@chemistry.apache.org; 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.

Jens


On 25/07/14 15:34, "Robert.Williams3@wellsfargo.com<mailto:Robert.Williams3@wellsfargo.com>"
<Robert.Williams3@wellsfargo.com<mailto:Robert.Williams3@wellsfargo.com>> wrote:

>Hello,
>
>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
>xmlns:ns2="http://docs.oasis-open.org/ns/cmis/core/200908/"
>xmlns="http://docs.oasis-open.org/ns/cmis/messaging/200908/"
>xmlns:cmisFault="http://docs.oasis-open.org/ns/cmis/messaging/200908/">
>               <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
>xmlns="http://chemistry.apache.org/opencmis/exception"
>xmlns:stacktrace="http://chemistry.apache.org/opencmis/exception">org.a
>pac
>he.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException:
>Query String has illegal tokens after end of statement:
>[@15,63:63='&lt;EOF>',&lt;-1>,1:63]
>        at
>org.apache.chemistry.opencmis.server.support.query.QueryUtil.getWalker(
>Que
>ryUtil.java:83)
>        at
>org.apache.chemistry.opencmis.server.support.query.QueryUtil.traverseSt
>ate
>ment(QueryUtil.java:112)
>
>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
>somewhere.
>
>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
>CmisInvalidArgumentException(parser.getErrorMessages());
>        } 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!
>
>



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