Last modified: 2014-02-01 17:07:18 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T56415, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 54415 - claimit.py: enable claim with the same property, but different value
claimit.py: enable claim with the same property, but different value
Status: RESOLVED FIXED
Product: Pywikibot
Classification: Unclassified
Wikidata (Other open bugs)
unspecified
All All
: Low enhancement
: ---
Assigned To: Pywikipedia bugs
gci2013 https://www.mediawiki.org/wik...
:
: 54542 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-21 03:34 UTC by Kunal Mehta (Legoktm)
Modified: 2014-02-01 17:07 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Kunal Mehta (Legoktm) 2013-09-21 03:34:58 UTC
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)
Comment 1 Kunal Mehta (Legoktm) 2013-09-21 03:35:00 UTC
slightly improved version, merged with the new "source" function



:::python

            for claim in self.claims:
                if claim.getID() in item.get().get('claims'):
                    for existingclaimwithproperty in item.claims[claim]:
                        if existingclaimwithproperty.getTarget() == claim.getTarget():
                            pywikibot.output("item for %s has already property %s with value %s" % (page.title(), claim, existingclaimwithproperty.getTarget()))
                            break
                        else:
                            continue
                    else:
                        pywikibot.output('Adding additional %s --> %s' % (claim.getID(), claim.getTarget()))
                        item.addClaim(claim)
                        source = self.getSource(page.site.language())
                        if self.source:
                            claim.addSource(self.source, bot=True)
                            # TODO FIXME: We need to check that we aren't adding a
                            # duplicate source

                else:
                    pywikibot.output('Adding %s --> %s'
                                     % (claim.getID(), claim.getTarget()))
                    item.addClaim(claim)
                    source = self.getSource(page.site.language())
                    if self.source:
                        claim.addSource(self.source, bot=True)
                    # TODO FIXME: We need to check that we aren't adding a
                    # duplicate source
Comment 2 Gerrit Notification Bot 2013-10-26 15:45:14 UTC
Change 92073 had a related patch set uploaded by Merlijn van Deen:
Enable adding statements on items with the same property, but different values.

https://gerrit.wikimedia.org/r/92073
Comment 3 Gerrit Notification Bot 2013-11-23 07:43:05 UTC
Change 97198 had a related patch set uploaded by Tholam:
Enable claims with the same property, but different value for claimit.py

https://gerrit.wikimedia.org/r/97198
Comment 4 Gerrit Notification Bot 2013-11-25 20:31:06 UTC
Change 92073 abandoned by Merlijn van Deen:
Enable adding statements on items with the same property, but different values.

Reason:
One of the GCI students has worked on this: https://gerrit.wikimedia.org/r/#/c/97198/

https://gerrit.wikimedia.org/r/92073
Comment 5 Gerrit Notification Bot 2013-11-28 12:55:04 UTC
Change 97198 merged by jenkins-bot:
Enable claims with the same property, but different value for claimit.py

https://gerrit.wikimedia.org/r/97198
Comment 6 Merlijn van Deen (test) 2014-02-01 17:07:18 UTC
*** Bug 54542 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links