pyams_thesaurus.interfaces package ⊞

pyams_thesaurus.interfaces.ADMIN_THESAURUS_PERMISSION = 'pyams.AdminThesaurus'

Permission to administer all thesaurus properties

pyams_thesaurus.interfaces.CREATE_THESAURUS_PERMISSION = 'pyams.CreateThesaurus'

Permission to create thesaurus

pyams_thesaurus.interfaces.MANAGE_THESAURUS_CONTENT_PERMISSION = 'pyams.ManageThesaurusContent'

Permission to manage thesaurus contents

pyams_thesaurus.interfaces.MANAGE_THESAURUS_EXTRACT_PERMISSION = 'pyams.ManageThesaurusExtract'

Permission to manage thesaurus extract contents

pyams_thesaurus.interfaces.THESAURUS_ADMIN_ROLE = 'thesaurus.Admin'

Thesaurus admin is allowed to manage all thesaurus properties

pyams_thesaurus.interfaces.THESAURUS_EXTRACT_MANAGER_ROLE = 'thesaurus.ExtractManager'

Thesaurus extract manager is allowed to manager content of a thesaurus extract

pyams_thesaurus.interfaces.THESAURUS_MANAGER_ROLE = 'thesaurus.Manager'

Thesaurus manager is allowed to manage thesaurus terms and extracts

pyams_thesaurus.interfaces.extension

interface pyams_thesaurus.interfaces.extension.IThesaurusTermExtension[source]

Thesaurus term extension interface

An extension is a marker interface implemented by a term, which provides additional attributes to the term.

Each available extension is defined as a named utility.

label

Extension name

User name given to the extension

Implementation:zope.schema.TextLine
Read Only:False
Required:True
Default Value:None
Allowed Type:str
target_interface

Extension marker interface

target_view

Extension target view

Implementation:zope.schema.URI
Read Only:False
Required:True
Default Value:None
Allowed Type:str
icon

Extension icon URI

Implementation:zope.schema.URI
Read Only:False
Required:True
Default Value:None
Allowed Type:str

pyams_thesaurus.interfaces.index

interface pyams_thesaurus.interfaces.index.IThesaurusTermFieldIndex[source]

Thesaurus term field index interface

include_parents

Include term parents into index values

Implementation:zope.schema.Bool
Read Only:False
Required:False
Default Value:False
Allowed Type:bool
include_synonyms

Include term synonyms into index values

Implementation:zope.schema.Bool
Read Only:False
Required:False
Default Value:False
Allowed Type:bool
interface pyams_thesaurus.interfaces.index.IThesaurusTermsListFieldIndex[source]

Thesaurus terms list field index interface

include_parents

Include term parents into index values

Implementation:zope.schema.Bool
Read Only:False
Required:False
Default Value:False
Allowed Type:bool
include_synonyms

Include term synonyms into index values

Implementation:zope.schema.Bool
Read Only:False
Required:False
Default Value:False
Allowed Type:bool

pyams_thesaurus.interfaces.loader

pyams_thesaurus.interfaces.term

interface pyams_thesaurus.interfaces.term.IThesaurusLoaderTerm[source]

Marker interface for temporary thesaurus loader terms

interface pyams_thesaurus.interfaces.term.IThesaurusTerm[source]

Extends: zope.location.interfaces.IContained

Thesaurus term base interface

id

Internal ID

label

Term label

Full keyword for the given term

Implementation:zope.schema.TextLine
Read Only:False
Required:True
Default Value:None
Allowed Type:str
base_label

Base label without uppercase or accentuated character

title

Term external title

alt

Alternate label

Not to be confused with synonyms ‘usage’ label, given below…

Implementation:zope.schema.TextLine
Read Only:False
Required:False
Default Value:None
Allowed Type:str
definition

Definition

Long definition, mostly for complicated terms

Implementation:zope.schema.Text
Read Only:False
Required:False
Default Value:None
Allowed Type:str
note

Term’s application note

Application note for the given term

Implementation:zope.schema.Text
Read Only:False
Required:False
Default Value:None
Allowed Type:str
generic

Generic term

Parent generic term of the current term

Implementation:pyams_thesaurus.schema.ThesaurusTermField
Read Only:False
Required:False
Default Value:None
Must Provide:pyams_thesaurus.interfaces.term.IThesaurusTerm
order

Order

Term’s position between it’s siblings; default terms order is alphabetical

Implementation:zope.schema.Int
Read Only:False
Required:False
Default Value:None
Allowed Type:int
specifics

Specifics terms

Child more specifics terms of the current term

Implementation:pyams_thesaurus.schema.ThesaurusTermsListField
Read Only:False
Required:False
Default Value:None
Allowed Type:list

Value Type

Implementation:zope.schema.Object
Read Only:False
Required:True
Default Value:None
Must Provide:zope.interface.Interface
associations

Associated terms

Other terms associated to the current term

Implementation:pyams_thesaurus.schema.ThesaurusTermsListField
Read Only:False
Required:False
Default Value:None
Allowed Type:list

Value Type

