BaseEntity#
- class wikibaseintegrator.entities.baseentity.BaseEntity(api=None, title=None, pageid=None, lastrevid=None, type=None, id=None, claims=None, is_bot=None, login=None)[source]#
Bases:
object- add_claims(claims, action_if_exists=ActionIfExists.APPEND_OR_REPLACE)[source]#
- Parameters:
claims (
Claim|list[Claim] |Claims) – A Claim, list of Claim or just a Claims object to add to the claims of this entity.action_if_exists (
ActionIfExists, default:ActionIfExists.APPEND_OR_REPLACE) – What to do when the property already has claims. Two claims are equal when they have the same property, value and qualifiers (the rank and the references are not compared). Defaults to APPEND_OR_REPLACE. APPEND_OR_REPLACE: Add the new claim if no equal claim exists. Otherwise, update the equal claim in place (same statement) instead of adding a duplicate: it takes the rank of the new claim if set (not normal), and its references if it has some (they replace the existing references). The other claims of the property are kept. MERGE_REFS_OR_APPEND: Add the new claim if no equal claim exists. Otherwise, add the references of the new claim missing from the equal claim. The other claims of the property are kept. FORCE_APPEND: Always add the new claim, even if an equal claim exists (duplicate statement). KEEP: Add the new claim only if the property has no claim yet, otherwise do nothing. REPLACE_ALL: Remove the claims of the property that are not equal to one of the new claims, then add the new claims not already present. The equal claims are kept as they are.
- Return type:
- Returns:
Return the updated entity object.
- clear(**kwargs)[source]#
Use the clear parameter of wbeditentity API call to clear the content of the entity. The entity will be updated with an empty dictionary.
- delete(login=None, allow_anonymous=False, is_bot=None, **kwargs)[source]#
Delete the current entity. Use the pageid first if available and fallback to the page title.
- Parameters:
login (
_Login|None, default:None) – A wbi_login.Login instanceallow_anonymous (
bool, default:False) – Allow an unidentified edit to the MediaWiki API (default False)is_bot (
bool|None, default:None) – Flag the edit as a botreason – Reason for the deletion. If not set, an automatically generated reason will be used.
deletetalk – Delete the talk page, if it exists.
kwargs (
Any) – Any additional keyword arguments to pass to mediawiki_api_call_helper and requests.request
- Return type:
- Returns:
The data returned by the API as a dictionary
- get_claims(property, login=None, allow_anonymous=True, is_bot=None, **kwargs)[source]#
Load the claims of a property from the Wikibase instance. They replace the claims of this property already loaded, unsaved changes included, so calling it again refreshes them instead of duplicating them.
- Parameters:
- Return type:
- Returns:
This entity
- write_required(base_filter, action_if_exists=ActionIfExists.REPLACE_ALL, **kwargs)[source]#
- Return type:
- ETYPE = 'base-entity'#
- property api: WikibaseIntegrator#