Public
Edited
Feb 13, 2024
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Insert cell
Insert cell
Insert cell
url = wbk.searchEntities({ search: search, type: type, language: lang })
Insert cell
output = fetch(url)
.then((d) => d.json())
.then((d) => d.search)
.then((d) =>
d.map((q) => ({
id: q.id,
label: q.label,
description: q.description,
qid: `<a href="${q.url}">${q.id} `
}))
)
Insert cell
aq.from(output).view()
Insert cell
fetch(url)
.then((d) => d.json())
.then((d) => d.search)
Insert cell
get_default = () => {
const params = new URL(document.URL).searchParams;
const defaults = {
type: "item",
search: "Maria Montessori",
lang: "en"
};
if (params.has("type")) {
defaults.type = params.get("type");
}
if (params.has("lang")) {
defaults.lang = params.get("lang");
}
if (params.has("search")) {
defaults.search = params.get("search");
}
return defaults;
}
Insert cell
WBK = import("https://cdn.skypack.dev/wikibase-sdk@7.14.2?min")
Insert cell
wbk = WBK.default({
instance: "https://www.wikidata.org",
sparqlEndpoint: "https://query.wikidata.org/sparql"
})
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