Implementation:zope.schema.Object
Read Only:False
Required:True
Default Value:None
Must Provide:zope.interface.Interface
usage

Usage

For synonyms, specify here the term’s descriptor to use

Implementation:pyams_thesaurus.schema.ThesaurusTermField
Read Only:False
Required:False
Default Value:None
Must Provide:pyams_thesaurus.interfaces.term.IThesaurusTerm
used_for

Synonyms

For a given allowed descriptor, specify here the list of synonyms

Implementation:pyams_thesaurus.schema.ThesaurusTermsListField
Read Only:False
Required:False
Default Value:None
Allowed Type:list

Value Type

Implementation:zope.schema.Object
Read Only:False
Required:True
Default Value:None
Must Provide:zope.interface.Interface
extracts

Extracts

List of thesaurus extracts including this term

Implementation:pyams_thesaurus.schema.ValidatedSet
Read Only:False
Required:False
Default Value:None
Allowed Type:set

Value Type

Implementation:zope.schema.Choice
Read Only:False
Required:True
Default Value:None
extensions

Extensions

List of available extensions applied to this term

Implementation:zope.schema.Set
Read Only:False
Required:False
Default Value:None
Allowed Type:set

Value Type

Implementation:zope.schema.Choice
Read Only:False
Required:True
Default Value:None
status

Status

Term status

Implementation:zope.schema.Choice
Read Only:False
Required:True
Default Value:‘published’
level

Level

Term’s level in the thesaurus tree

Implementation:zope.schema.Int
Read Only:True
Required:True
Default Value:1
Allowed Type:int
micro_thesaurus

Micro-thesaurus?

Is the term part of a micro-thesaurus?

Implementation:zope.schema.Bool
Read Only:False
Required:False
Default Value:None
Allowed Type:bool
parent

First level parent

Parent at level 1 of the current term, or None

Implementation:pyams_thesaurus.schema.ThesaurusTermField
Read Only:False
Required:False
Default Value:None
Must Provide:pyams_thesaurus.interfaces.term.IThesaurusTerm
created

Creation date

Implementation:zope.schema.Datetime
Read Only:False
Required:False
Default Value:None
Allowed Type:datetime.datetime
modified

Modification date

Implementation:zope.schema.Datetime
Read Only:False
Required:False
Default Value:None
Allowed Type:datetime.datetime
add_extract(self, extract, check=True)

Add given extract to the list of term extracts

remove_extract(self, extract, check=True)

Remove given extract from the list of term extracts

query_extensions(self)

Get list of extension utilities

get_parents(self)

Get list of term’s parents

get_parent_childs(self)

Get ‘brother’s terms of current term

get_all_childs(self, terms=None, with_synonyms=False)

Get full list of term’s specifics

merge(self, term, configuration)

Merge term attributes with given term, to avoid overwriting all entity

interface pyams_thesaurus.interfaces.term.IThesaurusTermsContainer[source]

Extends: zope.container.interfaces.IContainer

Thesaurus terms container interface

pyams_thesaurus.interfaces.thesaurus

interface pyams_thesaurus.interfaces.thesaurus.IThesaurus[source]

Extends: pyams_thesaurus.interfaces.thesaurus.IThesaurusInfo, pyams_thesaurus.interfaces.thesaurus.IThesaurusRoles, zope.location.interfaces.IContained, zope.annotation.interfaces.IAttributeAnnotatable

Thesaurus interface

interface pyams_thesaurus.interfaces.thesaurus.IThesaurusContextManager[source]

Thesaurus terms manager interface

thesaurus_name

Thesaurus name

Implementation:zope.schema.Choice
Read Only:False
Required:False
Default Value:None
extract_name

Thesaurus extract

Implementation:zope.schema.Choice
Read Only:False
Required:False
Default Value:None
interface pyams_thesaurus.interfaces.thesaurus.IThesaurusContextManagerTarget[source]

Marker interface for tools managing thesaurus terms

interface pyams_thesaurus.interfaces.thesaurus.IThesaurusDescription[source]

Thesaurus base info

title

Title

Long title for this thesaurus

Implementation:zope.schema.TextLine
Read Only:False
Required:False
Default Value:None
Allowed Type:str
subject

Subject

Implementation:zope.schema.TextLine
Read Only:False
Required:False
Default Value:None
Allowed Type:str
description

Description

Implementation:zope.schema.Text
Read Only:False
Required:False
Default Value:None
Allowed Type:str
language

Language

Thesaurus’s language

Implementation:zope.schema.Choice
Read Only:False
Required:False
Default Value:‘en’
creator

Creator

Implementation:zope.schema.TextLine
Read Only:False
Required:False
Default Value:None
Allowed Type:str
publisher

Publisher

Implementation:zope.schema.TextLine
Read Only:False
Required:False
Default Value:None
Allowed Type:str
created

Creation date

Implementation:zope.schema.Date
Read Only:False
Required:False
Default Value:None
Allowed Type:datetime.date
interface pyams_thesaurus.interfaces.thesaurus.IThesaurusExtract[source]

