Skip to content

Instantly share code, notes, and snippets.

@cthoyt
Created February 12, 2022 21:51
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 cthoyt/e1786af09f8bbd65d2666f4cdf7cbac8 to your computer and use it in GitHub Desktop.
Save cthoyt/e1786af09f8bbd65d2666f4cdf7cbac8 to your computer and use it in GitHub Desktop.
Make a graph of your papers, co-authors, and topics by quering Wikidata
#defaultView:Graph
SELECT ?s ?sLabel ?rgb ?edgelabel ?o ?oLabel
WHERE {
{
SELECT ?s ?sLabel ?rgb ?o ?oLabel
WHERE {
?o wdt:P50 wd:Q47475003, ?s .
FILTER (?s != wd:Q47475003)
OPTIONAL {
?s wdt:P21 ?gender .
BIND( IF(?gender = wd:Q6581097, "3182BD", "E6550D") AS ?rgb)
}
}
}
UNION
{
SELECT ?s ?sLabel ?rgb ?o ?oLabel
WHERE {
?o wdt:P50 wd:Q47475003 .
?o wdt:P921 ?s .
BIND("CC00AA" AS ?rgb) .
}
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,de,ru,es,zh,jp". }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment