See
PublishedAPI for packages intended to be used by Plugin and Contrib authors, or
browse all packages.
See also
Developing plugins,
Developer's Bible,
Technical Overview
internal package
Foswiki::Plugins::ClassificationPlugin::Hierarchy
a hierarchy is the container for all categories in a web. each web is associated
with exactly one hierarchy object. A hierachy is stored persistently on disk
and is loaded into memory. it is only reloaded if it changed on disk by another
process
ClassMethod
new($web, $topic, $text) → $hierarchy
constructor
ObjectMethod
finish()
does not invalidate this object; it is kept intact to be cached in memory
in a mod_perl or speedy-cgi setup; we only store it to disk if we updated it
ObjectMethod
purgeCache($mode, $touchedCats)
- mode = 0 → do nothing
- mode = 1 → a tagged topic has been saved
- mode = 2 → a categorized topic has been saved
- mode = 3 → a classified topic has been saved
- mode = 4 → a category has been saved
- mode = 5 → clear all
ObjectMethod
init()
initializes all categories of this hierarchy
ObjectMethod
initFromTopic()
initializes this hierarchy from its web.topic properties
ObjectMethod
initFromText()
initializes this hierarchy from the text of its web.topic
ObjectMethod
initFromWeb()
this is the most common way to initialize a hierarchy: by
traversing all topics in a web and create categories from topics
of type "Category"
ObjectMethod
printDistanceMatrix()
debugging method to show the content of the distance matrix as computed
by
computeDistance()
ObjectMethod
computeDistance()
computes the distance between all categories using a Wallace-Kollias
algorith for transitive closure. results are cached as part of the hierarchy
ObjectMethod
distance($topic1, $topic2) → $integer
This computes the minimum distance between two categories or a topic and a
category or between two topics. If a non-category topic is under consideration
then all of its categories are measured against each other while computing the
overall minimal distances. So simplest case is measuring the distance between
two categories; the most general case is computing the min distance between two
sets of categories.
ObjectMethod
catDistance($cat1, $cat2) → $integer
fast lookup of the distance between two categories
ObjectMethod
getSimilarTopics($topicA, $threshold)
Find all topics that are similar to the given one i nthe current web
similarity is computed by calculating the weighted matching coefficient (WMC)
counting matching tags and categories between two topics. Matching categorization
is weighted in a way to matter more, that is two topics correlate more if
they are categorized similarly than if they do based on tagging information.
This is an rought adhoc model to reflect the intuitive importance in
knowledge management of category information versus tagging information.
The provided threshold limits the number of topics that are considered similar
ObjectMethod
computeSimilarity($params)
ObjectMethod
subsumes($cat1, $cat2)
return true if cat1 subsumes cat2 (is an ancestor of)
returns a list reference of all tags in use
ObjectMethod
getCategoriesOfTopic($topic) → $list
returns a list reference of all direct categories of a topic
ObjectMethod
getCatFields(@topicTypes) → $list
get names of category formfields of a topictype
ObjectMethod
getCategories() → @list
returns a list of all category objects in this hierarchy
ObjectMethod
getCategoryNames() → @list
returns a list of all category names in this hierarchy
ObjectMethod
getCategory($name) → $cat
returns a category object of the given name
See
Foswiki::Plugins::ClassificationPlugin::Category
ObjectMethod
setCategory($name, $cat)
adds the named category to the hierarchy
ObjectMethod
createCategory(...) → $cat
returns a new category object for the given parameters
See
Foswiki::Plugins::ClassificationPlugin::Category::new()
ObjectMethod
traverse($params) → $results
recursively traverses a hiearchy and formats results.
params may hold:
- top: starting point
- sort
- header
- footer
- separator
- nullformat
ObjectMethod
getPreferences(@list)
get preferences of a set of categories
ObjectMethod
checkAccessPermission($mode, $user, $topic, $order) → $boolean
experimental: check permissions based on category preferences
ObjectMethod
collectTopicsOfCategory()
iterates of the hierarchy's web and assigns topics to their category
ObjectMethod
filterCategories($params) → @list
returns a list of categories matching the properties in
$params
as there are:
- title: regex
- name: regex
- casesensitive: boolean
ObjectMethod
sortCategories($cats, $crit) → $list
returns a sorted list of categories.
$crit
can be
- order: sort by order property of categories
- name
- title
ObjectMethod
translate($text) → $string
compatibility wrapper for
MultiLingualPlugin