Check the setup
- Python 3.10 or newer
- A notebook environment such as Jupyter or Google Colab
- An internet connection
CC0 structured knowledge-graph facts for building entity lookup, taxonomy, and reference-enrichment tools.
From source to product signal
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.
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())Test a useful signal
Test whether a bounded SPARQL query can seed a reference lookup table.
Wikimedia Foundation is a community source. Last verified 2026-08-18. Temporal coverage: continuously updated Wikidata statements.