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 []
~~~~~~


---

** [bugs:#1645] Multi-claim source not parsed correctly**

**Status:** open
**Created:** Tue Jul 23, 2013 04:06 PM UTC by Felix Reimann
**Last Updated:** Tue Jul 23, 2013 04:06 PM UTC
**Owner:** nobody

>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


---

Sent from sourceforge.net because [email protected] is 
subscribed to https://sourceforge.net/p/pywikipediabot/bugs/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/pywikipediabot/admin/bugs/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.
_______________________________________________
Pywikipedia-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-bugs

Reply via email to