MW2SPARQL

MediaWiki 2 SPARQL is an experimental SPARQL endpoint for Wikimedia wikis working on top of their database. It currently supports English, French and German wikipedias. It is based on Ontop and rewrites SPARQL queries to SQL. The source code in on GitHub and the endpoint is available at: http://tools.wmflabs.org/mw2sparql/sparql

There is no user interface for this tool yet, you could use Wikidata Query Service instead, using the  syntax.

The mapping is under work and is very partial and not stable.

Query examples
Retrieve some data available about the English Wikipedia SPARQL article:

Retrieve some data about the English Wikipedia connected to the item about SPARQL:

Pages
A MediaWiki page. It has the  type and contains a , a  , is in a namespace stored in. Its content model is provided by. Internal links to other pages are connected by, categories by   and included pages by. If it is a redirection, the redirection target is available using Its latest revision is connected throw.

New pages have the type  and redirection pages the type.

Example:

Revision
A version of a MediaWiki page. Has the type, an oldid stored by  , belongs to the page connected by  , may have a previous revision provided by.

Example:

Known issues

 * GROUP BY is not supported and this is unlikely to be fixed in the future
 * The URL encoding of articles is different from the one used by the current version of the one used by the Wikidata Query Service. The WDQS is planning to move to the usual MediaWiki URL encoding soon.