cancel
Showing results for 
Search instead for 
Did you mean: 

CMIS Query - Get the PATH from a cmis:document

tremalnaik
Champ in-the-making
Champ in-the-making
Hi,

If I make the next query:

SELECT *  FROM cmis:document WHERE cmis:name LIKE 'name'

Nothing of the values returned is the path (it's not al the cmis:document table)

Exists some meaning to recovery the path of there? Thanks
4 REPLIES 4

jpotts
World-Class Innovator
World-Class Innovator
The path for a CMIS object has to be reconstructed by invoking the object's "getParents" URL.

For example, suppose you have a cmis:document with a self link of:
http://localhost:8080/alfresco/cmisatom/c0c56a69-abbb-41a4-90fe-c3750b376199/entry?id=workspace%3A%2...

If you look at the cmis:document, it will have an "up" URL, otherwise known as the getParents URL. In my example, the up URL looks like this:
http://localhost:8080/alfresco/cmisatom/c0c56a69-abbb-41a4-90fe-c3750b376199/parents?id=workspace%3A...

Once you have that URL you invoke it with a filter of 'cmisSmiley Tongueath' and the includeRelativePathSegment set to True, like this:
http://localhost:8080/alfresco/cmisatom/c0c56a69-abbb-41a4-90fe-c3750b376199/parents?id=workspace%3A...

What you'll get back is a feed of parent entries, even if the object only has a single parent. Each parent entry will contain a path and a relative path segment, which can be concatenated to form the path.

Of course, if you are using a CMIS client library like OpenCMIS (Java) or cmislib (Python), you can just ask the object for its paths and the library does all of this work for you.

Hope that helps,

Jeff

aowian
Confirmed Champ
Confirmed Champ

In case someone arrives here when looking for how to do this with the OpenCMIS Java library, the call is 

CmisObject cmisObject = session.getObject(id);
println(cmisObject.getPaths())‍‍;

See this StackOverflow for reference.

ihanna
Champ in-the-making
Champ in-the-making
I know what you to do. The path for a CMIS object has to be reconstructed by invoking the object's "getParents" URL.

For example, suppose you have a cmis:document with a self link of:
http://localhost:8080/alfresco/cmisatom/c0c56a69-abbb-41a4-90fe-c3750b376199/entry?id=workspace%3A%2...

If you look at the cmis:document, it will have an "up" URL, otherwise known as the getParents URL. In my example, the up URL looks like this:
http://localhost:8080/alfresco/cmisatom/c0c56a69-abbb-41a4-90fe-c3750b376199/parents?id=workspace%3A...

Once you have that URL you invoke it with a filter of 'cmisSmiley Tongueath' and the includeRelativePathSegment set to True, like this:
http://localhost:8080/alfresco/cmisatom/c0c56a69-abbb-41a4-90fe-c3750b376199/parents?id=workspace%3A...

What you'll get back is a feed of parent entries, even if the object only has a single parent. Each parent entry will contain a path and a relative path segment, which can be concatenated to form the path.

Of course, if you are using a CMIS client library like OpenCMIS (Java) or cmislib (Python), you can just ask the object for its paths and the library does all of this work for you.

Hope that helps,

Jeff


Hey, I have the same problem as his. I tried what you said but it didn't work. Do you have any alternate solution for this problem? I AM REALLY REALLY FRUSTRATED. I've been facing this for a week now and been researching about it for about 2 days straight. I really want to finish my task. Please help me.

jpotts
World-Class Innovator
World-Class Innovator
"It didn't work" is not helpful. Can you provide details on what specifically does not work?

Jeff