Page MenuHomePhabricator

Improve code examples of the Wikidata Query UI
Open, NormalPublic

Description

As a user I want to easily reuse data from Wikidata by copying code snippets from query.wikidata.org in my preferred languages.

Problem: Code examples provided by the Wikidata Query UI (query.wikidata.org) are mostly poor. Some of the snippets are incomplete or have typos.

Screenshots:


Example: The Java snippet is dirty and contains mistakes which prevent an application from being compiled...
for (HashMap value : (ArrayList>) rs.get("result").get("rows")) {

Acceptance criteria:
For all the programming languages that are considered:

  • The code snippet can be properly executed without requiring any change on it and returns or prints the results of the requested query.
  • Tasks of data retrieval are encapsulated in a function/procedure/method and there isn't any data exchange with Wikidata outside that function/procedure/method.
  • The code is understandable and consistently formatted (indentation, spaces, line breaks, etc.).
  • At least the query and the URL endpoint are easily configurable (e.g., by directly assigning each value to a variable).
  • Retrieved data are stored in an iterable or navigable data structure (e.g., an array).

To do:

  • PHP
  • JavaScript (jQuery)
  • JavaScript (modern)
  • Java
  • Perl
  • Python
  • Python (Pywikibot)
  • Ruby
  • R
  • Matlab

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Restricted Application added a project: Wikidata. · View Herald TranscriptOct 23 2018, 1:50 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
abian updated the task description. (Show Details)
abian updated the task description. (Show Details)Nov 24 2018, 2:28 PM
abian updated the task description. (Show Details)
abian renamed this task from Improve code examples of the Query UI to Improve code examples of the Wikidata Query UI.Nov 24 2018, 9:54 PM
abian updated the task description. (Show Details)

Change 476002 had a related patch set uploaded (by Rafidaslam; owner: Rafid Aslam):
[wikidata/query/gui@master] Improve code examples for Java and Python

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

Lydia_Pintscher added a subscriber: Lydia_Pintscher.

Thank you for your patch :)

Change 476002 merged by jenkins-bot:
[wikidata/query/gui@master] Improve code examples for Java and Python

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

Change 476049 had a related patch set uploaded (by WDQSGuiBuilder; owner: WDQSGuiBuilder):
[wikidata/query/gui-deploy@production] Merging from c4546eaa9dc6460d59e5307cb7f9830c917b7bb4:

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

abian updated the task description. (Show Details)
abian updated the task description. (Show Details)
rafidaslam removed rafidaslam as the assignee of this task.Nov 27 2018, 4:49 PM
rafidaslam added a subscriber: rafidaslam.

Change 476049 merged by Smalyshev:
[wikidata/query/gui-deploy@production] Merging from c4546eaa9dc6460d59e5307cb7f9830c917b7bb4:

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

Restricted Application added a project: User-Michael. · View Herald TranscriptDec 5 2018, 1:20 PM

Change 477783 had a related patch set uploaded (by Michael Große; owner: Michael Große):
[wikidata/query/gui@master] Improve PHP code example

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

Change 477808 had a related patch set uploaded (by Michael Große; owner: Michael Große):
[wikidata/query/gui@master] Improve JS(modern) code example

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

Addshore triaged this task as Normal priority.Dec 6 2018, 11:02 AM

Change 477783 merged by jenkins-bot:
[wikidata/query/gui@master] Improve PHP code example

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

Change 477808 merged by jenkins-bot:
[wikidata/query/gui@master] Improve JS code examples

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

Michael removed Michael as the assignee of this task.Dec 12 2018, 9:16 AM
Michael added a subscriber: Michael.

Change 480575 had a related patch set uploaded (by Ladsgroup; owner: Ladsgroup):
[wikidata/query/gui@master] Improve pywikibot example

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

Restricted Application added a project: User-Ladsgroup. · View Herald TranscriptDec 18 2018, 7:58 PM

Change 480575 merged by jenkins-bot:
[wikidata/query/gui@master] Improve pywikibot example

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

Change 480673 had a related patch set uploaded (by WDQSGuiBuilder; owner: WDQSGuiBuilder):
[wikidata/query/gui-deploy@production] Merging from b54c34b48cfb89a0daafc25a18f43dc3a7fb1d35:

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

Ladsgroup removed Ladsgroup as the assignee of this task.Dec 19 2018, 12:20 AM
Ladsgroup updated the task description. (Show Details)
Ladsgroup added a subscriber: Ladsgroup.

Change 480673 abandoned by Smalyshev:
Merging from b54c34b48cfb89a0daafc25a18f43dc3a7fb1d35:

Reason:
superceded

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

Addshore moved this task from incoming to in progress on the Wikidata board.Dec 19 2018, 12:46 PM

@Lydia_Pintscher i'm not sure this was ever picked up on the campsite with the intention of us doing the work, just for us to review? so perhaps we can remove it now there is nothing to review?

Yes this was for review. If there is nothing left to review we can remove it from camp.

abian added a subscriber: mpopov.Jan 29 2019, 9:34 PM

@mpopov, maybe you would like to write the R code snippet using your own package WikidataQueryServiceR?

Change 492730 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[wikidata/query/gui@master] Fix pywikibot example

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

Change 492730 merged by jenkins-bot:
[wikidata/query/gui@master] Fix pywikibot example

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

Change 492980 had a related patch set uploaded (by WDQSGuiBuilder; owner: WDQSGuiBuilder):
[wikidata/query/gui-deploy@production] Merging from 181b14abc3d498a0afe5e6d4cea5471a073cae66:

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

Change 492980 merged by Smalyshev:
[wikidata/query/gui-deploy@production] Merging from 181b14abc3d498a0afe5e6d4cea5471a073cae66:

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

Addshore moved this task from in progress to ready to go on the Wikidata board.May 13 2019, 10:11 PM

Partly done, but not actively being worked on, so moved back to ready to go from doing

Addshore moved this task from ready to go to in progress on the Wikidata board.Jun 21 2019, 11:31 PM