wikibaseintegrator.models.claims
- class wikibaseintegrator.models.claims.Claim(qualifiers=None, rank=None, references=None, snaktype=WikibaseSnakType.KNOWN_VALUE)[source]
Bases:
BaseModel
- Parameters:
qualifiers (Qualifiers | None)
rank (WikibaseRank | None)
references (References | list[Claim | list[Claim]] | None)
snaktype (WikibaseSnakType)
- DTYPE = 'claim'
- __init__(qualifiers=None, rank=None, references=None, snaktype=WikibaseSnakType.KNOWN_VALUE)[source]
- Parameters:
qualifiers (
Qualifiers
|None
)rank (
WikibaseRank
|None
)references (
References
|list
[Claim
|list
[Claim
]] |None
) – A References object, a list of Claim object or a list of list of Claim objectsnaktype (
WikibaseSnakType
)
- Return type:
None
- equals(that, include_ref=False, fref=None)[source]
Tests for equality of two statements. If comparing references, the order of the arguments matters!!! self is the current statement, the next argument is the new statement. Allows passing in a function to use to compare the references ‘fref’. Default is equality. fref accepts two arguments ‘oldrefs’ and ‘newrefs’, each of which are a list of references, where each reference is a list of statements
- Return type:
bool
- Parameters:
that (Claim)
include_ref (bool)
fref (Callable | None)
- from_json(json_data)[source]
- Parameters:
json_data (
dict
[str
,Any
]) – a JSON representation of a Claim- Return type:
- property id: str | None
- property qualifiers: Qualifiers
- property qualifiers_order: list[str]
- property rank: WikibaseRank
- static ref_present(olditem, newitem)[source]
Tests if (1) there is a single ref in the new item and (2) if this single ref is present among the claims of the old item.
- property references: References
- property removed: bool
- property type: str | dict
- class wikibaseintegrator.models.claims.Claims[source]
Bases:
BaseModel
- add(claims, action_if_exists=ActionIfExists.REPLACE_ALL)[source]
- Parameters:
claims (
Claims
|list
[Claim
] |Claim
) – A Claim, list of Claim or just a Claims object to add to this Claims object.action_if_exists (
ActionIfExists
) – Replace or append the statement. You can force an addition if the declaration already exists. Defaults to REPLACE_ALL. KEEP: The original claim will be kept and the new one will not be added (because there is already one with this property number) APPEND_OR_REPLACE: The new claim will be added only if the new one is different (by comparing values) FORCE_APPEND: The new claim will be added even if already exists REPLACE_ALL: The new claim will replace the old one
- Return type:
- Returns:
Return the updated Claims object.