Page MenuHomePhabricator

Claim equality operator
Closed, ResolvedPublic


Similarly to T76547 , Claim objects should have equality operators, i.e. __ eq __ and __ ne __

Should the order of qualifiers / sources be relevant for equality? I feel like they should be relevant, however that would render these operators useless for typical usage in pywikibot.

Event Timeline

jayvdb raised the priority of this task from to Needs Triage.
jayvdb updated the task description. (Show Details)
jayvdb changed Security from none to None.
jayvdb added a project: Pywikibot-Wikidata.
jayvdb updated the task description. (Show Details)
jayvdb added a subscriber: jayvdb.

Now that there are equality operators for all allowed claim targets this should be easier to handle. With regards to order of qualifiers/sources and (statements in each source), per this discussion the order should not be assumed to carry any meaning. So we would probably want to disregard it.

My main question is if we want to include sources in the comparison. If you want to check if an existing claim is the same as that in another source then it isn't useful to include the source in the comparison. On the other hand, yes it is part of the claim.

A Statement consists of two parts: a claim that something is the case (e.g., the claim "Berlin has a population of 3,499,879") and a list of references for that claim (e.g., a publication by the statistical office for Berlin-Brandenburg).[1]


In other words, references (sources) are not part of a claim.

Thanks. That strengthens my belief that they should not be included in a comparison.
What speaks for them being included though is that they are properties of the pywikibot.Claim object (which is thus an hybrid of a claim and a statement)

Change 378987 had a related patch set uploaded (by Matěj Suchánek; owner: Matěj Suchánek):
[pywikibot/core@master] Implement Claim.eq

matej_suchanek triaged this task as Low priority.
matej_suchanek added a project: Pywikibot.

Change 378987 merged by jenkins-bot:
[pywikibot/core@master] Implement Claim.eq

After this merged I'm getting downstream errors because Claim is now an unhashable type.