Jump to content

Wikidata Query Service/Usage

From Wikitech

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

Endpoint configuration: mediawiki-config

Maintained by: Smalyshev

Extensions

WikibaseQualityConstraints

WikibaseQualityConstraints (which powers constraint checks on Wikidata) 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 logged in user loads an entity page for which results are not cached, or anyone uses d:Special:ConstraintReport (which is rare).

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

Expected traffic: Some 500–1000 queries per minute (but fluctuating a lot; see also grafana), with a maxQueryTimeMillis of 5000 (see $wgWBQualityConstraintsSparqlMaxMillis in Wikibase-production config)

Source code: https://github.com/wikimedia/mediawiki-extensions-WikibaseQualityConstraints

Endpoint configuration: mediawiki-config

Maintained by: Lucas Werkmeister

Deep category search is the search mode in CirrusSearch allowing to search in category and its sub-categories.

Service goal: Search using category trees.

Service type: Interactive, runs the query every time deepcategory keyword is used.

Distinguishing mark: Uses mediawiki:categoryTree service.

Expected traffic: Depends on users, probably not very high - most special keywords get 100-1000 uses per day, incategory gets about 10K per day.

Source code: https://github.com/wikimedia/mediawiki-extensions-CirrusSearch/blob/master/includes/Query/DeepcatFeature.php

Endpoint configuration: mediawiki-config

Maintained by: Stas Malyshev

Services

Recommendation API

Wikidata Query Service (via SPARQL) is used to suggest articles for translation by removing disambiguation and pre-existing articles.

Service goal: suggest articles for translation by users

Service type: both interactive (http://recommend.wmflabs.org/) and as an API (Content Translation uses it)

Distinguishing mark: the query filters out disambiguation pages

Expected traffic: not sure

Source code: Recommendation API on Github

Endpoint configuration: Config on Github

Maintained by: Baha

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)

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 https://mediawiki.org/wiki/Apps/Commons

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: https://github.com/commons-app/apps-android-commons/

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