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: http://github.com/wikimedia/mediawiki-extensions-GoatLocator

Maintained by: Smalyshev

Extensions

WikibaseQualityConstraints

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: https://github.com/wikimedia/mediawiki-extensions-WikibaseQualityConstraints

Maintained by: Lucas Werkmeister

Gadgets and user scripts

HarvestLabel

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)

wdcat.js

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)