Hi everyone,
I am the maintainer of the DBpedia mapper bot [1]. Currently, I'm trying to add claims to property pages. There seems to be no implementation in pywikibot to add a claim to a property page. For an 'ItemPage' [2], I proceed as per the following (dummy) example:
site = pywikibot.Site("wikidata", "wikidata") repo = site.data_repository() item = pywikibot.ItemPage(repo, item_id) claim = pywikibot.Claim(repo, 'P1709') claim.setTarget('http://dbpedia.org/ontology/Espresso') item.addClaim(claim)
As property pages should be instances of 'PropertyPage' [3], I would expect an 'addClaim' method implemented there, but that's not the case. I tried with the 'DataSite.addClaim' method [4] (used by ItemPage [5] BTW), but it cries at [6] since the PropertyPage object has no 'claims' attribute.
The edit from the Wikidata Web UI is indeed possible, so my question is: how can I add a claim to a property page with pywikibot? Thanks for your time, cheers!
[1] https://www.wikidata.org/wiki/Wikidata:Requests_for_permissions/Bot/DBpedia-... [2] http://pywikibot.readthedocs.org/en/latest/pywikibot/#pywikibot.__init__.Ite... [3] http://pywikibot.readthedocs.org/en/latest/pywikibot/#pywikibot.__init__.Pro... [4] http://pywikibot.readthedocs.org/en/latest/pywikibot/#pywikibot.site.DataSit... [5] https://github.com/wikimedia/pywikibot-core/blob/master/pywikibot/page.py#L3... [6] https://github.com/wikimedia/pywikibot-core/blob/master/pywikibot/site.py#L5...
wikidata-tech@lists.wikimedia.org