Extends: pyams_thesaurus.interfaces.thesaurus.IThesaurusExtractInfo, pyams_thesaurus.interfaces.thesaurus.IThesaurusExtractRoles, zope.annotation.interfaces.IAttributeAnnotatable

Thesaurus extract info

interface pyams_thesaurus.interfaces.thesaurus.IThesaurusExtractInfo[source]

Thesaurus extract base info

name

Extract name

Implementation:zope.schema.TextLine
Read Only:False
Required:True
Default Value:None
Allowed Type:str
description

Description

Implementation:zope.schema.Text
Read Only:False
Required:False
Default Value:None
Allowed Type:str
abbreviation

Abbreviation

Short abbreviation used to distinguish the extract

Implementation:zope.schema.TextLine
Read Only:False
Required:True
Default Value:None
Allowed Type:str
color

Extract color

A color associated with this extract

Implementation:pyams_utils.schema.ColorField
Read Only:False
Required:True
Default Value:None
Allowed Type:str
add_term(self, term)

Add a term to this extract

remove_term(self, term)

Remove a term from this extract

interface pyams_thesaurus.interfaces.thesaurus.IThesaurusExtractRoles[source]

Thesaurus extract roles

managers

Extract managers

List of principals which can manage extract contents

Implementation:pyams_security.schema.PrincipalsSet
Read Only:False
Required:False
Default Value:None
Allowed Type:set
interface pyams_thesaurus.interfaces.thesaurus.IThesaurusExtracts[source]

Extends: zope.container.interfaces.IContainer

Thesaurus extracts container interface

__setitem__(key, value)

Add the given object to the container under the given name.

Raises a TypeError if the key is not a unicode or ascii string.

Raises a ValueError if the key is empty, or if the key contains a character which is not allowed in an object name.

Raises a KeyError if the key violates a uniqueness constraint.

The container might choose to add a different object than the one passed to this method.

If the object doesn’t implement IContained, then one of two things must be done:

  1. If the object implements ILocation, then the IContained interface must be declared for the object.
  2. Otherwise, a ContainedProxy is created for the object and stored.

The object’s __parent__ and __name__ attributes are set to the container and the given name.

If the old parent was None, then an IObjectAddedEvent is generated, otherwise, an IObjectMovedEvent is generated. An IContainerModifiedEvent is generated for the container.

If the object replaces another object, then the old object is deleted before the new object is added, unless the container vetos the replacement by raising an exception.

If the object’s __parent__ and __name__ were already set to the container and the name, then no events are generated and no hooks. This allows advanced clients to take over event generation.

interface pyams_thesaurus.interfaces.thesaurus.IThesaurusInfo[source]

Extends: pyams_thesaurus.interfaces.thesaurus.IThesaurusDescription

Thesaurus base info

name

Thesaurus name

Implementation:zope.schema.TextLine
Read Only:False
Required:True
Default Value:None
Allowed Type:str
terms

Thesaurus terms

top_terms

Thesaurus top-terms

List of top thesaurus terms, placed at first level

Implementation:zope.schema.List
Read Only:False
Required:False
Default Value:None
Allowed Type:list

Value Type

Implementation:zope.schema.Object
Read Only:False
Required:True
Default Value:None
Must Provide:pyams_thesaurus.interfaces.term.IThesaurusTerm
catalog

Thesaurus catalog

Inner thesaurus catalog, used for full-text indexing

Implementation:zope.schema.Object
Read Only:False
Required:True
Default Value:None
Must Provide:hypatia.interfaces.ICatalog
init_catalog(self)

Initialize thesaurus catalog

load(self, configuration)

Load contents from given configuration

merge(self, configuration, thesaurus=None)

Merge current thesaurus with another one for given configuration

reset_terms_parent(self)

Reset thesaurus terms parent attribute

get_top_terms(self, extract=None)

Get top terms, for given extract or for the whole thesaurus

reset_top_terms(self)

Reset thesaurus top terms

clear(self)

Clear thesaurus contents

find_terms(self, query=None, extract=None, glob='end', limit=None, exact=False, exact_only=False, stemmed=False)

Get terms matching given query and parent

@param query: the text query @param autoexpand: can be True, False on ‘on_miss’ (default) @param glob: can be ‘start’ (default), ‘end’, ‘both’ or None

delete(self)

Delete thesaurus

interface pyams_thesaurus.interfaces.thesaurus.IThesaurusManagerTarget[source]

Marker interface for contents managing thesaurus

interface pyams_thesaurus.interfaces.thesaurus.IThesaurusRoles[source]

Thesaurus roles interface

administrators

Administrators

List of thesaurus’s administrators

Implementation:pyams_security.schema.PrincipalsSet
Read Only:False
Required:False
Default Value:None
Allowed Type:set
managers

Contents managers

List of thesaurus’s contents contributors

Implementation:pyams_security.schema.PrincipalsSet
Read Only:False
Required:False
Default Value:None
Allowed Type:set
interface pyams_thesaurus.interfaces.thesaurus.IThesaurusTarget[source]

Marker interface for contents indexed on a thesaurus base