Last modified: 2013-10-05 11:11:19 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 T57132, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 55132 - Multi-claim source not parsed correctly
Multi-claim source not parsed correctly
Status: RESOLVED FIXED
Product: Pywikibot
Classification: Unclassified
Wikidata (Other open bugs)
unspecified
All All
: Unprioritized normal
: ---
Assigned To: Pywikipedia bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-05 04:29 UTC by Kunal Mehta (Legoktm)
Modified: 2013-10-05 11:11 UTC (History)
1 user (show)

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


Attachments
Copy of attachment from http://sourceforge.net/p/pywikipediabot/bugs/1645/attachment/patch.txt (1.16 KB, text/plain)
2013-10-05 04:29 UTC, Kunal Mehta (Legoktm)
Details

Description Kunal Mehta (Legoktm) 2013-10-05 04:29:46 UTC
Originally from: http://sourceforge.net/p/pywikipediabot/bugs/1645/
Reported by: felixreimann
Created on: 2013-07-23 16:06:40.404000
Subject: Multi-claim source not parsed correctly
Original description:
From a source with multiple claims, only the first claim is collected by page.py. All other claims of the source are not accessible per claim.sources.

Example:
~~~~~~
:::python
site = pywikibot.getSite('en', 'wikipedia')
repo = site.data_repository()
item = pywikibot.ItemPage(repo, "Q138028")
dictionary = data.get()
print subclaims[0].sources
~~~~~~

results in:
**[Claim(Property:P143), Claim(Property:P248)]**

P577 and P585 from the second source of http://www.wikidata.org/wiki/Q138028 P225 are missing.

With the attached patch the same code results in
**[[Claim(Property:P143)], [Claim(Property:P248), Claim(Property:P577), Claim(Property:P585)]]**

However, backward compatibility is not given, as the data type of Claim.sources is changed from list of Claims to list of list of Claims. This corresponds to the Wikidata layout allowing more than one claim per source.

GIT revision: 96e7c88e2ff03f88b320cc65b729776b80ea5624
Comment 1 Kunal Mehta (Legoktm) 2013-10-05 04:29:48 UTC
Sorry, forgot one line in python example code, insert before last line:

~~~~~~
:::python
subclaims = [ subclaim for subclaim in data.claims['p225'] ] if 'p225' in data.claims else []
~~~~~~
Comment 2 Kunal Mehta (Legoktm) 2013-10-05 04:29:50 UTC
Bug fixed, see https://gerrit.wikimedia.org/r/#/c/81219/
fix merged:
commit 4e516b587258f08f9947d4a11b2e67fcc1b5d3ea
Date:   Tue Aug 27 15:11:43 2013 +0200

Can be closed.
Comment 3 Kunal Mehta (Legoktm) 2013-10-05 04:29:56 UTC
Created attachment 13439 [details]
Copy of attachment from http://sourceforge.net/p/pywikipediabot/bugs/1645/attachment/patch.txt

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


Navigation
Links