# Wikidata

Wikidata is the free knowledge base behind Wikipedia: millions of items (people, places, buildings, organisations, artworks) with properties and sources, and above all with the IDs other registers use. For the Netherlands these include national monument numbers (P359), CBS municipality codes (P382) and KvK company IDs (P3220). This lets you join datasets that have no common key of their own. Everything is CC0. Note: robots.txt disallows bots on the SPARQL service and the APIs, so the Open Data Index does not query Wikidata itself.

- Publisher: Wikidata (Wikimedia Foundation)
- Area: World · Finest detail: item (person, place, building, organisation …)
- Period: actuele stand; dumps elke week · Refreshed: live
- Access: Open · Licence: CC0 1.0 (gestructureerde data)
- Join keys: Q-nummer (item), externe id's (P359 rijksmonument, P382 CBS-gemeentecode, P3220 KvK-nummer), coördinaten
- Status: grijs
- URL: https://www.wikidata.org/wiki/Wikidata:Data_access

## What can you do with it?
- **From monument number to photo and Wikipedia.** Look up a national monument by its number (P359) and you often find a photo on Wikimedia Commons, the Wikipedia articles and the architect.
- **Museums on the map.** Ask for all items that are a museum (Q33506) in the Netherlands (Q55), with coordinates and municipality. Put them next to the CBS museum statistics: what does CBS count that Wikidata does not?
- **Finding abolished municipalities.** P382 also gives CBS codes of abolished municipalities. You can use them to map old figures to today's boundaries, but check the end date; it is sometimes missing.
- **Politicians and their careers.** Items of MPs often have party, positions with start and end dates and place of birth. Link them to the House of Representatives data by name and check for duplicate names.

## How to process it
1. **Look at an item.** Each item page shows the properties with sources. Q55 is the Netherlands, Q33506 is museum; P359 is the national monument number.
   `https://www.wikidata.org/wiki/Property:P359`
2. **Try a query in the browser.** The Query Service has an editor with examples and map and chart views. A query may run for 60 seconds; per user agent and IP you get 60 seconds of processing time per minute, 30 failed queries per minute and 5 in parallel.
   `https://query.wikidata.org/`
3. **Follow the user-agent policy.** If you query from a program anyway, send a user agent with a name and contact. Without a good user agent you can be blocked; on 429 wait for Retry-After. Read robots.txt and the terms yourself.
   `https://meta.wikimedia.org/wiki/User-Agent_policy`
4. **Everything in one file.** A full dump appears every week. latest-all.json.gz was 156 GB on 13 October 2026; each line is one item as JSON, so you can read it line by line.
   `https://dumps.wikimedia.org/wikidatawiki/entities/`

