Package: collective.taxonomy
Taxonomy VocabulariesCreate, edit and use hierarchical taxonomies inPlone.This add-on provides support for hierarchical taxonomies in multiple
languages, letting users easily associate existing content with terms
from one or more taxonomies.Taxonomyis 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 – orcaption– 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.OverviewThe 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 translatable.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.Data structureIn order to limit both the memory and computation requirements, the
term data is contained in exactly one persistent index per language, a
mapping from thematerialized term pathto itsterm identifier.The term:Living Organisms -> Eukaryotic -> Simple multicells or unicellswill 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.Note: Ascollective.taxonomyuses slash as separator, you have to
monkey patch thePATH_SEPARATORconstant if you want to use ‘/’ in
your terms.Data exchangeWhilecollective.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:TheIMS 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 withGenericSetupwhich manages
imports and exports using setup profiles. It is also possible to
use the control panel for importing and exporting VDEX files.The package comes with integration for theDexteritycontent type framework:
for each taxonomy, abehavioris 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.  You shouldfirstinstall
dexterity and thencollective.taxonomy, otherwise the behaviors
for the existing taxonomies will be missing.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 norconfigure.zcmldirectives.In the control panel (/@@taxonomy-settings), the user can:Import taxonomies from VDEX files.Export taxonomies existing to VDEX files.Delete taxonomiesAdd and delete behaviors for taxonomiesWhen 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, ifplone.app.collectionis used on the site. An index is also created, so the taxonomies can easily
be used for catalog queries.Please read the detailedGetting Started TutorialReact/Redux app to edit taxonomiesThe view@@taxonomy-edit-datathat allow users to edit the taxonomy data
is a React/Redux app (the source code is in thejavascriptsdirectory.Here’s a preview of this view:The languages allowed for the taxonomies are the languages defined inportal_languages.DevelopmentRun the app, runnpm startin thejavascriptsdirectory.
To make Plone use the development code, you need theNODE_ENVenvironment
variable to be set todevelopment:NODE_ENV=development bin/instance fgi18nThe app usesreact-intlto handle i18n.
To translate the app, add a new language in the translations directory. For example,
create aesfile in the translations directory that contains:const es = {
    submitLabel: 'Enviar',
}

export default esThen, edittranslations/index.jsto add the language to the translations object:import es from './es'

const translations = {
    es,
    fr
}You’ll have to rebuild the js bundle:npm run buildThat’s it!Restapi supportThis package also supports endpoints for basic CRUD operations that can be consumend by any frontend service.The API consumer can create, read, and delete taxonomies.VerbURLActionPOST/@taxonomyAdd taxonomy with specific dataGET/@taxonomyList all taxonomiesGET/@taxonomy/{name}Get taxonomy dataDELETE/@taxonomy/{name}Remove one or more taxonomiesPATCH/@taxonomy/{name}Update taxonomy dataGET/@taxonomySchemaGet current taxonomy schemaTranslationsThis product has been translated intoDanish.German.French.Spanish.You can contribute for any message missing or other new languages, join us atPlone Collective TeamintoTransifex.netservice with all world Plone translators community.Plone Version Compatibilitycollective.taxonomy version3.xPlone 6.0 (py3)collective.taxonomy version2.xPlone 5.2 (py2/py3)Plone 5.1Plone 5.0collective.taxonomy version1.xPlone 4.3or an older version using a recent version ofplone.dexterity/plone.app.dexterityFrequently Asked QuestionsHow can I import an existingATVocabularyManagervocabulary?Use the script provided in thisgist. Just
remember to edit the vocabIdentifier and vocabName.ContributeHave an idea? Found a bug? Let us know byopening a ticket.Issue Tracker:https://github.com/collective/collective.taxonomy/issuesSource Code:https://github.com/collective/collective.taxonomyContributorsAuthorBo Simonsen <bo@headnet.dk>ContributorsMalthe Borch <mborch@gmail.com>Thomas Clement Mogensen <thomas@headnet.dk>Thomas Desvenain <thomas.desvenain@gmail.com>Maurits van Rees <maurits@vanrees.org>Cédric Messiant <cedric.messiant@gmail.com>Leonardo J. Caballero G. <leonardocaballero@gmail.com>Peter Mathis <peter.mathis@kombinat.at>Existing workIn 2010, Rok Garbas <rok@garbas.si> reimplemented and extended prior
work bySeantisand releasedcollective.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 <jens.klein@bluedynamics.com> releasedATVocabularyManager. 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 theArchetypescontent
type framework (now deprecated).[1]Term relationships are currently not supported.LicenseThe project is licensed under the GPL v2 or later (GPLv2+).Changes3.1 (2023-05-26)Integrate taxonomies into Collection tabular view, display values are now resolved
[MrTango]Restapi endpoints support [cekk, nileshgulia1]3.0.1 (2023-02-02)export/import of field_prefix value.
[eikichi18]3.0.0 (2022-12-13)Fix deprecatedcollections.IterableinTaxonomyIndexerWrapper. This got
removed since python 3.10. Importingcollections.abc.Iterablenow.
[petschki]Add misingfetch_vocabularyrecord for IQueryField
This was introduced in plone.app.querystring 1.5.0
[laulaz]more markup updates to Bootstrap 5.
[petschki]3.0.0a1 (2022-07-13)Fix configlet icon for Plone 6 (#135)
[laulaz]update markup inedittaxonomydata.jsto Bootstrap 5
[petschki]2.2.2 (2022-07-12)Use new ‘Manage taxonomies’ permission for taxonomies configlet (#134)
Permission is by default assigned to Manager and Site Administrator roles.
[laulaz]Fixed ‘Required’ and ‘Single select’ option being compulsory [JeffersonBledsoe] (#131)2.2.1 (2022-03-30)Fix taxonomy data edition when using Gunicorn WSGI (#123)
[laulaz]Implemented possibility to change the IDs. [Petchesi-Iulian] (#113)Added contraints to not allow duplicate IDs. [Petchesi-Iulian] (#113)Improved the editing interface. [Petchesi-Iulian] (#113)Updated the documentation and tutorial. [Petchesi-Iulian] (#113)2.2.0 (2021-12-13)Refactor import of synchronized decorator [1letter] (#120)2.1.1 (2021-11-23)Wrap strings in list while indexing to correctly index single-select taxonomies. [adrianschulz] (#108)Plone 6 / pip install ready [avoinea] (#114)2.1.0 (2021-05-27)Fix GenericSetup export in python2
[gotcha]Integrate taxonomies into collective.collectionfilter
[MrTango]2.0.1 (2020-07-04)Add a tutorial
[rodfersou]Add Cypress test
[rodfersou]Fix translating msgid when portal language is not found in taxonomy
[petschki, rodfersou]Fix JavaScript ininput_widget.ptwhich had python comments
[petschki]Add Transifex.net service integration to manage the translation process
[macagua]Added Spanish translation
[macagua]Updated the i18n support
[macagua]Added license documentation of package
[macagua]2.0.0 (2019-11-25)add uninstall handler to cleanup persistent utilites and generated behaviors
[petschki]Fix GenericSetup import/export in python3
[erral]Use taxonomy default language for indexing if current language is not available
[agitator]Make generated behaviors language independent
[agitator]export selected taxonomies as ZIPed folder with XML files
[petschki]Python 3 compatibility
[petschki, agitator]1.5.1 (2018-10-25)Fix bug in cachekey generator
[petschki]1.5.0 (2018-10-18)Fix controlpanel to show settings navigation
[petschki]Memoize vocabulary lookup
[tomgross, petschki]Fix #53 when editing taxonomy data the first time
[petschki]Update german translations
[petschki]Add uninstall profile
[petschki]When using “delete” option on import, clear any previous ordering.
[malthe]Add support for specifying behavior field prefix.
[malthe]ThegetTermByTokenmethod now accepts an optional argumenttail_onlywhich if set, returns a message object where the title
translates to the last path segment (the “tail” node).
[malthe]Added new methodmakeTreeon taxonomy vocabulary class which
returns a term tree.
[malthe]Support “slash” character in term title (issue #34).
[malthe]When uploading a taxonomy there is now an option to purge the
existing entries prior to processing.
[malthe]Taxonomies are now assigned a persistent order. Taxonomies imported
from VDEX now preserve the ordering of the input document.
[malthe]Add new methoditerEntrieson taxonomy vocabulary class that
provides a safe way to iterate over the path to identifier mapping
(in order).
[malthe]Vocabulary is a IVocabularyTokenized implementer.
[cedricmessiant]updateBehavior method can now modify other attributes (and not onlyfield_title).
[cedricmessiant]Add explicit dependency on plone.api >= 1.5 which
the api.portal.get_current_language api was introduced.
[vincentfretin]Add german translation
[tomgross]Mention Plone 5.0 and 5.1 compatibility
[tkimnguyen]Enable choosing what fieldset to use for the behavior fields. Fallback to categorization,
keeping backwards compatibility.
[sunew]Change to no longer register exampleTest-taxonomy on install
[datakurre]Fix issue where taxonomy indexer adapter was not properly unregistered from
the persistent local registry on taxonomy removal
[datakurre]Fix issue where public ++taxonomy++short_name -traverser for returning
generator of (key, label) tuples for given taxonomy was broken
[datakurre]1.4.4 (2016-11-29)Fix taxonomy export that was broken since 1.4.0.
[vincentfretin]1.4.3 (2016-11-29)Fix save action to work on Plone 5 (by reading portal url from
body[data-portal-url] and adding X-CSRF-TOKEN for post requests
[datakurre]Fix BehaviorRegistrationNotFound error with Plone 5.0.6
[tomgross]Use lxml instead of elementtree
[tomgross]Rename fontello font to taxonomy to avoid clash with Plone 5 theme
[vincentfretin]1.4.2 (2016-11-08)Fix save action in edit-taxonomy-data. This was a regression in 1.4.0, the
get parameter should be taxonomy, not form.widgets.taxonomy.
[cedricmessiant]1.4.1 (2016-11-03)Remove Save and Cancel buttons in controlpanel introduced 1.4.0.
[vincentfretin]Add missing upgrade step to create records in registry.
[vincentfretin]1.4.0 (2016-11-03)Getting language by acquisition, indeed some Dexterity content has no language or empty language.
[bsuttor]Fix empty context.REQUEST.get(‘form.widgets.taxonomy’). It add it into POST form.
[bsuttor]Plone 5 compatibility
[tomgross]Use context language to find index.
[bsuttor]1.3.0 (2016-07-07)Fix index when taxonomy is added as field.
[bsuttor]Now uses a React/Redux app to edit taxonomy data. It is now possible to edit
the data in multiple languages and to compare between languages.
[cedricmessiant]Fix index when taxonomy is added as field.
[bsuttor]Now uses a React/Redux app to edit taxonomy data. It is now possible to edit
the data in multiple languages and to compare between languages.
[cedricmessiant]Add PATH_SEPARATOR constant to be able to use ‘/’ character in terms.
[cedricmessiant]Add ++taxonomy++[shortname] -traverser to be usable with PloneFormGen
dynamic field vocabulary overrides
[datakurre]prevent taxonomy reset on reinstall if you’ve defined a vdex xml file
in your profile
[petschki]Plone 5 compatibility
[tomgross]1.2.3 (2014-02-07)ConfigParser supports allow_no_value on Python 2.6, so we cannot allow empty values,
only on 2.7 or newer.
[bosim]1.2.2 (2014-01-03)Bugfix releaseFixed problem with registration of search citeria in collections, the previous
registration broke export feature of plone.app.registry. Upgrade step has been
added so please upgrade.
[bosim]1.2.1 (2013-11-12)Bugfix release, please upgradeUsing Schema from plone.supermodel. Fixes issue #6
[bosim]Rewrote behavior creation routine. Fixes issue #5
[bosim]1.2 (2013-11-12)Add collective.js.jqueryui as dependency.  Install it automatically.
[maurits]i18n fixes,
messages extraction script,
french translation.
[thomasdesvenain]Fixed error in vdex import.
[thomasdesvenain]Avoid failure at export when no default language was selected.
[thomasdesvenain]Remove dependency form plone.directives
[thomasdesvenain]Added elementtree in dependencies
[thomasdesvenain]1.1 (2013-07-16)Taxonomies can now be added without uploading a VDEX file.
[bosim]Taxonomies can be exported/imported via GenericSetup again.
[bosim]Single select fields are now possible again.
[bosim]1.0 (2013-05-07)Initial release
[bosim]