https://bugzilla.wikimedia.org/show_bug.cgi?id=54415
Web browser: --- Bug ID: 54415 Summary: claimit.py: enable claim with the same property, but different value Product: Pywikibot Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: Unprioritized Component: General Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: legoktm.wikipedia@gmail.com Classification: Unclassified Mobile Platform: ---
Originally from: http://sourceforge.net/p/pywikipediabot/feature-requests/349/ Reported by: apac1 Created on: 2013-09-15 16:15:03.602000 Subject: claimit.py: enable claim with the same property, but different value Original labels: claimit.py, wikidata, enhancement, python, pywikibotOriginal description: The below can be added to claimit.py to enable adding statements on items with the same property, but different values.
https://github.com/wikimedia/pywikibot-core/blob/master/scripts/claimit.py
:::python
for claim in self.claims: if claim.getID() in item.get().get('claims'): propertytoadd = claim.getID() for valueofproperty in item.claims[propertytoadd]: if valueofproperty.getTarget() == claim.getTarget(): pywikibot.output("item for %s has already property %s with value %s" % (page.title(), propertytoadd, valueofproperty.getTarget())) break else: continue else: pywikibot.output('Adding additional %s --> %s' % (claim.getID(), claim.getTarget())) item.addClaim(claim)
else: pywikibot.output('Adding %s --> %s' % (claim.getID(), claim.getTarget())) item.addClaim(claim)