Page MenuHomePhabricator

update multiple data in Wikibase items at once
Closed, ResolvedPublic

Description

Originally from: http://sourceforge.net/p/pywikipediabot/bugs/1589/
Reported by: reza1615
Created on: 2013-02-27 10:18:28
Subject: update wikipdata's item one time!
Original description:
Now if we want add data below we should edit item 5 times\! it will crowded and messy the history \(imagine updating item with 60 interwikis\!\)

lang:en >label:foo
lang:de >label:foo
lang:fa >label:foo
labe:ru >label:foo
lang:nl >;abel foo

setitem should accept item in this style
items=\[\{lang:en,label:foo\},\{lang:de,label:foo\},\{lang:fa,label:foo\},\{lang:ru,label:foo\},\{lang:nl,label:foo\}\]
also for wikilinks and descriptions and aliases.


Version: compat-(1.0)
Severity: enhancement
See Also:
https://sourceforge.net/p/pywikipediabot/bugs/1589

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 22 2014, 2:22 AM
bzimport set Reference to bz55148.
bzimport added a subscriber: Unknown Object (????).
  • summary: update wikipdata's items one time! --> update wikipdata's item one time!

http://wikidata.org/w/api.php
API doesn't let changing of an existing item at once
About creating it's possible

I done this edit by wikidata.py library and it supports one edition for adding many labels and langs in a item updating but it's item creation has bug so now I should use wikipedia.py for create and wikidata.py for updating\!
it is difficult because wikidata.py has it's own user\_confing.py and settings :\)

In wikipedia.py, I made createitem accept one more parameter which is a dictionary called 'value', and change variable params to

params = \{
'summary': self.\_encodeArg\(summary, 'summary'\),
'format': 'jsonfm',
'action': 'wbeditentity',
'data': re.sub\(ur"\bu\'", u'"', repr\(value\).decode\("unicode-escape"\)\).replace\("'", '"'\)\)
\}

With this code, you can call
datapage.createitem\("Bot: import iw links", value=\{'labels': \{'en': \{'language': 'en', 'value': 'abc'\}, 'th': \{'language': 'th', 'value': 'bca'\}\}, 'sitelinks': \{'enwiki': \{'site': 'enwiki', 'title': 'abc'\}\}\}\)

thanks nu11zer0.
we should also change wikipedia.py to accept more parameters for setitem\(\)

Change 176934 had a related patch set uploaded (by John Vandenberg):
Allow some Claim methods to be performed locally

https://gerrit.wikimedia.org/r/176934

Patch-For-Review

Pywikibot has two versions: Compat and Core. This task was filed about the older version, called Pywikibot-compat, which is not under active development anymore. Hence I'm lowering the priority of this task to reflect the reality. Unfortunately, the Pywikibot team does not have the manpower to retest every single bug report / feature request against the (maintained) Pywikibot code base. Furthermore, the code base of Pywikibot-Compat has changed a lot compared to the code base of Pywikibot-Core so there is a chance that the problem described in this task might not exist anymore. Please help: Unfortunately manpower is limited and does not allow testing every single reported task again. If you have time and interest in Pywikibot, please upgrade to Pywikibot-Core and add a comment to this task if the problem in this task still happens in Pywikibot-Core (or directly edit the task by removing the Pywikibot-compat project and adding the Pywikibot project to this task). To learn more about Pywikibot and to get involved in its development, please check out https://www.mediawiki.org/wiki/Manual:Pywikibot/Development Thank you for your understanding.

Xqt raised the priority of this task from Lowest to Low.Mar 14 2016, 4:51 PM
Xqt edited projects, added Pywikibot; removed Pywikibot-compat.
Xqt subscribed.

patch is for core.

Change 176934 abandoned by Multichill:
Allow some Claim methods to be performed locally

Reason:
No response. This can always be re-opened if you plan to work on it again.

https://gerrit.wikimedia.org/r/176934

matej_suchanek removed a project: Patch-For-Review.
matej_suchanek moved this task from Needs Review to Backlog on the Pywikibot board.