wikibaseintegrator.models.claims

class wikibaseintegrator.models.claims.Claim(qualifiers=None, rank=None, references=None, snaktype=WikibaseSnakType.KNOWN_VALUE)[source]

Bases: BaseModel

Parameters:
DTYPE = 'claim'
__init__(qualifiers=None, rank=None, references=None, snaktype=WikibaseSnakType.KNOWN_VALUE)[source]
Parameters:
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:

Claim

get_json()[source]
Return type:

Dict[str, Any]

abstract get_sparql_value()[source]
Return type:

str

has_equal_qualifiers(other)[source]
Return type:

bool

Parameters:

other (Claim) –

property id: str | None
property mainsnak: Snak
property qualifiers: Qualifiers
property qualifiers_order: List[str]
property rank: WikibaseRank
property references: References
static refs_equal(olditem, newitem)[source]

tests for exactly identical references

Return type:

bool

Parameters:
remove(remove=True)[source]
Return type:

None

property removed: bool
property type: str | Dict
update(claim)[source]
Return type:

None

Parameters:

claim (Claim) –

class wikibaseintegrator.models.claims.Claims[source]

Bases: BaseModel

__init__()[source]
Return type:

None

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:

Claims

Returns:

Return the updated Claims object.

property claims: Dict[str, List[Claim]]
from_json(json_data)[source]
Return type:

Claims

Parameters:

json_data (Dict[str, Any]) –

get(property)[source]
Return type:

List[Claim]

Parameters:

property (str) –

get_json()[source]
Return type:

Dict[str, List]

remove(property=None)[source]
Return type:

None

Parameters:

property (str | None) –