Wikidata Query Service/Categories

Wikidata Query Service also provides access to category graph of select wikis. The list of covered wikis can be seen here: https://noc.wikimedia.org/conf/dblists/categories-rdf.dblist

Currently, the data is updated from the latest weekly dump. Updates happen each Monday.

Accessing the data
The data is stored in the Blazegraph database in  namespace. Currently, there is no GUI to access the category data, but SPARQL queries can be made against the namespace by using https://query.wikidata.org/bigdata/namespace/categories/sparql?query=SPARQL. This SPARQL endpoint works in the same way as the main WDQS SPARQL endpoint.

Note that while each wiki has its own data set, they are all stored in the same namespace.

Example query, providing subcategories of category Ducks on English wikipedia:

NOTE: this query would not work with default GUI! For now, you will have to run it manually against the SPARQL endpoint above.

NOTE: the dataset includes only categories and not pages belonging to categories (the latter would be much bigger data set).

Simpler query
Simpler form of the query above can be accessed with  service:

This query produces three output values:
 * - the category found
 * - the depth for the category
 * - the parent category

Data format
The data about category describe its URL and the name, e.g.

Links between categories are represented as  relationship, e.g.:

Hidden categories have class.

Prefixes
Prefix  is defined as https://www.mediawiki.org/ontology. Full ontology can be found at https://www.mediawiki.org/ontology/ontology.owl.

Dump header
Dump header contains information about the dump, e.g.:

Data dumps
Data dumps are stored in https://dumps.wikimedia.org/other/categoriesrdf/. Full dumps are performed weekly. Each wiki has its own dump file.

https://dumps.wikimedia.org/other/categoriesrdf/lastdump/ stores timestamps of the last dump performed.

Updating
To update categories, the following can be used:
 * 1) Create categories namespace:
 * 2) Load data:

Adding wikis
For now, if you want some wiki added, please comment on the talk page. Exception is Commons, which has by far the largest set of categories and thus we decided not to cover it for now, until we ensure everything works as planned with smaller data sets.

TODO

 * Regular (daily) updates:
 * Support from the GUI
 * More wikis support
 * Hidden category support: