Dear all,
I have hacked a prototype of GraphQL endpoint on top of the Wikidata API.
GraphQL is is a simple query language design for complex data retrieval (e.g. "give
me the item QXXXX and retrieve all the P20 statements with, for their main snak value, the
label in english and the sitelink to the French Wikipedia"). Compared to SPARQL it
aims less at finding pieces of data matching different criteria than at retrieving complex
representation of known elements. Its official website with tutorials is here:
http://graphql.org/
It is deployed on Toolsforge. The query editor is here:
https://tools.wmflabs.org/tptools/wdql.html and the endpoint here:
https://tools.wmflabs.org/tptools/wdql.php
A first example: A query that returns for the item about "Jean-François
Champollion" (Q260) its label in English, its description in French, its aliases in
French, its sitelink to ruwiki with the English label of its badges, and for its death
place (P20) statement the main snak value id and English label and some data about
references and qualifiers.
This query could be executed using the demo instance using this link:
https://tinyurl.com/y9d6caen (click on the ">" at the top of the UI to
execute the query).
More details and examples are available here:
https://phabricator.wikimedia.org/T173214
(with a query that calls SPARQL from GraphQL!).
The implementation is currently slow but provides most of the basic features required to
retrieve Wikidata content. I do not have any proper demo yet of Wikidata editing using
GraphQL mutations.
Feedbacks are more than welcome on the Phabricator tickets:
https://phabricator.wikimedia.org/T173214
Cheers,
Thomas