Extension:FolkTagCloud

Description
This extension was created as part of a bachelor thesis as a means to allow distinction as well as combination of hierarchical categories and flat tags in the MediaWiki category system. It uses Semantic MediaWiki methods to implement a simple tagging functionality via a semantic property and to retrieve stored tags and display them in a tag cloud.

The extension can be used to add a social tagging feature to a Semantic MediaWiki, thus providing an additional option for knowledge structuring and information retrieval and enabling a disambiguation of category functions. Users can add label strings (so called FolkTags) to a wiki page and display the resulting folksonomy in various tag clouds. A cloud can be filtered by one or more given MediaWiki categories, thus combining the hierarchical category system with flat tags.

Usage
FolkTagCloud adds a predefined semantic attribute  to the wiki that can be used to tag pages using the SMW syntax:

The tags are values of the semantic attribute and are of type string. With the parser tag

the distribution of tags over the wiki can be displayed in a tag cloud, which can be adjusted via various parameters that are passed as XML style arguments to the parser tag.

Parser Tag Parameters

 * maxtags: (int) Maximum number of tags to be displayed (default=1000).


 * mincount: (int) Minimum frequency of a tag to be displayed in the tag cloud (default=1).


 * order: (frequency | alphabetical) Sorting criterion (default=false).


 * count: (boolean)  displays the frequency of a tag in parentheses (default=false).


 * increase: (log | linear) Linear or logarithmic increase of font size (default=linear).


 * increasefactor: (int) Font size increase factor(default=100).


 * minfontsize: (int) Minimum font size (default=77).


 * property: (SMW attribute) Attribute to be used instead of the predefined tagging attribute.

Parameters are passed like this:

Between der parser tags, one or more categories (separated by comma) can be passed:

This results in the filtering of the tag cloud by the given categories (and optionally their subcategories): only tags retrieved from wiki pages in the given categories are displayed.


 * subcategorylevel: (int) Level of subcategories included in the filtering (default=0).

Version
Version 1.1 should now work with SMW 1.4.3, but only limited testing has been done so far. If you encounter any problems, please e-mail me or leave a comment on the dicussion page (or feel free to create your own fix). To switch back to version 1.0, toggle comments in line 127 and 128, so the code looks like this: Support for SMW 1.5.0 will hopefully follow soon.

Download instructions
Please cut and paste the code found below and place it in. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installation
To install this extension, add the following to LocalSettings.php: The extension requires the Semantic MediaWiki extension and will not work without it.

$wgFTCTagName
The default semantic property that is used for tagging is a predefined property named. If a user defined property (e.g. MyTag ) should be used, the name of this property can be passed via the global variable $wgFTCTagName in LocalSettings.php.