Public
Edited
Jun 7, 2024
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
title = await getTitle(url)
Insert cell
lastpodcasts = getRSS(url)
Insert cell
results = await Promise.all(lastpodcasts.map(async (d) => await getPeople(d)))
.then((d) => d.flat())
.then((d) => aq.from(d))
Insert cell
import { get_labels } from "@pac02/what-kind-of-articles-have-you-created"
Insert cell
claim_labels = get_labels(
[
"P21",
"P27",
"P106",
"P101",
"P103",
"P1412",
"P6886",
"P140",
"P69",
"P166",
"P1387",
"P1142",
"P136"
],
lang
).then((d) => d.objects())
Insert cell
labels_map = new Map(
claim_labels.map(({ label, qid }) => [label + " (" + qid + ")", qid])
)
Insert cell
query = `
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX schema: <http://schema.org/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?item ?itemLabel ?value
?valueLabel
?radiofrance WHERE {
?item wdt:P10780 ?radiofrance;
wdt:P31 wd:Q5 ;
wdt:${property} ?value.
OPTIONAL {?item rdfs:label ?itemLabel.
FILTER((LANG(?itemLabel)) = "${lang}")}
OPTIONAL {?value rdfs:label ?valueLabel.
FILTER((LANG(?valueLabel)) = "${lang}")}}
`
Insert cell
data = fetch(
`https://query.wikidata.org/sparql?query=${encodeURIComponent(query)}`,
{ headers: { accept: "application/sparql-results+json" } }
).then((response) => response.json())
Insert cell
array = aq.from(
data.results.bindings.map((d) => ({
item: d.item.value,
itemLabel: d.itemLabel?.value,
value: d.value.value,
valueLabel: d.valueLabel?.value,
radiofrance: d.radiofrance.value
}))
)
Insert cell
match = results
.join_left(array, ["people", "radiofrance"])
.filter((d) => d.item !== undefined)
.derive({ radiofrance: (d) => `<a href="${d.url}"> ${d.people}` })
.derive({
wikidata: (d) =>
`<a href="${d.item}"> ${d.itemLabel} (${op.replace(
d.item,
"http://www.wikidata.org/entity/",
""
)})`
})
.derive({
radiofrance2: (d) =>
`<a href="https://www.radiofrance.fr/personnes/${d.people}"> ${d.people}`
})
.orderby(aq.desc("date"))
Insert cell
match1 = results
.join_left(array, ["people", "radiofrance"])
.filter((d) => d.item !== undefined)
.derive({ radiofrance: (d) => `<a href="${d.url}"> ${d.people}` })
.derive({
wikidata: (d) =>
`<a href="${d.item}"> ${d.itemLabel} (${op.replace(
d.item,
"http://www.wikidata.org/entity/",
""
)})`
})
.derive({
radiofrance2: (d) =>
`<a href="https://www.radiofrance.fr/personnes/${d.people}"> ${d.people}`
})
.dedupe(["date", "people", "item", "value"])
.orderby(aq.desc("date"))
Insert cell
match2 = match1
.dedupe(["people", "item", "value"])
.groupby(["value", "valueLabel"])
.count()
.derive({
wikidata: (d) =>
`<a href="${d.value}"> ${d.valueLabel} (${op.replace(
d.value,
"http://www.wikidata.org/entity/",
""
)})`
})
.orderby(aq.desc("count"))
Insert cell
import { getPeople } from "@pac02/how-to-get-the-list-of-participants-to-a-radio-program"
Insert cell
import { aq, op } from "@uwdata/arquero"
Insert cell
import { getPodcasts } from "@pac02/radio-france-podcast"
Insert cell
import { getRSS, getTitle } from "@pac02/get-rss-from-radiofrance"
Insert cell
moment = require("moment")
Insert cell
moment.locale("fr", {
months:
"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split(
"_"
),
monthsShort:
"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),
weekdays: "dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),
weekdaysShort: "dim._lun._mar._mer._jeu._ven._sam.".split("_"),
weekdaysMin: "di_lu_ma_me_je_ve_sa".split("_")
})
Insert cell
get_default = () => {
const params = new URL(document.URL).searchParams;
const defaults = {
url: "https://radiofrance-podcast.net/podcast09/rss_10239.xml",
lang: "fr",
property: "P21"
};
if (params.has("url")) {
defaults.url = params.get("url");
}
if (params.has("property")) {
defaults.property = params.get("property");
}
if (params.has("lang")) {
defaults.lang = params.get("lang");
}
return defaults;
}
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