Unlisted
Edited
Nov 16, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
df = await aq
.loadCSV(
"https://xtools.wmcloud.org/pages/" +
wikipedia +
"/" +
username +
"?format=csv",
{ parse: { date: Date } }
)
.then((d) => d.select(normalize).select("page_title", "date"))
Insert cell
df.array("page_title")
.map(d => `"` + d + `"@fr`)
Insert cell
input = df.array("page_title")
.map(d => `"` + d + `"@en`)
.join("\n")
Insert cell
query = `SELECT DISTINCT ?string ?item ?itemLabel ?instance ?instanceLabel WHERE {
VALUES ?string {
` + input +
`
}
?sitelink schema:about ?item;
schema:isPartOf <https://en.wikipedia.org/>;
schema:name ?string.
?item wdt:P31 ?instance.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
ORDER BY ?itemLabel`
Insert cell
queryurl = `https://query.wikidata.org/sparql?query=` + encodeURIComponent(query)
Insert cell
data = fetch(`https://query.wikidata.org/sparql?query=${encodeURIComponent(query)}`, {headers: {accept: "application/sparql-results+json"}}).then(response => response.json())
Insert cell
output = aq.from( data.results.bindings.map(
d => ({article: d.string.value, instanceLabel: d.instanceLabel.value})
)
)
Insert cell
output.view()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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