Claim#

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

Bases: BaseModel

extend wikibaseintegrator.models.basemodel.BaseModel()

Parameters:
  • qualifiers (Qualifiers | None, default: None)

  • id (str | None, default: None)

  • rank (WikibaseRank | None, default: None)

  • references (References | list[Claim | list[Claim]] | None, default: None) – A References object, a list of Claim object or a list of list of Claim object

  • qualifiers

  • rank

  • references – A References object, a list of Claim object or a list of list of Claim object

  • snaktype (WikibaseSnakType, default: WikibaseSnakType.KNOWN_VALUE)

static quals_equal(olditem, newitem)[source]#

Tests for exactly identical qualifiers.

Return type:

bool

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.

Return type:

bool

static refs_equal(olditem, newitem)[source]#

tests for exactly identical references

Return type:

bool

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

from_json(json_data)[source]#
Parameters:

json_data (dict[str, Any]) – a JSON representation of a Claim

Return type:

Self

get_json()[source]#
Return type:

dict[str, Any]

abstractmethod get_sparql_value(**kwargs)[source]#
Return type:

str | None

has_equal_qualifiers(other)[source]#

Test if the two claims have the same qualifiers, whatever their order. Each qualifier must match a distinct qualifier of the other claim: P2: [a, a] and P2: [a, b] differ.

Return type:

bool

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

None

reset_id()[source]#

Reset the ID of the current claim

Return type:

None

update(claim)[source]#

Update this claim with the data of an equal claim (same value and qualifiers). The rank and the references are only taken from the new claim when it sets them, so re-adding an existing value doesn’t reset its rank or drop its references.

Parameters:

claim (Claim) – The claim to take the data from.

Return type:

None

DTYPE = 'claim'#
property id: str | None#
property mainsnak: Snak#
property qualifiers: Qualifiers#
property qualifiers_order: list[str]#
property rank: WikibaseRank#
property references: References#
property removed: bool#
property type: str | dict#