On 10/12/14 7:20 AM, Maarten Dammers wrote:
Hi guys,
I'm wondering how to add references that have multiple parts. Take for
example
https://www.wikidata.org/wiki/Q76 (Barack Obama). The third
reference of date of birth has two parts:
* "stated in" -> "Integrated Authority File"
* "date retrieved" -> "9 April 2014"
Currently a reference in our implementation is a special claim [1]. I'm
pretty sure the left hand side of a claim is always one property (for
example "date of birth"), with references this can be multiple (for
example "stated in" and "date retrieved"). Am I missing something or
should we change our implementation?
Claim.sources is a list of lists of references:
>> i=pywikibot.ItemPage(d, 'Q76')
>> i.get()
>> i.claims['P21'][0].sources
[OrderedDict([(u'P143',
[<pywikibot.page.Claim instance at
0x10fb0f170>])]), OrderedDict([(u'P248', [<pywikibot.page.Claim instance
at 0x10fb0f290>]), (u'P813', [<pywikibot.page.Claim instance at
0x10fb0f440>])]), OrderedDict([(u'P248', [<pywikibot.page.Claim instance
at 0x10fb0f4d0>])])]
>> i.claims['P21'][0].sources[1]
OrderedDict([(u'P248', [<pywikibot.page.Claim instance at
0x10fb0f290>]), (u'P813', [<pywikibot.page.Claim instance at
0x10fb0f440>])])
We could probably improve our implementation by having a ReferenceList
object or something.
-- legoktm