Skip to content

Instantly share code, notes, and snippets.

@joelgombin
Last active November 8, 2023 08:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joelgombin/e1c8aaa746c40cd77f422b30d13912cf to your computer and use it in GitHub Desktop.
Save joelgombin/e1c8aaa746c40cd77f422b30d13912cf to your computer and use it in GitHub Desktop.
French main streams according to Wikidata
library(WikidataR)
library(glitter)
library(tidyverse)
find_item("main stream")
fleuves <- spq_init() %>%
spq_add("?items wdt:P31 wd:Q573344") %>%
spq_add("?items wdt:P17 wd:Q142") %>%
spq_add("?items wdt:P403 ?mouth") %>%
spq_add("?items wdt:P2043 ?length") %>%
spq_label(items, .languages = "fr") %>%
spq_label(mouth, .languages = "fr") %>%
spq_perform()
riviere_fleuves <- spq_init() %>%
spq_add("?items wdt:P31 wd:Q4022") %>%
spq_add("?items wdt:P17 wd:Q142") %>%
spq_add("?items wdt:P403 ?mouth") %>%
spq_add("?mouth wdt:P31 wd:Q165") %>%
spq_add("?items wdt:P2043 ?length") %>%
spq_label(items, .languages = "fr") %>%
spq_label(mouth, .languages = "fr") %>%
spq_perform()
fleuves |>
bind_rows(riviere_fleuves) |>
select(items, items_label, mouth_label, length) |>
distinct(items, .keep_all = TRUE) |>
arrange(desc(length)) |>
View()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment