SARS-CoV-2-Queries

surfacesCounts.rq

Code examples: curl

SPARQL

SELECT ?virus ?virusLabel ?count WITH {
  SELECT ?virus (COUNT(DISTINCT ?work) AS ?count) WHERE {
    VALUES ?virus {
      wd:Q82069695 # SARS-CoV-2
      wd:Q16983360 # HKU1
      wd:Q16991954 # OC43
      wd:Q8351095  # NL63 
      wd:Q16983356 # 229E 
      wd:Q4902157  # MERS-CoV
      wd:Q278567   # SARS-CoV
    }
    ?work wdt:P921 ?virus ;
          wdt:P921 wd:Q484298 .
  } GROUP BY ?virus
} AS %ARTICLES WHERE {
  INCLUDE %ARTICLES
  SERVICE wikibase:label { bd:serviceParam wikibase:language "pt,en". }
}
ORDER BY DESC(?count)

run or edit

Output

virus count
Coronavírus humano 229E (edit) 4
coronavírus da síndrome respiratória aguda grave 2 (edit) 3
Coronavírus humano OC43 (edit) 2
coronavírus da síndrome respiratória do Oriente Médio (edit) 1

Code examples

curl

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

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

This SPARQL query is available under CCZero.