A tagging engine allows you to assign tags to any type of object by an user. A tag is a simple string.
>>> from lovely import tag
The tagging engine provides the capabilities to manipulate and and query tagged items.
>>> engine = tag.TaggingEngine()
The first step is to associate tags with an item for a user. Items are referenced by their intId, the user is a system-wide unique string and the tags is a simple list of strings.
Before updating the engine we need to ensure that persistent objects can be adapted to key references:
>>> import zope.component
>>> from zope.app.keyreference import testing
Instead providing a separate API for adding and updating tags, both actions are done via the update() method. Think of it as updating the tagging engine.
>>> engine.update(1, u'srichter', [u'USA', u'personal'])
>>> engine.update(2, u'srichter', [u'austria', u'lovely'])
>>> engine.update(3, u'jodok', [u'Austria', u'personal'])
>>> engine.update(2, u'jodok', [u'austria', u'lovely', u'work'])
Next you can ask the engine several questions.