wikibaseintegrator.models.forms
- class wikibaseintegrator.models.forms.Form(form_id=None, representations=None, grammatical_features=None, claims=None)[source]
Bases:
BaseModel
- Parameters:
form_id (str | None)
representations (Representations | None)
grammatical_features (str | int | list[str] | None)
claims (Claims | None)
- __init__(form_id=None, representations=None, grammatical_features=None, claims=None)[source]
- Parameters:
form_id (str | None)
representations (Representations | None)
grammatical_features (str | int | list[str] | None)
claims (Claims | None)
- property claims
- property grammatical_features
- property id
- property representations
- class wikibaseintegrator.models.forms.Representations[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:
- Returns:
The current LanguageValues object
- from_json(json_data)
Create a new LanguageValues object from a JSON/dict object.
- Parameters:
json_data (
dict
[str
,dict
]) – A dict object who use the same format as Wikibase.- Return type:
- 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 (
str
|None
) – The requested language.- Return type:
LanguageValue
|None
- 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 (
str
|None
) – The desired language.value (
str
|None
) – 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:
LanguageValue
|None
- 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.