Microproduct data guideintermediate

Wikidata Query Service

CC0 structured knowledge-graph facts for building entity lookup, taxonomy, and reference-enrichment tools.

At a glance

Difficulty
Intermediate — some data preparation helps
Size
Tiny · ≤0.01 GB
Formats
JSON, CSV
Access
API
API key
Not required
Provider
Wikimedia Foundation
Updates
Continuous

From source to product signal

Test a product idea in four steps

Wikidata SPARQL returns CC0 statements for entities and properties. Start with one class, one country, and a LIMIT. Send a descriptive User-Agent. Query results can be incomplete, contested, or delayed relative to the source that a statement cites.

1

Check the setup

  • Python 3.10 or newer
  • A notebook environment such as Jupyter or Google Colab
  • An internet connection
2

Access the data

  1. 1.Open the Query Service and read the CC0 licensing page.
  2. 2.Write a bounded SPARQL query with a LIMIT instead of selecting the whole graph.
  3. 3.Request JSON results with a descriptive User-Agent.
Open official source
3

Run the Python example

Install the packages, then run the notebook cell.

python -m pip install pandas requests

import pandas as pd
import requests

query = """
SELECT ?item ?itemLabel WHERE {
  ?item wdt:P31 wd:Q515.
  ?item wdt:P17 wd:Q30.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
LIMIT 10
"""
response = requests.get(
    "https://query.wikidata.org/sparql",
    params={"query": query, "format": "json"},
    headers={
        "User-Agent": (
            "TrilemmaDataCatalogExample/1.0 "
            "(https://data.trilemma.foundation)"
        ),
        "Accept": "application/sparql-results+json",
    },
    timeout=30,
)
response.raise_for_status()
bindings = response.json()["results"]["bindings"]
cities = pd.json_normalize(bindings)
print(cities.head())
4

Test a useful signal

List a handful of U.S. cities from Wikidata

Test whether a bounded SPARQL query can seed a reference lookup table.

  1. 01Keep item IRI and English label for ten cities.
  2. 02Record missing labels instead of guessing names from other sources.
  3. 03Treat results as CC0 statements that still need a cited source before publication.

Dataset details

Wikimedia Foundation is a community source. Last verified 2026-08-18. Temporal coverage: continuously updated Wikidata statements.

Theme

Research & Reference

Domains

Knowledge GraphsReference DataResearch

Data types

Linked DataEntity Data

Tasks

Entity LookupKnowledge Graph QueryReference Enrichment

Geography

Global

Formats

JSONCSV

Provider

Wikimedia Foundation

Data terms

Creative Commons CC0 1.0