Wikidata query service/Usage

From Wikitech
Jump to: navigation, search

This page lists uses of Wikidata Query Service inside Wikimedia Foundation projects. Any change to the service should account for these services' existence and requirements.

Example: Goat locator service

This is the example service description, intended to show how you could describe your usage of WDQS. Please note this is not a real service and the description is only meant to illustrate the suggested format.

Service goal: display a list of notable goats within 10 miles of location of the current item

Service type: interactive, runs each time user loads a page which has coordinates

Distinguishing mark: the queries will have "#Goat Locator" in the query text

Expected traffic: about 10 queries per minute, each query is a geosearch which typically takes about 700 ms.

Source code:

Maintained by: Smalyshev



WikibaseQualityConstraints (which powers the checkConstraints gadget and d:Special:ConstraintReport) uses WDQS for the “type”, “value type”, “distinct values” and “format” constraint types. The templates for all queries can be found in SparqlHelper.php (look for $query =, or runQuery() calls).

Service goal: Check consistency of data in Wikidata entities

Service type: Interactive, runs every time a user with the checkConstraints gadget enabled loads an entity page, or any user uses d:Special:ConstraintReport (which is rare).

Distinguishing mark: All queries begin with a comment line #wbqc

Expected traffic: Some 100 queries per minute (but fluctuating a lot, and will increase as more users enable the gadget; see also grafana), with a maxQueryTimeMillis of 5000 (see $wgWBQualityConstraintsSparqlMaxMillis in Wikibase-production config)

Source code:

Maintained by: Lucas Werkmeister

Gadgets and user scripts


Service goal: allow users to easily search for Wikidata entities with missing labels in Wikidata, but with local label in Wikipedia infoboxes.

Service type: interactive, runs each time user press a sidebar button in template

Distinguishing mark: all queries will have similar structure to queryMissingLabels() function

Expected traffic: user driven

Source code: HarvestLabel

Maintained by: eranroz (talk)


Service goal: allow a user browsing a Commons category to see if a Wikidata item points there using P373

Service type: user script. Activated whenever a user with the script enabled loads a Commons category page.

Distinguishing mark: all queries will have a very similar structure -- see source below

Expected traffic: user driven (but I think uptake has been quite limited, in the 2 1/2 years that it's existed for so far)

Source code: c:User:Jheald/wdcat.js

Maintained by: Jheald (talk) (though my ability to do so is very limited; it was actually all written by User:TheDJ)

Mobile apps

Finding nearby places in Commons mobile app

Wikimedia Commons app for Android has a Nearby feature which displays Wikidata entities whose locations are close to the user's current location.

Service goal: display a list of notable places close to the user and lacking images to solicite new image contributions to Wikimedia Commons

Service type: interactive, runs each time the user reloads the Nearby screen

Distinguishing mark: user-agent string contains

Expected traffic: since it's user-driven not rate-limited from the client side, it's hard to say, but a rough estimate would be less than 1 session per min from one device, with 1 session consisting of less than 10 requests typically

Source code:

Maintained by: Misaochan (using GitHub for bug reports and feature suggestions)

Web apps

TODO: WikiShootMe! TODO: Fatameh (via Wikidata Integrator) TODO: AARAA TODO: FactVis tool