## Interesting combinations
- Which monuments have no photo yet? → [rijksmonumenten](https://www.opendataindex.nl/en/bron/rijksmonumenten.md) via rijksmonumentnummer (P359). Compare monument numbers from the RCE register with the items in Wikidata and find the numbers without an image.
- Municipal figures with mayor and photo → [cbs-statline](https://www.opendataindex.nl/en/bron/cbs-statline.md) via CBS-gemeentecode (P382). Join CBS figures per municipality to the Wikidata item via the municipality code and add the mayor, coat of arms and Wikipedia link.

## Similar sources
- [rijksmonumenten](https://www.opendataindex.nl/en/bron/rijksmonumenten.md): The official monument register of the RCE, with legal status and description. Wikidata adds photos, architects and Wikipedia links, but is not official.
- [openstreetmap](https://www.opendataindex.nl/en/bron/openstreetmap.md): OpenStreetMap has the geometry (buildings, roads) and often points to the item with a wikidata tag. Wikidata has the facts and IDs, OSM the map.
- [europeana](https://www.opendataindex.nl/en/bron/europeana.md): Europeana gathers collections from museums and archives, with images and metadata per object. Needs a key.

## What to watch out for
- **robots.txt disallows bots.** query.wikidata.org disallows /sparql and www.wikidata.org disallows /w/, /api/ and /wiki/Special: for all user agents. We do not query Wikidata ourselves; the chart here comes from CBS.
- **Anyone can edit.** Wikidata is maintained by volunteers. Check the source of each fact, and use it for linking and exploring, not as an official register.
- **Completeness varies.** Whether something is in Wikidata says nothing about whether it exists. Counts (so many museums, so many monuments) are counts of Wikidata, not of reality.
- **Queries time out.** Broad queries (all people, all buildings) do not finish within 60 seconds. Narrow down to the Netherlands or a class, or use the dump.

## API (SPARQL 1.1 (Wikidata Query Service))

- Base: https://query.wikidata.org/sparql
- Access: No key, but a User-Agent with a name and contact (otherwise the service may block you). (from the description)
- Formats: sparql-results+xml, sparql-results+json, csv, tsv, json, rdf, turtle, n-triples, json-ld
- Size: 120000000 items ('over 120 million Items' according to Wikidata:Data access, Oct 2026) (from the description)
- Filtering: SPARQL 1.1 with the Wikidata prefixes and the label service. Example: ?m wdt:P31/wdt:P279* wd:Q33506 ; wdt:P17 wd:Q55 (all museums in the Netherlands).; SELECT, FILTER, OPTIONAL, pad/pad*, GROUP BY, SERVICE wikibase:label, SERVICE wikibase:around

### Endpoints
- `GET /sparql?query=…`: SPARQL query in the URL; XML by default, JSON with Accept or format=json. Main graph only: scholarly articles are on query-scholarly.wikidata.org since the graph split.
- `POST /sparql`: The same query as form field query= (for long queries).
- `GET https://www.wikidata.org/wiki/Special:EntityData/{Q-id}.json`: Linked Data Interface: one complete item as JSON (also .ttl, .nt, .rdf, .jsonld); http://www.wikidata.org/entity/Q55 redirects here.
- `GET https://www.wikidata.org/w/rest.php/wikibase/v1/entities/items/{Q-id}`: Wikibase REST API (OpenAPI): read and edit items and statements.
- `GET https://www.wikidata.org/w/api.php?action=wbsearchentities|wbgetentities`: MediaWiki Action API: search by label, fetch up to 50 items per request, edit.
- `GET https://dumps.wikimedia.org/wikidatawiki/entities/`: Full dumps (JSON, one item per line; also RDF), every week.
- `GET https://stream.wikimedia.org/`: Recent Changes stream (server-sent events) of all Wikimedia wikis; filter Wikidata yourself.

### Parameters
- `query`: The SPARQL query (GET or POST). (from the description)
- `format`: json or xml; or the Accept header: application/sparql-results+json, text/csv, text/tab-separated-values. (from the description)
- `wd: / wdt: / p: / ps: / pq:`: Items (wd:Q55), direct properties (wdt:P31), full statements with qualifiers (p:, ps:, pq:). Predefined in WDQS. (from the description)
- `SERVICE wikibase:label`: Labels automatically: ?xLabel for ?x, with bd:serviceParam wikibase:language "nl,en". (from the description)
- `P31 / P17 / P131 / P625 / P18`: instance of, country, located in the administrative territorial entity, coordinate location, image. (tested)
- `P359 / P382 / P3220`: Rijksmonument ID, CBS municipality code, KvK company ID: the join keys to Dutch registers. (tested)
- `Q55 / Q2039348 / Q33506`: Netherlands, municipality of the Netherlands, museum. (tested)

### SPARQL result (W3C standard) (3)
`head.vars` lijst, `results.bindings[].<var>.value` tekst, `results.bindings[].<var>.type / datatype / xml:lang` tekst

### Limits and pitfalls
- Every query stops after 60 seconds. Per client (User-Agent + IP) 60 seconds of processing time per minute, 30 failing queries per minute, 5 in parallel per IP; above that HTTP 429 with Retry-After. (from the description)
- Action API: up to 50 items per request; use maxlag and request gzip (Accept-Encoding). (from the description)
- The robots.txt of query.wikidata.org disallows /sparql and /bigdata; that of www.wikidata.org disallows /w/ (so rest.php and api.php), /api/ and /wiki/Special: (so Special:EntityData). The Open Data Index therefore does not call these endpoints; everything here comes from the documentation. (tested)
- robots.txt is aimed at crawlers; Wikidata itself invites programs to use the Query Service, with a good User-Agent. For large volumes: the weekly dump. (from the description)
- Since the graph split, scholarly articles are no longer in the main graph but on query-scholarly.wikidata.org. (from the description)
- Broad queries (all people, all buildings) do not finish within 60 seconds. Narrow to the Netherlands or a class, or use the dump. (experience)
- Wikidata also lists a GraphQL API, a vector database (wd-vectordb.wmcloud.org) and an MCP server (wd-mcp.wmcloud.org/mcp/). (from the description)


## Examples with real figures (1)

For each example the finding, the reference date and the call that fetches exactly these figures.

- **Museums in the Netherlands by theme (CBS count): history is the largest part, 65% in 2024** (2024). Table 83533NED. [Example](https://www.opendataindex.nl/en/voorbeeld/cbs-musea-thema)
  - `https://opendata.cbs.nl/ODataApi/OData/83533NED/TypedDataSet?$filter=Perioden%20eq%20'2024JJ00'&$select=Geschiedenis_5,Kunst_4,BedrijfEnTechniek_7,NatuurlijkeHistorie_6,Volkenkunde_8`
