Claims#
- class wikibaseintegrator.models.claims.Claims[source]#
Bases:
BaseModel- add(claims, action_if_exists=ActionIfExists.APPEND_OR_REPLACE)[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, 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. A claim marked as removed (see Claim.remove()) doesn’t count as existing for KEEP, and adding a claim equal to it cancels the removal, whatever the action, except FORCE_APPEND, which adds a new claim.
- Return type:
- Returns:
Return the updated Claims object.