I have never worked with rewrite branch. Any chance someone could add support of claims with sources to the main branch?
Jarek T. User:Jarekt From: [email protected] [mailto:[email protected]] On Behalf Of legoktm Sent: Wednesday, March 06, 2013 8:47 AM To: WikiMedia Mailing Lists Subject: [Pywikipedia-l] Wikidata implementation in rewrite branch I just commited r11182[1] into rewrite branch, providing real Wikidata support, including claims and sources. An example of how to use it: >>> site = pywikibot.Site('en','wikipedia') >>> page = pywikibot.Page(site, 'Douglas Adams') >>> item = pywikibot.ItemPage.fromPage(page) >>> data = item.get() >>> item.labels['en'] u'Douglas Adams' >>> item.claims {u'p18': [Claim(Property:P18)], u'p19': [Claim(Property:P19)], u'p107': [Claim(Property:P107)], u'p31': [Claim(Property:P31)], u'p21': [Claim(Property:P21)]} >>> item.claims['p107'][0].sources [Claim(Property:P143)] >>> item.claims['p107'][0].sources[0].target ItemPage(Q169514) Currently only read access is supported, I should have the write methods ready in a few days. When getting sitelinks (item.sitelinks['enwiki']), you need to provide the site.dbName() rather than a standard site object due to issues with locked wikis (see my previous mail[2]). One thing I was wondering about, should this be split into a separate file? pywikibot/wikibase.py? These are extension specific classes not-likely to be used by many wikis and will add a lot to page.py. I'll update the onwiki documentation[3] soon as well. [1] https://www.mediawiki.org/wiki/Special:Code/pywikipedia/11182 [2] http://lists.wikimedia.org/pipermail/pywikipedia-l/2013-March/007766.html [3] https://www.mediawiki.org/wiki/Manual:Pywikipediabot/Wikidata Thanks, -- Legoktm
_______________________________________________ Pywikipedia-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
