You are on page 1of 4

14/2/2014

Get all Alfresco tags with CMIS - Stack Overflow

sign up

log in

tour

help

careers 2.0

Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Take the 2-minute tour

Get all Alfresco tags with CMIS

I'm trying to get all tags (nodeRefs and names) from alfresco using CMIS. The Alfresco version is 3.4. Before googling a lot, I don't find any good query to do this? Any advice? Thanks in advanced, Juanjo.
alfresco cmis opencmis taggable

asked Oct 12 '13 at 10:36 Pymoo 29 1 7 Do you want to get the Tags on a given Node, or do you want to get the Nodes which represent specific Tags?
http://stackoverflow.com/questions/19333232/get-all-alfresco-tags-with-cmis 1/4

14/2/2014

Get all Alfresco tags with CMIS - Stack Overflow

Gagravarr Oct 12 '13 at 17:26 Thanks for your answer Gagravarr. I will try to clarify the question. I need to show all the tags on a Node (folder) recursively, because in my integration I have to make a form for uploading files and the user wants to add existing tags to the document in this moment. Pymoo Oct 13 '13 at 7:15 Does it have to just be the tags used by that folder+children, or would the tags used on the Site containing the folder be OK? (Only Alfresco already maintains the list of the latter for you) Gagravarr Oct 13 '13 at 9:33 I need all the tags for all the Site (including the current folder). What's the best query to do this? It's possible to access via opencmis? Thanks a lot Gagravarr. Pymoo Oct 13 '13 at 16:13 All the tags for a site is an easy query to make, just not one available via CMIS. You'll need to use the normal Alfresco APIs to get it. (I'll try to make an answer out of it later, if no-one beats me to it) Gagravarr Oct 13 '13 at 18:28 show 1 more comment

1 Answer
I can't find a huge amount of detail written up on the Alfresco wiki on how the Tagging Service works, so if someone fancies taking this and updating the wiki that might be helpful! There are three key parts to tagging: Tag nodes themselves Tagged nodes Tag Scopes Tag Nodes live under a special node w o r k s p a c e : / / S p a c e s S t o r e / t a g : t a g r o o t which is in / c m : c a t e g o r y R o o t / c m : t a g g a b l e. Tag Nodes are of type c m : c a t e g o r y and the c m : n a m e is the tag Next, you'll want to apply a tag to a node. If it's a new tag, it needs creating in the tag root first. If this is the first tag on a node, add the c m : t a g g a b l e aspect. Get the noderef of the tag node, then add that to the multi-valued c m : t a g g a b l e property on the node. (The tagging service will do all of this for you if you call addTag(NodeRef,String) Finally, various nodes up the primary parent hierarchy of the node you just tagged may be defined as a Tag Scope (eg the Site Node). With this, the nodes with the c m : t a g s c o p e aspect have the
http://stackoverflow.com/questions/19333232/get-all-alfresco-tags-with-cmis 2/4

14/2/2014

Get all Alfresco tags with CMIS - Stack Overflow

c m : t a g S c o p e S u m m a r y property updated. c m : t a g S c o p e S u m m a r y holds the list of tags used by the children of the node, along with the number of times the tag is used. This lets you work out what the most popular tags are for that bit of the tree, as well as working out what tags are used, and when a tag is no longer used by the tree. Again, the TaggingService updates all of that for you. AFAIK, the various tag properties ( c m : t a g g a b l e and c m : t a g S c o p e S u m m a r y) are not exposed via CMIS. You'd need to use one of the normal Alfresco APIs, either from the Public API, or something like s c r i p t / o r g / a l f r e s c o / c o l l a b o r a t i o n / t a g Q u e r y . g e t which will let you get the list of tags applied to a node. I'd suggest you ensure that the node you query from is a tag scope, so it's nice and quick. The Site is always a tag scope, so that's a good place to start.
answered Oct 14 '13 at 11:10 Gagravarr 11.8k 4 17 47 Great answer. Thank you. I think, correct me if I'm wrong, the tagging service addTag begins from 4.0 version of Liferay. isn't it? So I can't make it works just with alfresco-opencmis-extension and chemistry-opencmis APIs? Could I use Web Services optionally? Note: WARNING! I'm a newbie with Alfresco. Pymoo Oct 14 '13 at 14:28 I don't know anything about liferay, sorry. I believe you'll need to make a non-CMIS REST api calls to get the data you want, calling straight to Alfresco. Gagravarr Oct 14 '13 at 15:18 Excuse I meant Alfresco 4.0 not Liferay. To many opened wars, sorry :-( Pymoo Oct 14 '13 at 17:01

I wouldn't recommend trying it with WebServices. There's a very simple and easy to use REST api that does exactly what you need, use that! There's no point wasting huge amounts of time trying to hack something up badly with ws*, embrace the Alfresco way and go with the simple REST call! Gagravarr Oct 14 '13 at 18:06 The Alfresco wiki has lots of examples. Also, another good thing about simple RESTful APIs is that you can prototype most of it straight from your web browser! Gagravarr Oct 15 '13 at 8:57

show 3 more comments

Not the answer you're looking for? Browse other questions tagged alfresco cmis
opencmis taggable or ask your own question.

http://stackoverflow.com/questions/19333232/get-all-alfresco-tags-with-cmis

3/4

14/2/2014

Get all Alfresco tags with CMIS - Stack Overflow

http://stackoverflow.com/questions/19333232/get-all-alfresco-tags-with-cmis

4/4

You might also like