SARS-CoV-2-Queries

deathsPerHundredThousand.rq

Code examples: curl

SPARQL

#defaultView:BubbleChart
SELECT ?countryLabel ((?maxDeath*100000)/?maxPopulation AS ?numOfDeathsPer100k) WITH {
  SELECT DISTINCT ?country (MAX(?numDeaths) AS ?maxDeath) (MAX(?population) AS ?maxPopulation) WHERE {
    ?outbreak p:P31 [ ps:P31 wd:Q3241045 ; pq:P642 wd:Q84263196 ] ;
              wdt:P276 ?country ; wdt:P1120 ?numDeaths .
    ?country wdt:P31 wd:Q3624078 ; wdt:P1082 ?population .
  } GROUP BY ?country
} AS %DATA {
  INCLUDE %DATA
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,en". }
}

run or edit

Output

Code examples

curl

curl -s https://raw.githubusercontent.com/egonw/SARS-CoV-2-Queries/master/sparql/deathsPerHundredThousand.rq | sed 's+<lang/>+en+' > deathsPerHundredThousand.rq

curl -H "Accept: text/tab-separated-values" -G https://query.wikidata.org/bigdata/namespace/wdq/sparql --data-urlencode query@deathsPerHundredThousand.rq

This SPARQL query is available under CCZero.