Public
Edited
Aug 14, 2024
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
query = `SELECT ?item ?itemLabel ?country ?countryLabel ?code WHERE {
?item wdt:P31 wd:Q5107;
(wdt:P527*) ?country.
?country wdt:P31 wd:Q3624078;
wdt:P298 ?code.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}`
Insert cell
output = fetch(
`https://query.wikidata.org/sparql?query=${encodeURIComponent(query)}`,
{ headers: { accept: "application/sparql-results+json" } }
).then((response) => response.json())
Insert cell
data = aq.from(
output.results.bindings.map((d) => ({
item: d.item.value,
itemLabel: d.itemLabel?.value,
country: d.country.value,
countryLabel: d.countryLabel.value,
code: d.code.value
}))
)
Insert cell
import { aq, op } from "@uwdata/arquero"
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more