Finally the bug is solved. you can get and set items on wikidata via PWB
At first you must define a wikidataPage and these are methods you can use. I'll try to expand and make more methods but i don't know any and your help will be very useful: Supports the same interface as Page, with the following added methods:
setitem : Setting item(s) on a page
getentity : Getting item(s) of a page
these examples worked for me:
site=wikipedia.getSite('wikidata',fam='wikidata') page=wikipedia.wikidataPage(site,"Helium") text=page.getentity() page.setitem(summary=u"BOT: TESTING FOO",items={'type':u'item', 'label':'fa', 'value':'OK'}) page.setitem(summary=u"BOT: TESTING GOO",items={'type':u'description', 'language':'en', 'value':'OK'}) page.setitem(summary=u"BOT: TESTING BOO",items={'type':u'sitelink', 'site':'de', 'title':'BAR'})
Cheers!
2012/12/10 Amir Ladsgroup ladsgroup@gmail.com
Finally the bug is solved. you can get and set items on wikidata via PWB
Thanks, Amir, you are the king!!!
page=wikipedia.wikidataPage(site,"Helium") text=page.getentity()
This one works, but I don't understand. I tried with Q#... previously that does not work. But what is the title then? Always English? Where is the Q number? How can I find an item from another language?
2012/12/10 Amir Ladsgroup ladsgroup@gmail.com:
Finally the bug is solved. you can get and set items on wikidata via PWB
Woo hoo! http://i.imgur.com/0D00v.gif
There is no need of using q### anymore. For other languages it's not possible for now but i gonna add it soon
On 12/11/12, Luca Martinelli martinelliluca@gmail.com wrote:
2012/12/10 Amir Ladsgroup ladsgroup@gmail.com:
Finally the bug is solved. you can get and set items on wikidata via PWB
Woo hoo! http://i.imgur.com/0D00v.gif
-- Luca "Sannita" Martinelli http://it.wikipedia.org/wiki/Utente:Sannita
Wikidata-l mailing list Wikidata-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata-l
How can the bot make the difference is two itemes have the same label? I think the Q number is the only primary key. Anyway, I think the number is useful and the bot should have the ability to handle it. Can you provide a piece of code that searches for an item and creates it only if it does not exist?
2012/12/10 Amir Ladsgroup ladsgroup@gmail.com
There is no need of using q### anymore. For other languages it's not possible for now but i gonna add it soon
as my bot is currently running on some parts of the pywikipediabot framework and the pywikidata framework it should be possible to return the saved item if you save it, there for the id has should be saved as some usere e.g. want the bots to stop before milestones liki q1.000.000, my bot also e.g. searches trough all disambiguation pages and saves the items in a list (with the id) so if I run the bot a second time all listed items get skipped and only new items will be treated.
Is it currently possible to request 50 items at one apirequest? or 500 if you have botrights? this is also usefull so it schould be possible to submit a list of items, or better a dictionary of "lang" : "Interwikilink" or a list of IDs. This is whats possible with my bot.
A feature i would like to have, would be search for Labels, Description in a given language, I am not sure if "opensearch", "languagesearch" or "wbsearchentities" should be used for this.
Sk!d (Sk!dbot)
On Tue, Dec 11, 2012 at 7:09 AM, Bináris wikiposta@gmail.com wrote:
How can the bot make the difference is two itemes have the same label? I think the Q number is the only primary key. Anyway, I think the number is useful and the bot should have the ability to handle it. Can you provide a piece of code that searches for an item and creates it only if it does not exist?
2012/12/10 Amir Ladsgroup ladsgroup@gmail.com
There is no need of using q### anymore. For other languages it's not possible for now but i gonna add it soon
-- Bináris
Wikidata-l mailing list Wikidata-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata-l
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Update for pywikibot trunk wikidata interface:
Supports the same interface as Page, with the following added methods:
setitem : Setting item(s) on a page setclaimvalue : Set the value of a Wikibase claim createclaim : Create Wikibase claims
getentity : Getting item(s) of a page getentities : Get the data for multiple Wikibase entities
I added the methods: setclaimvalue, createclaim and getentities in order to start including wikidata support to subster.py
Some comments on this: 1.) the methods should be renamed in order to refrect the naming from rewrite which is "get_xxx" and "set_xxx". 2.) the class wikidataPage works clearly with items like "Q356" too and not only with titles/lables like "Helium" like suggested multiple times (the "Q" syntax is clearly preferred since unique) 3.) getentities is in fact the same as getentity as far as I understand but I was not able to get it working nor understand it (to elaborated for me... ;) and thus I decided to start another very simple implementation. (sorry!) 4.) setclaimvalue is in fact not dependent on a page but on a guid only and thus could be moved out of the wikidataPage class.
Thanks to all the inital work done here by amir and others! Hope we can implement more useful stuff here and coordinate the work in order to get a consistent interface.
Thanks and greetings DrTrigon
ps.: http://www.mediawiki.org/wiki/Manual:Pywikipediabot/Wikidata
On 10.12.2012 22:43, Amir Ladsgroup wrote:
Finally the bug is solved. you can get and set items on wikidata via PWB
At first you must define a wikidataPage and these are methods you can use. I'll try to expand and make more methods but i don't know any and your help will be very useful: Supports the same interface as Page, with the following added methods:
setitem : Setting item(s) on a page
getentity : Getting item(s) of a page
these examples worked for me:
site=wikipedia.getSite('wikidata',fam='wikidata') page=wikipedia.wikidataPage(site,"Helium") text=page.getentity() page.setitem(summary=u"BOT: TESTING FOO",items={'type':u'item', 'label':'fa', 'value':'OK'}) page.setitem(summary=u"BOT: TESTING GOO",items={'type':u'description', 'language':'en', 'value':'OK'}) page.setitem(summary=u"BOT: TESTING BOO",items={'type':u'sitelink', 'site':'de', 'title':'BAR'})
Cheers!