cancel
Showing results for 
Search instead for 
Did you mean: 

CMIS Query Language - Has not Aspect

castgroupteam
Champ in-the-making
Champ in-the-making
How can I query my Alfresco repository through CMIS Query Language asking for all nodes which does not implement a custom aspect?
(Something like NOT hasAspect("my:customAspect")).
Using the join syntax I can ask for nodes with all aspects I want but in this case I need to exclude nodes which has not a particular aspect.

Someone can help?

Thanks in advance.
Daniele
12 REPLIES 12

kaynezhang
World-Class Innovator
World-Class Innovator
I'm afraid there is no such feature in  cmis query language,You can use lucene language.

kaynezhang
World-Class Innovator
World-Class Innovator
This is an lucene example that search nodes without aspect "cm:titled"
+PATH:"/app:company_home//." AND -ASPECT:"cm:titled"

Thank you for your help, your answer is helpful for sure.
I know it's possible using lucene, ftl and so on, I think it is a common used feature so I found unbelievable was not implemented by the cmis layer.
I am building an external java application so I still want to use cmis, I've changed my logic in order to exclude by path instead that by aspect. (using  NOT in_tree(…) cmis function).

Regards.
Daniele

I found it's possible using CONTAINS(..) clause

Could you please explain how did you achieve it using the CONTAINS clause ? AFAIK CONTAINS only searches in the content, is not related to aspects.

That's not true, with cmis-alfresco you can use the CONTAINS construct to build query with mixed CMIS and FTS query syntax.

http://wiki.alfresco.com/wiki/CMIS_Query_Language#cmis-alfresco

…AND CONTAINS(P,\'NOT ASPECT:\\\'test:myCustomAspecy\\\'\')

iblanco
Confirmed Champ
Confirmed Champ
I had read many times about CONTAINS in the wiki's Search page and never understood that this could be used this way. It's good to know it.

Thanks

kaynezhang
World-Class Innovator
World-Class Innovator
Good idea,using the contains() function in CMIS-SQL extremelly increase CMIS query capabilities