wikibaseintegrator.models.claims
- class wikibaseintegrator.models.claims.Claim(qualifiers=None, rank=None, references=None, snaktype=WikibaseSnakType.KNOWN_VALUE)[source]
Bases:
BaseModel
- Parameters:
qualifiers (Optional[Qualifiers]) –
rank (Optional[WikibaseRank]) –
references (Optional[Union[References, List[Union[Claim, List[Claim]]]]]) –
snaktype (WikibaseSnakType) –
- DTYPE = 'claim'
- __init__(qualifiers=None, rank=None, references=None, snaktype=WikibaseSnakType.KNOWN_VALUE)[source]
- Parameters:
qualifiers (
Optional
[Qualifiers
]) –rank (
Optional
[WikibaseRank
]) –references (
Union
[References
,List
[Union
[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
- 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 (
Union
[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.