cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to get the path from a cmis:document query?

goebelchase
Champ in-the-making
Champ in-the-making
I am retrieving a set of documents via a query, and part of the information I need on the documents is their path within Alfresco.
the cmis:folder has a cmisSmiley Tongueath option, but the cmis:document does not, and I have not been able to find any way to get this information from a cmis:document option.
The CMIS Query Language on the Alfresco wiki has this to say under the "Alfresco extended relational mapping" topic:
<blockquote>
Extended mapping is supported for Alfrecso types derived from cm:content and cm:folder, which are mapped to cmis:document and cmis:folder, respectively. It is not possible to refer to cm:content and cm:folder directly: you must use cmis:document and cmis:folder.
The behavior of extended types is governed by their data dictionary definitions for indexing. All properties may be selected. If a property is indexed, it is queryable. If it is untokenized, both tokenized and untokenized, or of one of the orderable types, then it is orderable.
The orderable types are:
d:boolean
d:datetime
d:double
d:float
d:integer
d:long
dSmiley Tongueath
<blockcode>
SELECT * FROM CMSmiley SurprisedWNABLE
- Aspects live a half-life as policies in the non-strict world

SELECT cm:thumbnailName from cm:thumbnail
- In the strict world you can refer to subtypes of cm:content and cm:folder and their properties as you would expect,
  using prefix:localName style notation
</blockcode></blockquote>

the "dSmiley Tongueath" type they mention seems like it might be something that would help, but I don't understand what they're talking about here, and I'm not sure how I would implement it.
Would anyone be able to help me?  I would greatly appreciate it.
Thank you.
4 REPLIES 4

jpotts
World-Class Innovator
World-Class Innovator
No, you cannot get the path back as part of a query. You can, however, make a CMIS API call to get the list of paths an object is in.

For example, if you use the OpenCMIS Workbench, here is what it would look like in the Groovy console:

doc = session.getObject('a8a507b5-e778-4e67-9795-339c405c0612;1.0')
println doc.getPaths()

Jeff

goebelchase
Champ in-the-making
Champ in-the-making
Jeff, thank you for your reply, that's very helpful information.
Unfortunately, I'm experiencing some issues with your proposed solution.
using the 'session.getObject(value)' is working fine, but when I try to get the path from it it says "'DotCMIS.Client.ICmisObject' does not contain a definition for 'getPaths' and no extension method 'getPaths' accepting a first argument of type 'DotCMIS.Client.ICmisObject' could be found (are you missing a using directive or an assembly reference?)".
I should have mentioned earlier that I am using DotCMIS in a C# application.  Is this functionality missing from DotCMIS as opposed to OpenCMIS?  Or is there simply a different method I need to use?
Any help you or others could offer would be greatly appreciated.
Thank you.

goebelchase
Champ in-the-making
Champ in-the-making
For anyone else facing this problem, I managed to figure out how to get a document's path in DotCMIS from the document's ID.  I am unsure if this is the most efficient way, but it works.
<blockcode>
                ICmisObject object = session.GetObject(id);
                IDocument doc = object as IDocument;
                IList<string> path = doc.Paths;
                string pathFound = path.ElementAt(0);
</blockcode>

jpotts
World-Class Innovator
World-Class Innovator
Glad you got it working!

Jeff