
Taxonomies
Taxonomies are a way of organizing and aggregating content.
Overview #
Traditionally in Liferay you have only one vocabulary with tags that you can use to classify your contents later search and aggregate them using this tags.
With the new taxonomy system implemented from Liferay Portal 5.2 you can have more than one vocabulary. You can create category trees vocabularies in order to tag your contents and classify them. The Tags Admin portlet has been redesigned and extended in order to support the hierarchical categories concept and now you can create taxonomies or folksonomies inside Liferay.
Taxonomies versus folksonomies #
The main difference between taxonomies and folksonomies is that in taxonomies a closed set of tags, which in Liferay are called "categories" are created and organized in a hierarchical way by the site administrator. Folksonomies are an open set of tags, which in Liferay are called "tags", that could be extended by the end user.
In order to support taxonomies when you create a new vocabulary you must specify if it is a folksonomy or not using the correct editor mode in Tags Admin portlet. The mode is selected using the buttons in the upper left corner just under the search field. For folksonomy, select the "Tag Sets" button, for taxonomy, select the "Categories" button.
In the next screenshot you can see a folksonomy created for tagging photos.
and in this other capture you can see how we have created a partial taxonomy with hierarchical categories to classify the different olympic games sports.
In order to build the tree you need to add categories and then you can drag and drop them to the correct parent category.
Using taxonomies in your portlets #
The taglibs used for folksonomies, have been extended with a new boolean folksonomy param. To display the tags with which users have classified their contents, set this param to true. As an example, to show folksonomy for a particular WebContent journal article, you could use
<liferay-ui:tags-summary className="<%= JournalArticle.class.getName() %>" classPK="<%=article.getResourcePrimKey()%>" folksonomy="true" /> }}}
in java code, you can get an array of user defined tags for a particular article with
String[] tagsEntries = TagsEntryLocalServiceUtil.getEntryNames( JournalArticle.class.getName(), article.getResourcePrimaryKey(),true);
Taxonomies (tags and categories) have permission settings and will not be accessible from portlet code if permissions are not set correctly.
Current limitations #
Right now the system does not support the searching using the full category tree (including the parents of the searched category). Also, it does not support hierarchies with more than one parent for a child node.