Wikimedia

Improve code examples of the Wikidata Query UI

Requirements: Basic knowledge of at least two of the following languages: PHP, JavaScript, Python, Ruby, R, Matlab.

The Wikidata Query Service is a widely-used endpoint for reusing data from Wikidata. If you run a SPARQL query (example) and then you click "Code", you will see some code snippets in several languages that you can directly copy and paste into your applications to retrieve data from Wikidata. Or... well, that's what should happen. :-)

Actually, some of these code examples are buggy or incomplete. Your mission is to improve and complete those code snippets in the languages you know to meet the acceptance criteria:

  • 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).

You should upload your changes to gerrit.wikimedia.org by following the tutorial. You will need to create a Wikimedia developer account if you don't have one yet.

Task tags

  • python
  • r
  • ruby
  • php
  • javascript

Students who completed this task

refeed

Task type

  • code Code
close

2018