cancel
Showing results for 
Search instead for 
Did you mean: 

Help on CMIS Query using IN_TREE condition

sepgs2004
Star Contributor
Star Contributor
Using Alfresco Community edition 5.0.d

I am using CMIS 1.1 Atom Pub URL: http://test-alfresco:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom

My libraries
<code language="xml">
<dependency>
<groupId>org.apache.chemistry.opencmis</groupId>
<artifactId>chemistry-opencmis-client-api</artifactId>
<version>0.13.0</version>
</dependency>
<dependency>
<groupId>org.apache.chemistry.opencmis</groupId>
<artifactId>chemistry-opencmis-client-impl</artifactId>
<version>0.13.0</version>
</dependency>
</code>

In Alfresco Share, I verified the id of the folder. The folder that I am talking about is the documentLibrary folder under a specific site. On the documentLibrary folder, if I see view properties, or even if I see the browser URL, I see this below.

http://test-alfresco:8080/share/page/context/mine/folder-details?nodeRef=workspace://SpacesStore/6c3...

Also, in my code using CMIS API, if I get the CmisObject of this documentLibrary folder, it has this id 6c3fd5c2-1a69-48a6-8d04-d39339ba53ec

Using the Share App, I see all the documents under this folder, but under some sub folders.

However, if I construct my query using the above id with the IN_TREE clause, I do not get these documents (images) in the results.
I tried CMIS workbench to cross check. I am glad it behaves the same way as my code.

My CMIS workbench query is
<code language="sql">
SELECT doc.*, salo.* FROM cmis:document AS doc JOIN salo:documentProperties AS salo ON doc.cmisSmiley SurprisedbjectId = salo.cmisSmiley SurprisedbjectId 
WHERE IN_TREE(doc, 'workspace://SpacesStore/6c3fd5c2-1a69-48a6-8d04-d39339ba53ec') 
AND (salo.salo:lo_key = 163) AND (salo.salo:lo_category = 'Test')
</code>

If I remove the IN_TREE clause, query brings all the documents. All these documents are under one of the folders under this documentLibrary folder. I verified this using Alfresco Share.

Appreciate your help
Gnanasekaran Sakthivel
1 REPLY 1

sepgs2004
Star Contributor
Star Contributor
If you see my query above, I have used doc, which is an alias for the cmis:document, in this IN_TREE qualifier for a folder id. Is this correct? I believe so.

The problem is, it works sometimes, and does not work the other times.
Suppose the folder contains 10 documents, Alfresco Share would show all 10 of them. However, this retrieval gets only few of them and not all the 10 documents that are under this folder whose id is passed into the IN_TREE condition.


What is this qualifier really represent?
What is the relationship between this qualifier and the id in the IN_TREE(qualifier, id) condition?

It looks like, what I am giving is correct.
This is what is mentioned about the qualifier in this site <url>https://wiki.alfresco.com/wiki/CMIS_Query_Language</url> under the Contains section.
<cite>
The qualifier, if provided, must be the name or alias of one of the tables in the FROM clause. The full text search expression should then only match objects of this type. A qualifier must be provided if there is any ambiguity as to which object a full text search expression should match - i.e. there is a JOIN.
</cite>

Please help!
Gnanasekaran Sakthivel