SPARQL/Wikidata Query Service

Wikimedia runs the public service instance of WDQS (Wikidata Query Service), which is available for use at http://query.wikidata.org/.

GUI
The GUI at the home page of http://query.wikidata.org/ allows you to edit and submit SPARQL queries to the query engine. The results are displayed as an HTML table. Note that every query has a unique URL which can be bookmarked for later use. Going to this URL will put the query in the edit window, but will not run it - you still have to click "Execute" for that.

One can also generate a short URL for the query via a URL shortening service by clicking the "Generate short URL" link on the right - this will produce the shortened URL for the current query.

The "Add prefixes" button generates the header containing standard prefixes for SPARQL queries. The full list of prefixes that can be useful is listed in the RDF format documentation. Note that most common prefixes work automatically, since WDQS supports them out of the box.

The GUI also features a simple entity explorer which can be activated by clicking on the "🔍" symbol next to the entity result. Clicking on the entity Q-id itself will take you to the entity page on wikidata.org.

Default views
If you run the query in the WDQS GUI, you can choose which view to present by specifying a comment:  at the beginning of the query. Supported views are:
 * - default view, displays the results as a table of values
 * - displays coordinate points if any present in the result
 * - displays images present in the result as a grid
 * - displays bubble chart for numbers found in the result
 * - displays hierarchical tree map for numbers found in the result
 * - for results having dates, displays timeline placing each row at appropriate time
 * - displays rows as lines between points on the scales representing each column
 * - displays result as a connected graph, using  column

SPARQL endpoint
SPARQL queries can be submitted directly to the SPARQL endpoint with a GET request to  POST requests can be sent to. The result is returned as XML by default, or as JSON if either the query parameter  or the header   are provided.

JSON format is standard SPARQL 1.1 Query Results JSON Format.

Supported formats
The following output formats are currently supported by the SPARQL endpoint:

Query timeout
There is a hard query deadline configured which is set to 60 seconds. That is true both for the GUI and the public SPARQL endpoint. If your query does not execute in the allowed time, try to optimize it, or reduce the amount of data it returns.

Every query will timeout when it takes more time to execute than this configured deadline. You may want to optimize the query or report a problematic query here Wikidata_query_service/Problematic_queries

Introduction to Wikidata Query Service
See SPARQL/Wikidata Query Service - Introduction

Other SPARQL Endpoints
See www.w3.org/wiki/SparqlEndpoints for a list of other SPARQL Endpoints.