Skip to content

Instantly share code, notes, and snippets.

@lucaswerkmeister
Created June 5, 2016 16:45
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 lucaswerkmeister/b50942a8ab0f54c1a07beff15275bd15 to your computer and use it in GitHub Desktop.
Save lucaswerkmeister/b50942a8ab0f54c1a07beff15275bd15 to your computer and use it in GitHub Desktop.
#defaultView:BubbleChart
SELECT ?country ?countryLabel ?population ?rgb
WHERE
{
?country wdt:P31 wd:Q3624078;
wdt:P1082 ?population.
MINUS { ?country wdt:P576 ?ceased. }
# Americas: red; North America: dark red; Central America: crimson; South America: dark orange
OPTIONAL {
?country wdt:P30 wd:Q828.
BIND("FF0000" AS ?rgb).
}
OPTIONAL {
?country wdt:P30 wd:Q49.
BIND("8B0000" AS ?rgb).
}
OPTIONAL {
?country wdt:P30 wd:Q27611.
BIND("DC143C" AS ?rgb).
}
OPTIONAL {
?country wdt:P30 wd:Q18.
BIND("FF8C00" AS ?rgb).
}
# Eurasia: green; Europe: aqua, Asia: lime
OPTIONAL {
?country wdt:P30 wd:Q5401.
BIND("008000" AS ?rgb).
}
OPTIONAL {
?country wdt:P30 wd:Q46.
BIND("00FFFF" AS ?rgb).
}
OPTIONAL {
?country wdt:P30 wd:Q48.
BIND("00FF00" AS ?rgb).
}
# Africa: purple; Oceania: blue; Australia: dark blue
OPTIONAL {
?country wdt:P30 wd:Q15.
BIND("800080" AS ?rgb).
}
OPTIONAL {
?country wdt:P30 wd:Q538.
BIND("0000FF" AS ?rgb).
}
OPTIONAL {
?country wdt:P30 wd:Q3960.
BIND("00008B" AS ?rgb).
}
BIND(IF(BOUND(?rgb),?rgb,"000000") AS ?rgb).
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment