================
Local Vocabulary
================

:Revision: $Id: localvocabulary.txt 30589 2005-12-13 19:19:39Z dkuhlman $

.. sectnum::    :depth: 4
.. contents::   :depth: 4


Architecture
============

There are local vocabulary container and local vocabulary.
By default container is created with id '.cps_vocabularies'

Local vocabulary has two string properties that control behaviour how
values for given local vocabulary are computed, they are:

- inheritance_type - may be 'inherit' or 'global'

- merge_behaviour - 'None' which is actually empty string or
  'union'. Future possible additions are 'intersection' and
  'difference'.

Combining values of above two properties we define the way how we
are going get values for our local vocabulary.

Case 1
------

Local vocabulary with given id is present in local vocabulary
container.

1. inheritance_type = 'inherit' AND merge_behaviour = 'None'

   Only the content of this local vocabulary is used.

2. inheritance_type = 'inherit' AND merge_behaviour = 'union'

   Union with the 'above' local vocabulary, which itself may be
   defined as it sees fit.

3. inheritance_type = 'global' AND merge_behaviour = 'None'

   Local vocabulary is ignored and the global one is used.

4. inheritance_type = 'global' AND merge_behaviour = 'union'

   Union with the global vocabulary


Local vocabulary container itself has the same two properties as
local vocabulary, which are used to determine behaviour in case
there is no local vocabulary with given id in container, so we
have case 2.

Case 2
------

There is no local vocabulary with given id in container. Further
behaviour is defined by properties of container. In this case only
inheritance_type does matter.

1. inheritance_type = 'inherit'

   Use 'above' local vocabulary, which itself may be defined as it
   sees fit.

2. inheritance_type = 'global'

   Use global vocabulary.

N.B. The global vocabulary always will be the default when inheriting and
nothing is found in the above containers.


ZMI
===

From the ZMI, you can add local vocabulary container, which will
have a 'Global vocabularies' tab that lists all global
vocabularies you can customize.  After creation you can edit local
vocabulary same as global one.


API
===

VocabulariesTool provides method ``getVocabularyFor(context. voc_id)``
that returns local vocabulary for passed context.


.. Emacs
.. Local Variables:
.. mode: rst
.. End:
.. Vim
.. vim: set filetype=rst:

