Create, edit and use hierarchical taxonomies in Plone!
This add-on provides support for hierarchical taxonomies in multiple languages, letting users easily associate existing content with terms from one or more taxonomies.
Taxonomy is the “discipline of defining groups […] on the basis of shared characteristics and giving names to those groups. Each group is given a rank and groups of a given rank can be aggregated to form a super group of higher rank and thus create a hierarchical classification”.
Here’s an example of the “taxonomic kingdoms of life”:
Living Organisms Living Organisms -> Eukaryotic Living Organisms -> Eukaryotic -> Simple multicells or unicells Living Organisms -> Eukaryotic -> Multicellular Living Organisms -> Eukaryotic -> Multicellular -> Autotrophic Living Organisms -> Eukaryotic -> Multicellular -> ... Living Organisms -> Prokaryotic Living Organisms -> Prokaryotic -> Archaebacteria Living Organisms -> Prokaryotic -> Eubacteria Living Organisms -> Prokaryotic -> Eubacteria -> ...
Taxonomies can be quite large, sometimes in the tens of thousands (10,000+). And in sites with multiple languages, each title – or caption – must appear in translation.
Note that the selection of a term in the hierarchy implies the selection of all its parents. In the example above this means that if “Eubacteria” is selected, then also “Prokaryotic” and “Living Organisms” will be.
The implementation tries to meet the following requirements:
- Support many (10,000+) terms.
- Terms can be organized in a hierarchical classification.
- Easily import and export in a common format (VDEX).
- Taxonomies will provide vocabularies that are translateable.
- Use behaviors to provide a choice field for each taxonomy.
- Manage taxonomies and assign to content types “through-the-web”.
In the description below, we touch on each of these requirements.
In order to limit both the memory and computation requirements, the term data is contained in exactly one persistent index per language, a mapping from the materialized term path to its term identifier.
Living Organisms -> Eukaryotic -> Simple multicells or unicells
will be indexed under this path:
"Living Organisms/Eukaryotic/Simple multicells or unicells"
The index allows us to provide an iterator over the sorted vocabulary terms, virtually without cost (as well as containment queries).
At the same time, while the hierarchy is encoded, we can quickly look up terms in a subtree.
While collective.taxonomy (this package) does make it possible to create, manage and edit taxonomies from a browser-based interface, the primary focus is to support the exchange of terms in the VDEX format:
The IMS Vocabulary Definition Exchange (VDEX) specification defines a grammar for the exchange of value lists of various classes: collections often denoted “vocabulary”.
This exchange is integrated with GenericSetup which manages imports and exports using setup profiles. Is is also possible to use the controlpanel for importing and exporting VDEX files.
The package comes with integration for the Dexterity content type framework: for each taxonomy, a behavior is available that adds a choice field which pulls its vocabulary from the taxonomy. The behavior is configurable in terms of field name, title and whether it allows the selection of one or more multiple terms.
How does it work?
The main objective during this project has been to get a high rate of through-the-Web administration. Therefore the use of the product will not require any Python programming nor configure.zcml directives.
In the controlpanel (/@@taxonomy-settings), the user can:
- Import taxonomies from VDEX files.
- Export taxonomies existing to VDEX files.
- Delete taxonomies
- Add and delete behaviours for taxonomies
When a new behavior is created for a taxonomy, it can easily be added to the desired content types using the content type control panel, provided by Dexterity. After this is done, the taxonomy is available on add- and edit forms, and it is also available for collections, if plone.app.collection is used on the site. An index is also created, so the taxonomies can easily been used for catalog queries.
Frequently Asked Questions
How can I import an existing ATVocabularyManager vocabulary?
Use the script provided in this gist. Just remember to edit the vocabIdentifier and vocabName.
Will this product work with vanilla Plone?
No. The released version of Dexterity does not support dynamic interfaces for behaviors, which we need to use this product. Therefore this product require at least plone.dexterity from github master.
- Add a custom widget
- Make each taxonomy editable through the control panel.
- Make it possible to add multiple behaviors for each taxonomy.
In 2010, Rok Garbas <firstname.lastname@example.org> reimplemented and extended prior work by Seantis and released collective.vdexvocabulary. This package allows you to configure and populate vocabulary components from a VDEX-specification. The package supports flat vocabularies only, and support for multiple languages takes a different approach (vocabularies are returned in an already translated form). Note that vocabularies are loaded in a read-only mode, although it’s been proposed that vocabularies might be edited through-the-web.
In 2005, Jens Klein <email@example.com> released ATVocabularyManager. This package makes it possible to create taxonomies using Plone’s content management interface with terms existing as regular site content. It’s integrated with the Archetypes content type framework (now deprecated).
|||Term relationships are currently not supported.|