cancel
Showing results for 
Search instead for 
Did you mean: 

CMIS query is querying Relationship instead of Type - Naming clash for Alfresco Type and Association

patquinn00
Champ in-the-making
Champ in-the-making
Executing this simple query using CMIS Workbench fails:

SELECT * FROM tdm:publicManual


We get this log output:

Mar 26, 2014 5:11:42 PM org.apache.solr.common.SolrException log
SEVERE: org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException: Type is not queryable tdm:publicManual -> R:tdm:publicManual
        at org.alfresco.opencmis.search.CMISQueryParser.buildSource(CMISQueryParser.java:1417)


Using CMIS Workbench, I can see that <em>R:tdmSmiley TongueublicManual</em> is a cmis:relationship…not a type as I had expected. I can see <em>D:tdmSmiley TongueublicManual</em> exists with a Base Type of cmis:document…this is what I want to query on.

Inspecting the model we have a type and relationship with the same name.


   <type name="tdm:publicManual">
      ……
   </type>
   <aspect name="tdm:staged">
      ….
      <associations>
         <association name="tdm:publicManual">
            ……
         </association>
         ……
      </associations>
   </aspect>


This model has been deployed in production since mid 2013 with no problems. e.g. Lucene queries work fine, model deploys without error, we can create content of type tdmSmiley TongueublicManual and also associations with the name tdmSmiley TongueublicManual.

We are just starting to use the CMIS API for new client apps, and this has raised it's head now.

<ul>
<li>
Does anyone know if there a way to request CMIS to explicitly query against the type and not the relationship?
</li>
<li>
Is it a case that our model is inherently flawed, and should be changed, by having a type and relationship with the same name?
</li>
</ul>

Thanks,
Patrick
2 REPLIES 2

patquinn00
Champ in-the-making
Champ in-the-making
From debugging through the CMISQueryParser, it looks up the Type Definition using the CMIS Dictionary Service (CMISStrictDictionaryService and CMISAbstractDictionaryService) using
findTypeByQueryName(tableName)
. tableName is "tdmSmiley TongueublicManual"

The dictionary service uses a registry which is mapping names to Type definitions…so more than likely, the mapping of tdmSmiley TongueublicManual to the Type named "tdmSmiley TongueublicManual" is being overwritten in the Map by the association named "tdmSmiley TongueublicManual".

Whether the model is inherently flawed or not, I'm not sure, but certainly the CMIS Query Parser is not compatible with it as it is.
This is looking like an update to the model and a data fix script.

kaynezhang
World-Class Innovator
World-Class Innovator
In CMIS Specification a relationship object MAY be queryable,but now alfresco does not support queries for relationship type.
So in my opinion ,you'd better avoid defining an association with same name as a a type.