Skip to content

Instantly share code, notes, and snippets.

@egonw
Created October 22, 2022 07:23
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 egonw/395c059377e579dfc2c44f746d0c987e to your computer and use it in GitHub Desktop.
Save egonw/395c059377e579dfc2c44f746d0c987e to your computer and use it in GitHub Desktop.
Show the geo locations of employers/affiliations of first authors of Nature articles
#defaultView:Map
PREFIX venue: <http://www.wikidata.org/entity/Q180445>
SELECT DISTINCT ?author ?geo
WITH {
SELECT DISTINCT ?author_ ?author WHERE {
{
?target p:P50 ?author_statement ; wdt:P1433 venue: .
?author_statement ps:P50 ?author_ .
?author_ rdfs:label ?author .
FILTER (LANG(?author) = 'en')
BIND(CONCAT("../author/", SUBSTR(STR(?author_), 32)) AS ?authorUrl)
OPTIONAL {
?author_statement pq:P1545 ?order_ .
BIND(xsd:integer(?order_) AS ?order)
}
}
UNION
{
?target p:P2093 ?authorstring_statement ; wdt:P1433 venue: .
?authorstring_statement ps:P2093 ?author_
BIND(CONCAT(?author_, " ↗") AS ?author)
OPTIONAL {
?authorstring_statement pq:P1545 ?order_ .
BIND(xsd:integer(?order_) AS ?order)
}
}
FILTER (?order = 1)
}
} AS %AUTHORS WHERE {
INCLUDE %AUTHORS
?author_ ( wdt:P108 | wdt:P1416 ) / wdt:P361* ?organization .
?organization wdt:P625 ?geo .
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment