Tagging

cancel
Showing results for 
Search instead for 
Did you mean: 

Tagging

resplin
Intermediate
0 0 5,544

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com



The Alfresco Repository has had built-in support for free-form tagging of any content (and folders) stored within the repository since version 3.0.


Tag Scopes


A tag scope is a designated container (i.e., a folder) for tagged content. The tag scope defines a set of aggregated data (tag scope data) on the number of occurences of each tag within the container. The repository tagging services are responsible for keeping the tag scope data up-to-date as tags are added and removed from files and folders within the container.


Tag Model


Two aspects are defined within the Data Dictionary Content Model to support tagging metadata.


Aspect cm:taggable


This aspect can be applied to any item in the repository to allow tags to be applied to it.

     <aspect name='cm:taggable'>
        <title>Taggable</title>
        <parent>cm:classifiable</parent>
        <properties>
           <property name='cm:taggable'>
              <title>Tags</title>
              <type>d:category</type>
              <mandatory>false</mandatory>
              <multiple>true</multiple>
              <index enabled='true'>
                 <atomic>true</atomic>
                 <stored>true</stored>
                 <tokenised>false</tokenised>
              </index>
           </property>        
        </properties>
     </aspect>

Notice the type of the cm:taggable property defined by the aspect is actually a pointer to a category node, rather than an explicit string value. This reduces the storage overhead in the repository and allows tags to be renamed if required.

The repository stores the d:category nodes that represent categories in the workspace://SpacesStore store, under the path /cm:categoryRoot/cm:taggable. The Tags category in the Categories hierarchy stored under /cm:categoryRoot/cm:generalclassifiable is not used.


Aspect cm:tagscope


This aspect defines a tag scope container, which aggregates the occurence of tags applied to objects within the container.

     <aspect name='cm:tagscope'>
        <title>Tag Scope</title>
        <properties>
           <property name='cm:tagScopeCache'>
              <title>Tags</title>
              <type>d:content</type>
              <protected>true</protected>
           </property>       
        </properties>   
     </aspect>

The aspect defines a single d:content property containing the aggregated data in plain text. The structure of the content is as follows.

presentation|24
tech|23
dev|23
sales|18
video|18

This is the data which is returned when API requests are made for tagging data.


JavaScript API


Tag scope data may be accessed and updated via the JavaScript API. This API has been stable within the 3.x branch of Alfresco.

See 3.0 JavaScript Services API#Tagging_services


Action Executors


Two Custom Actions are provided to allow tag scope data to be updated asyncronously. The update-tagscope action iterates through the existing tags listed in the tagscope data and updates the counts stored against each one, while the refresh-tagscopes action iterates through all descendant items below the tag scope and regenerates the data afresh.


Implementation


Tagging capabilities are implemented within the org.alfresco.repo.tagging package of the Repository project. The following classes implement the core capabilities:











TaggingServiceImpl Tagging service implementation
TagScopeImpl Represents the roll up of tags within the scope of a node tree
UpdateTagScopesActionExecuter Update tag scopes action executer
RefreshTagScopesActionExecuter Refresh tag scope action executer

Content policies defined by TaggingServiceImpl are responsible for ensuring that the tag scope data of any parent folders is maintained when tags are added or removed.
Core Repository Services