wikibaseintegrator.models.lemmas

class wikibaseintegrator.models.lemmas.Lemmas[source]

Bases: LanguageValues

__init__()
Return type:

None

add(language_value)

Add a LanguageValue object to the list

Parameters:

language_value (LanguageValue) – A LanguageValue object

Return type:

LanguageValues

Returns:

The current LanguageValues object

from_json(json_data)[source]

Create a new Lemmas object from a JSON/dict object.

Parameters:

json_data (Dict[str, Dict]) – A dict object who use the same format as Wikibase.

Return type:

Lemmas

Returns:

The newly created or updated object.

get(language=None)

Get a LanguageValue object with the specified language. Use the default language in wbi_config if none specified.

Parameters:

language (Optional[str]) – The requested language.

Return type:

Optional[LanguageValue]

Returns:

The related LanguageValue object or None if none found.

get_json()

Get a formatted dict who respect the Wikibase format.

Return type:

Dict[str, Dict]

Returns:

A dict using Wikibase format.

set(language=None, value=None, action_if_exists=ActionIfExists.REPLACE_ALL)

Create or update the specified language with the valued passed in arguments.

Parameters:
  • language (Optional[str]) – The desired language.

  • value (Optional[str]) – The desired value of the LanguageValue object. Use None to delete an existing LanguageValue object from the list.

  • action_if_exists (ActionIfExists) – The action if the LanguageValue object is already defined. Can be ActionIfExists.REPLACE_ALL (default) or ActionIfExists.KEEP.

Return type:

Optional[LanguageValue]

Returns:

The created or updated LanguageValue. None if there’s no LanguageValue object with this language.

property values: Dict[str, LanguageValue]

A dict of LanguageValue with the language as key.