Wikidata:WikiProject COVID-19/Queries/SPARQL Study
SPARQL is a query language and protocol that allows you to find, add, modify or delete RDF data available across the Internet. Currently, SPARQL can be used to query Wikidata thanks to the query service available at https://query.wikidata.org. This page introduces several SPARQL queries to visualize various aspects of COVID-19 information including clinical and biological knowledge, epidemiological data, metadata of research outputs, online resources and social impacts. Throughout this Wikidata page, COVID stands to any subset of the collection of the three main Wikidata items related to the COVID-19 pandemic: COVID-19 (Q84263196), SARS-CoV-2 (Q82069695), and COVID-19 pandemic (Q81068910).
These queries have been developed to analyze the landscape of the COVID-19 knowledge in Wikidata and show it in Representing COVID-19 information in collaborative knowledge graphs: a study of Wikidata (Turki, et al., 2020).
Data Model edit
Classes and properties linked to COVID-19 as an object edit
The following query uses these:
- Items: COVID-19 (Q84263196)
- Properties: instance of (P31)
SELECT ?p ?proplabel ?c ?classlabel (COUNT(*) AS ?count) WHERE { ?x ?prop wd:Q84263196. ?x wdt:P31 ?c. ?c rdfs:label ?classlabel. FILTER(LANG(?classlabel)="en") ?p wikibase:directClaim ?prop. ?p rdfs:label ?proplabel. FILTER(LANG(?proplabel)="en") } GROUP BY ?p ?proplabel ?c ?classlabel ORDER BY DESC(?count)
Classes and properties linked to SARS-CoV-2 as an object edit
The following query uses these:
- Items: SARS-CoV-2 (Q82069695)
- Properties: instance of (P31)
SELECT ?p ?proplabel ?c ?classlabel (COUNT(*) AS ?count) WHERE { ?x ?prop wd:Q82069695. ?x wdt:P31 ?c. ?c rdfs:label ?classlabel. FILTER(LANG(?classlabel)="en") ?p wikibase:directClaim ?prop. ?p rdfs:label ?proplabel. FILTER(LANG(?proplabel)="en") } GROUP BY ?p ?proplabel ?c ?classlabel ORDER BY DESC(?count)
Classes and properties linked to the COVID-19 pandemic as an object edit
The following query uses these:
- Properties: instance of (P31)
SELECT ?p ?proplabel ?c ?classlabel (COUNT(*) AS ?count) WHERE { ?x ?prop wd:Q81068910. ?x wdt:P31 ?c. ?c rdfs:label ?classlabel. FILTER(LANG(?classlabel)="en") ?p wikibase:directClaim ?prop. ?p rdfs:label ?proplabel. FILTER(LANG(?proplabel)="en") } GROUP BY ?p ?proplabel ?c ?classlabel ORDER BY DESC(?count)
Classes and properties linked to COVID-19 as a subject edit
The following query uses these:
- Items: COVID-19 (Q84263196)
- Properties: instance of (P31)
SELECT ?p ?proplabel ?c ?classlabel (COUNT(*) AS ?count) WHERE { wd:Q84263196 ?prop ?x. ?x wdt:P31 ?c. ?c rdfs:label ?classlabel. FILTER(LANG(?classlabel)="en") ?p wikibase:directClaim ?prop. ?p rdfs:label ?proplabel. FILTER(LANG(?proplabel)="en") } GROUP BY ?p ?proplabel ?c ?classlabel ORDER BY DESC(?count)
Classes and properties linked to SARS-CoV-2 as a subject edit
The following query uses these:
- Items: SARS-CoV-2 (Q82069695)
- Properties: instance of (P31)
SELECT ?p ?proplabel ?c ?classlabel (COUNT(*) AS ?count) WHERE { wd:Q82069695 ?prop ?x. ?x wdt:P31 ?c. ?c rdfs:label ?classlabel. FILTER(LANG(?classlabel)="en") ?p wikibase:directClaim ?prop. ?p rdfs:label ?proplabel. FILTER(LANG(?proplabel)="en") } GROUP BY ?p ?proplabel ?c ?classlabel ORDER BY DESC(?count)
Classes and properties linked to the COVID-19 pandemic as a subject edit
The following query uses these:
- Properties: instance of (P31)
SELECT ?p ?proplabel ?c ?classlabel (COUNT(*) AS ?count) WHERE { wd:Q81068910 ?prop ?x. ?x wdt:P31 ?c. ?c rdfs:label ?classlabel. FILTER(LANG(?classlabel)="en") ?p wikibase:directClaim ?prop. ?p rdfs:label ?proplabel. FILTER(LANG(?proplabel)="en") } GROUP BY ?p ?proplabel ?c ?classlabel ORDER BY DESC(?count)
Language Representation edit
Language Representation of the subjects of the semantic relations having COVID as an object edit
The following query uses these:
- Items: COVID-19 (Q84263196) , SARS-CoV-2 (Q82069695) , COVID-19 pandemic (Q81068910)
SELECT ?lang (COUNT(*) AS ?count) WHERE { {?x ?prop wd:Q84263196.} UNION {?x ?prop wd:Q82069695.} UNION {?x ?prop wd:Q81068910.} ?x rdfs:label ?label. BIND(LANG(?label) AS ?lang) } GROUP BY ?lang ORDER BY DESC(?count)
Language Representation of the predicates of the semantic relations having COVID as an object edit
The following query uses these:
- Items: COVID-19 (Q84263196) , SARS-CoV-2 (Q82069695) , COVID-19 pandemic (Q81068910)
SELECT ?lang (COUNT(*) AS ?count) WHERE { {?x ?prop wd:Q84263196.} UNION {?x ?prop wd:Q82069695.} UNION {?x ?prop wd:Q81068910.} ?p wikibase:directClaim ?prop. ?p rdfs:label ?label. BIND(LANG(?label) AS ?lang) } GROUP BY ?lang ORDER BY DESC(?count)
Language Representation of the objects of the semantic relations having COVID as a subject edit
The following query uses these:
- Items: COVID-19 (Q84263196) , SARS-CoV-2 (Q82069695) , COVID-19 pandemic (Q81068910)
SELECT ?lang (COUNT(*) AS ?count) WHERE { {wd:Q84263196 ?prop ?x.} UNION {wd:Q82069695 ?prop ?x.} UNION {wd:Q81068910 ?prop ?x.} ?x rdfs:label ?label. BIND(LANG(?label) AS ?lang) } GROUP BY ?lang ORDER BY DESC(?count)
Language Representation of the predicates of the semantic relations having COVID as a subject edit
The following query uses these:
- Items: COVID-19 (Q84263196) , SARS-CoV-2 (Q82069695) , COVID-19 pandemic (Q81068910)
SELECT ?lang (COUNT(*) AS ?count) WHERE { {wd:Q84263196 ?prop ?x.} UNION {wd:Q82069695 ?prop ?x.} UNION {wd:Q81068910 ?prop ?x.} ?p wikibase:directClaim ?prop. ?p rdfs:label ?label. BIND(LANG(?label) AS ?lang) } GROUP BY ?lang ORDER BY DESC(?count)
Representation of diseases in language editions of Wikipedia edit
The following query uses these:
- Properties: Disease Ontology ID (P699) , instance of (P31) , subclass of (P279)
SELECT ?language (COUNT (?page) AS ?count) WITH { SELECT DISTINCT ?item WHERE { { ?item wdt:P699 ?DO_ID .} UNION { ?item wdt:P31*/wdt:P279* wd:Q11190 } UNION { ?item wdt:P31*/wdt:P279* wd:Q12136 . } UNION { ?item wdt:P31*/wdt:P279* wd:Q796194 . } UNION { ?item wdt:P31*/wdt:P279* wd:Q12140 . } } LIMIT 100000 } AS %items WHERE { INCLUDE %items ?wikipedia wikibase:wikiGroup "wikipedia". ?page schema:about ?item ; schema:isPartOf ?wikipedia . ?page schema:inLanguage ?language } GROUP BY ?language ORDER BY DESC(?count)
Language Representation of medical items in Wikidata edit
The following query uses these:
- Properties: Disease Ontology ID (P699) , MeSH descriptor ID (P486) , instance of (P31) , subclass of (P279)
SELECT ?language (COUNT (?label) AS ?count) WITH { SELECT DISTINCT ?item WHERE { { ?item wdt:P699 ?DO_ID .} UNION { ?item wdt:P486 ?MeSH_Descriptor_ID .} UNION { ?item wdt:P31*/wdt:P279* wd:Q11190 } UNION { ?item wdt:P31*/wdt:P279* wd:Q12136 . } UNION { ?item wdt:P31*/wdt:P279* wd:Q796194 . } UNION { ?item wdt:P31*/wdt:P279* wd:Q12140 . } } LIMIT 100000 } AS %items WHERE { INCLUDE %items ?item rdfs:label ?label. BIND(LANG(?label) AS ?language) } GROUP BY ?language ORDER BY DESC(?count)
edit
The following query uses these:
- Items: COVID-19 pandemic (Q81068910) , COVID-19 (Q84263196) , SARS-CoV-2 (Q82069695) , human (Q5) , scholarly article (Q13442814)
- Properties: instance of (P31)
SELECT ?language (COUNT (?label) AS ?count) WITH { SELECT DISTINCT ?item ?itemLabel ?property ?propertyLabel ?claim WHERE { VALUES ?COVID { wd:Q81068910 wd:Q84263196 wd:Q82069695 } { ?COVID ?predicate1 ?item . } UNION { ?item ?predicate2 ?COVID . } FILTER NOT EXISTS {?item wdt:P31 wd:Q5 . } FILTER NOT EXISTS {?item wdt:P31 wd:Q13442814 . } } LIMIT 100000 } AS %items WHERE { INCLUDE %items ?item rdfs:label ?label. BIND(LANG(?label) AS ?language) } GROUP BY ?language ORDER BY DESC(?count)
edit
The following query uses these:
- Items: COVID-19 pandemic (Q81068910) , COVID-19 (Q84263196) , SARS-CoV-2 (Q82069695) , human (Q5) , scholarly article (Q13442814)
- Properties: instance of (P31)
SELECT ?language (COUNT (?page) AS ?count) WITH { SELECT DISTINCT ?item ?itemLabel ?property ?propertyLabel ?claim WHERE { VALUES ?COVID { wd:Q81068910 wd:Q84263196 wd:Q82069695 } { ?COVID ?predicate1 ?item . } UNION { ?item ?predicate2 ?COVID . } FILTER NOT EXISTS {?item wdt:P31 wd:Q5 . } FILTER NOT EXISTS {?item wdt:P31 wd:Q13442814 . } } LIMIT 100000 } AS %items WHERE { INCLUDE %items ?wikipedia wikibase:wikiGroup "wikipedia". ?page schema:about ?item ; schema:isPartOf ?wikipedia . ?page schema:inLanguage ?language } GROUP BY ?language ORDER BY DESC(?count)
The following query uses these:
- Properties: instance of (P31)
SELECT ?class ?classLabel ?ExternalID ?ExternalIDLabel (COUNT(*) AS ?count) WITH { SELECT DISTINCT ?x WHERE { VALUES ?c {wd:Q84263196 wd:Q81068910 wd:Q82069695} {?c ?p ?x} UNION {?x ?p ?c} } } AS %items WHERE { INCLUDE %items. ?x wdt:P31 ?class. ?x ?p1 ?y. ?ExternalID wikibase:directClaim ?p1. ?ExternalID wikibase:propertyType wikibase:ExternalId. ?class rdfs:label ?classLabel. FILTER(LANG(?classLabel)="en") ?ExternalID rdfs:label ?ExternalIDLabel. FILTER(LANG(?ExternalIDLabel)="en") } GROUP BY ?class ?classLabel ?ExternalID ?ExternalIDLabel ORDER BY DESC(?count)
Visualizing facets of COVID-19 via SPARQL edit
SARS-CoV-2 interactions with the human proteome edit
The following query uses these:
- Items: SARS-CoV-2 (Q82069695) , gene (Q7187)
- Properties: found in taxon (P703) , instance of (P31) , encodes (P688) , physically interacts with (P129)
#defaultView:Dimensions SELECT ?geneLabel ?proteinLabel ?interacts_withLabel WHERE { ?gene wdt:P703 wd:Q82069695 ; wdt:P31 wd:Q7187 . ?gene wdt:P688 ?protein . OPTIONAL {?protein wdt:P129 ?interacts_with.} SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } LIMIT 10000
Currently listed symptoms of COVID-19, with qualifiers indicating their frequency edit
The following query uses these:
- Items: COVID-19 (Q84263196)
- Properties: symptoms and signs (P780) , image (P18)
Features: Graph (Q24515287)
#defaultView:Graph
SELECT ?item ?itemLabel ?pic ?linkTo
WHERE
{
SERVICE gas:service {
gas:program gas:gasClass "com.bigdata.rdf.graph.analytics.SSSP" ;
gas:in wd:Q84263196;
gas:out ?item ;
gas:out1 ?depth ;
gas:maxIterations 3 ;
gas:linkType wdt:P780 .
}
OPTIONAL { ?item wdt:P780 ?linkTo }
OPTIONAL { ?item wdt:P18 ?pic }
SERVICE wikibase:label {bd:serviceParam wikibase:language "en" }
}
edit
The following query uses these:
- Items: COVID-19 (Q84263196)
- Properties: symptoms and signs (P780)
SELECT ?disease ?diseaseLabel (COUNT(?symptom) AS ?symptom_count) (GROUP_CONCAT(?symptom_label; separator=" // ") AS ?symptoms) WHERE { wd:Q84263196 wdt:P780 ?symptom . ?disease wdt:P780 ?symptom . FILTER (wd:Q84263196 != ?disease) ?symptom rdfs:label ?symptom_label . FILTER(lang(?symptom_label) = "en") SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } GROUP BY ?disease ?diseaseLabel ORDER BY DESC(?symptom_count)
Correlation between the current number of cases and mortality rates in every country, calculated from numeric summary data for each region edit
The following query uses these:
- Properties: part of (P361) , location (P276) , case fatality rate (P3457) , number of cases (P1603) , point in time (P585)
#defaultView:BarChart SELECT ?cases ?mortality_rate ?country WITH { SELECT ?x (MAX(?d) AS ?date) WHERE { ?x p:P3457 [ps:P3457 ?m; pq:P585 ?d]. ?x wdt:P361 wd:Q83741704. } GROUP BY ?x } AS %dates WHERE { INCLUDE %dates. ?x p:P1603 [ps:P1603 ?cases; pq:P585 ?date]. ?x p:P3457 [ps:P3457 ?mortality_rate; pq:P585 ?date]. FILTER(?cases < 50000) FILTER(?mortality_rate < 1) ?x wdt:P276 ?c. ?c rdfs:label ?country. FILTER(LANG(?country)="en") }
Age distribution of notable persons who have died of COVID-19 edit
The following query uses these:
- Items: COVID-19 (Q84263196) , human (Q5)
- Properties: cause of death (P509) , instance of (P31) , date of death (P570) , date of birth (P569)
#defaultView:LineChart SELECT ?age (COUNT(?person) AS ?count) WHERE { { SELECT ?person (SAMPLE(?age) AS ?age) WHERE { ?person wdt:P509 wd:Q84263196 ; wdt:P31 wd:Q5 OPTIONAL { ?person wdt:P570 ?d } ?person wdt:P569 ?dob ; wdt:P570 ?dod . BIND(YEAR(?dod)-YEAR(?dob) as ?age) SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } GROUP BY ?person } } GROUP BY ?age
Death age distribution for people who were born after 1901 edit
The following query uses these:
- Items: human (Q5)
- Properties: instance of (P31) , date of death (P570) , date of birth (P569)
#defaultView:LineChart SELECT ?age (COUNT(?person) AS ?count) WITH { SELECT DISTINCT * WHERE { ?person wdt:P31 wd:Q5. ?person wdt:P570 ?dod. ?person wdt:P569 ?dob. FILTER(YEAR(?dod) > 1900) FILTER(?dod > ?dob) } LIMIT 100000 } AS %d WHERE { INCLUDE %d. BIND(YEAR(?dod)-YEAR(?dob) as ?age) FILTER(?age <= 120) } GROUP BY ?age ORDER BY DESC(?count)
edit
The following query uses these:
- Items: COVID-19 (Q84263196)
- Properties: main subject (P921) , title (P1476) , KIT Linked Open Numbers ID (P5176) , numeric value (P1181)
Features: BubbleChart (Q24515280)
#defaultView:BubbleChart
# Most frequent n-grams from a random set of 1000 COVID-19 publications
SELECT DISTINCT ?Ngram ?Score
WITH
{ # Generating a list of entities to be analyzed
SELECT ?Publication
{
SERVICE bd:sample { ?Publication wdt:P921 wd:Q84263196 . bd:serviceParam bd:sample.limit 1000 }
}
} AS %items
WITH
{ # Preprocessing the titles
SELECT ?Title ?Publication ?Seeds ?ClearTitleLength
{
INCLUDE %items
?Publication wdt:P1476 ?Title.
BIND (REPLACE(STR(?Title),"[\\.:,;\\[\\]\\?()$]","") AS ?ClearTitle) # remove some frequent special characters, including colons and semicolons
BIND(STRLEN(?ClearTitle) AS ?ClearTitleLength)
FILTER(LANG(?Title)="en")
# Basic processing of the titles
BIND ("::: ::: ::: ::: ::: ::: ::: ::: " AS ?StartCodon)
BIND (" ;;; ;;; ;;; ;;; ;;; ;;; ;;; ;;;" AS ?StopCodon)
BIND (LCASE(CONCAT(?StartCodon , # add start codon of colons to assist with processing of n-grams at beginning of title
?ClearTitle,
?StopCodon)) # add stop codon of semicolons to assist with processing of n-grams at end of title
AS ?Seeds )
}
} AS %titles
WITH
{ # Generating a list of regexes to look for the NumericValue-th word in a string
# Based on https://w.wiki/KG$ by Jura1
SELECT ?Regex1 ?Regex2 ?Regex3 ?Regex4 ?NumericValue
{
?NumberItem wdt:P5176 []; wdt:P1181 ?NumericValue .
FILTER( ?NumericValue > 0 )
FILTER( ?NumericValue < 151)
BIND("^([^ ]+ ){" AS ?RegexStart)
BIND("}([^ ]+) .*" AS ?RegexEnd)
BIND( CONCAT( ?RegexStart , STR( ?NumericValue - 1 ), ?RegexEnd ) AS ?Regex1)
BIND( CONCAT( ?RegexStart , STR( ?NumericValue + 1 ), ?RegexEnd ) AS ?Regex2)
BIND( CONCAT( ?RegexStart , STR( ?NumericValue + 3 ), ?RegexEnd ) AS ?Regex3)
BIND( CONCAT( ?RegexStart , STR( ?NumericValue + 5 ), ?RegexEnd ) AS ?Regex4)
}
} AS %regexes
WITH
{ # Applying the regexes to the titles to extract ngrams (for n <= 8), and counting occurrences of the ngrams across titles
SELECT
DISTINCT ?Ngram
(COUNT(DISTINCT ?Title) AS ?Count)
?Length
(( ?Count * ?Length ) AS ?Score)
(SAMPLE(DISTINCT ?Publication) AS ?ExamplePub)
{
INCLUDE %regexes
INCLUDE %titles
BIND(
(CONCAT(
REPLACE(?Seeds, ?Regex1, "$1"), " ",
REPLACE(?Seeds, ?Regex1, "$2"), " ",
REPLACE(?Seeds, ?Regex2, "$1"), " ",
REPLACE(?Seeds, ?Regex2, "$2"), " ",
REPLACE(?Seeds, ?Regex3, "$1"), " ",
REPLACE(?Seeds, ?Regex3, "$2"), " ",
REPLACE(?Seeds, ?Regex4, "$1"), " ",
REPLACE(?Seeds, ?Regex4, "$2")
)
) AS ?NgramCandidate)
BIND(
(REPLACE
(REPLACE
(REPLACE
(REPLACE
(STR(?NgramCandidate),"([;:])",""),
"(^\\s+)",""),
"(\\s+$)",""),
"([ ]{2,})"," ")
) AS ?Ngram)
BIND(STRLEN(?Ngram) AS ?Length)
FILTER (?Length > 3 )
FILTER (?Length <= ?ClearTitleLength )
}
GROUP BY ?Ngram ?Count ?Length ?Score ?ExamplePub
HAVING(?Count > 4)
} AS %ngrams
WHERE {
INCLUDE %ngrams
# Exclude Ngrams starting or ending with any of a set of blacklisted words
BIND("(a
edit
The following query uses these:
- Properties: main subject (P921) , publication date (P577) , author (P50)
SELECT ?node1 ?node2 ?node1Label ?node2Label ?pdate ?topicLabel ?authorLabel (COUNT(?work) AS ?count) WHERE { VALUES ?nucleation_topics { wd:Q84263196 wd:Q82069695 wd:Q81068910 } ?work wdt:P921 ?nucleation_topics, ?node1, ?node2. # Find co-nodes FILTER (?node1 != ?node2) # Exclude self-links # OPTIONAL { ?work wdt:P577 ?pdate. } # OPTIONAL { ?work wdt:P50 ?author. } SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,de,ru,es,zh,jp". } } GROUP BY ?node1 ?node2 ?node1Label ?node2Label ?pdate ?topicLabel ?authorLabel ORDER BY DESC(?count) LIMIT 10000
Bankrupt publicly listed businesses due to the COVID-19 pandemic edit
The following query uses these:
- Items: organization (Q43229) , bankruptcy (Q152074) , economic impact of the COVID-19 pandemic (Q96175652)
- Properties: instance of (P31) , subclass of (P279) , country (P17) , inception (P571) , industry (P452) , parent organization (P749) , has subsidiary (P355) , significant event (P793) , point in time (P585) , has cause (P828)
SELECT ?organization ?organizationLabel ?bankruptcyDate ?countryLabel ?inception (GROUP_CONCAT(DISTINCT ?industryLabel; separator=", ") AS ?industries) (GROUP_CONCAT(DISTINCT ?parentLabel; separator=", ") AS ?parents) (GROUP_CONCAT(DISTINCT ?subsiduaryLabel; separator=", ") AS ?subsiduaries) WHERE { ?organization wdt:P31/wdt:P279* wd:Q43229. OPTIONAL { ?organization wdt:P17 ?country }. OPTIONAL { ?organization wdt:P571 ?inception }. OPTIONAL { ?organization wdt:P452 ?industry. ?industry rdfs:label ?industryLabel. FILTER(LANG(?industryLabel)="en") }. OPTIONAL { ?organization wdt:P749 ?parent. ?parent rdfs:label ?parentLabel. FILTER(LANG(?parentLabel)="en") }. OPTIONAL { ?organization wdt:P355 ?subsiduary. ?subsiduary rdfs:label ?subsiduaryLabel. FILTER(LANG(?subsiduaryLabel)="en") }. ?organization p:P793 ?event. ?event ps:P793 wd:Q152074. OPTIONAL { ?event pq:P585 ?bankruptcyDate }. ?event pq:P828 wd:Q96175652. SERVICE wikibase:label { bd:serviceParam wikibase:language "en".} } GROUP BY ?organization ?organizationLabel ?bankruptcyDate ?countryLabel ?inception ORDER BY DESC(?bankruptcyDate)
edit
The following query uses these:
- Properties: main subject (P921) , instance of (P31) , subclass of (P279)
#defaultView:Tree SELECT DISTINCT ?related ?relatedLabel ?type ?typeLabel WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } ?COVID_19 wdt:P921 wd:Q84263196. ?COVID_19 wdt:P921 ?related. {?related wdt:P31 wd:Q12140.} UNION {?related wdt:P279 wd:Q179661.} OPTIONAL{?related wdt:P31 ?type.} }
Symptoms of COVID-19 disease listed by their nature of statement (P5102) or sourcing circumstances (P1480) qualifiers, with references edit
The following query uses these:
- Properties: DOI (P356) , stated in (P248) , nature of statement (P5102) , sourcing circumstances (P1480)
SELECT DISTINCT ?subjectLabel ?predicateLabel ?objectLabel ?qualifier ?source_doi WHERE { VALUES ?subject {wd:Q84263196 wd:Q82069695 wd:Q81068910} VALUES ?qual {pq:P5102 pq:P1480} ?subject ?p [?prop ?object; ?qual ?nos]. ?object rdfs:label ?objectLabel. FILTER(LANG(?objectLabel)="en") FILTER(?object != ?nos) ?predicate wikibase:claim ?p. OPTIONAL { ?subject ?p ?statement. ?statement ?p1 ?object. ?statement (prov:wasDerivedFrom/pr:P248) ?source. ?source wdt:P356 ?source_doi. } BIND(IF(?qual = pq:P5102, "Nature of statement", "Sourcing circumstances") AS ?qualifier). SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }
Extended graph of the three main COVID items and the statements for which they are the subject edit
The following query uses these:
- Items: Wikidata property to link to Commons (Q18610173) , Wikidata property for linking to a representative image (Q26940804) , COVID-19 (Q84263196) , COVID-19 pandemic (Q81068910) , SARS-CoV-2 (Q82069695)
- Properties: instance of (P31)
Features: Graph (Q24515287)
#PREFIX target: <http://www.wikidata.org/entity/Q40878>
#defaultView:Graph
SELECT ?node ?nodeLabel ?nodeImage ?childNode ?childNodeLabel ?childNodeImage ?rgb
WITH {
SELECT DISTINCT ?property WHERE {
?property a wikibase:Property;
wdt:P31 wd:Q18610173 ;
wdt:P31 wd:Q26940804 .
}
} AS %properties
WITH {
SELECT DISTINCT ?node ?childNode WHERE {
VALUES ?node { wd:Q84263196 wd:Q81068910 wd:Q82069695 }
# BIND(target: AS ?node)
?node ?p ?i.
?childNode ?x ?p.
?childNode rdf:type wikibase:Property.
FILTER(STRSTARTS(STR(?i), "http://www.wikidata.org/entity/Q"))
FILTER(STRSTARTS(STR(?childNode), "http://www.wikidata.org/entity/P"))
}
LIMIT 5000
} AS %nodes
WITH {
SELECT DISTINCT ?childNode ?node ?rgb WHERE {
BIND("EFFBD8" AS ?rgb)
VALUES ?target { wd:Q84263196 wd:Q81068910 wd:Q82069695 }
?target ?p ?childNode.
?node ?x ?p.
?node rdf:type wikibase:Property.
FILTER(STRSTARTS(STR(?childNode), "http://www.wikidata.org/entity/Q"))
}
LIMIT 5000
} AS %childNodes
WHERE {
{
INCLUDE %nodes
}
UNION
{
INCLUDE %childNodes
}
OPTIONAL {
INCLUDE %properties
?property wikibase:directClaim ?nodeclaim.
?node ?nodeclaim ?nodeImage.
}
OPTIONAL {
INCLUDE %properties
?property wikibase:directClaim ?childNodeclaim.
?childNode ?childNodeclaim ?childNodeImage.
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Daily mortality rate from COVID-19 in Tunisia edit
The following query uses these:
- Properties: number of deaths (P1120) , number of cases (P1603) , point in time (P585)
#defaultView:LineChart SELECT ?date ((?mort / ?cases) AS ?mortrate) WHERE { wd:Q87343682 wdt:P1120 ?mort. wd:Q87343682 p:P1120 ?stmort. ?stmort pq:P585 ?date. ?stmort ps:P1120 ?mort. wd:Q87343682 wdt:P1603 ?cases. wd:Q87343682 p:P1603 ?st. ?st pq:P585 ?date. ?st ps:P1603 ?cases. } ORDER BY ?date
Tunisian governorate-level cases of COVID-19 edit
The following query uses these:
- Properties: part of (P361) , location (P276) , number of cases (P1603)
#defaultView:BarChart SELECT (MAX(?cases) AS ?casenow) ?cityLabel WHERE { ?cd wdt:P361 wd:Q87343682. ?cd wdt:P276 ?city. ?city rdfs:label ?cityLabel. FILTER(LANG(?cityLabel)="en") ?cd wdt:P1603 ?cases. } GROUP BY ?cityLabel
Daily Evolution of Clinical tests by laboratory in Tunisia edit
The following query uses these:
- Properties: part of (P361) , number of medical tests (P8011) , affiliation (P1416) , point in time (P585)
#defaultView:BarChart SELECT ?tests ?date ?lab WHERE { ?x wdt:P361 wd:Q91004675. ?x wdt:P8011 ?tests. ?x wdt:P1416 ?aff. ?aff rdfs:label ?lab. FILTER(LANG(?lab)="en") ?x p:P8011 ?sttest. ?sttest pq:P585 ?date. ?sttest ps:P8011 ?tests. } ORDER BY DESC(?test)
edit
The following query uses these:
- Properties: instance of (P31) , main subject (P921) , URL (P2699) , publisher (P123) , copyright license (P275)
SELECT ?toolLabel ?tool ?typeLabel ?URL ?publisherLabel ?licenseLabel WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } ?tool wdt:P31 ?type. ?type wdt:P921 wd:Q81068910. OPTIONAL { ?tool wdt:P2699 ?URL; wdt:P123 ?publisher; wdt:P275 ?license. } }
COVID publications edit
edit
The following query uses these:
- Properties: main subject (P921) , instance of (P31) , subclass of (P279) , part of (P361) , facet of (P1269) , cites work (P2860)
#defaultView:Table SELECT ?count ?cited_work ?cited_workLabel WITH { SELECT (count(?work) as ?count) ?cited_work WHERE { VALUES ?topic { wd:Q84263196 wd:Q81068910 wd:Q82069695 } { ?work wdt:P921/wdt:P31*/wdt:P279* ?topic . } union { ?work wdt:P921/wdt:P361+ ?topic . } union { ?work wdt:P921/wdt:P1269+ ?topic . } ?work wdt:P2860 ?cited_work . } GROUP BY ?cited_work } AS %result WHERE { INCLUDE %result SERVICE wikibase:label { bd:serviceParam wikibase:language "en,da,de,es,fr,jp,nl,no,ru,sv,zh" . } } ORDER BY DESC(?count) LIMIT 200
edit
The following query uses these:
- Properties: main subject (P921) , part of (P361)
SELECT ?number_of_citations ?author ?authorLabel ?cited_work_example ?cited_work_exampleLabel WITH { # Find works about the topic SELECT DISTINCT ?work WHERE { VALUES ?topic { wd:Q84263196 wd:Q81068910 wd:Q82069695 } ?work wdt:P921 / (wdt:P361+
Most common publication venues for COVID-themed papers edit
The following query uses these:
- Properties: main subject (P921) , instance of (P31) , subclass of (P279) , part of (P361) , facet of (P1269) , published in (P1433) , part of the series (P179) , publisher (P123)
#defaultView:Table SELECT ?count ?venue ?venueLabel ?publisherLabel WITH { SELECT (count(?work) as ?count) ?venue ?publisher WHERE { VALUES ?topic { wd:Q84263196 wd:Q81068910 wd:Q82069695 } { ?work wdt:P921/wdt:P31*/wdt:P279* ?topic . } union { ?work wdt:P921/wdt:P361+ ?topic . } union { ?work wdt:P921/wdt:P1269+ ?topic . } ?work wdt:P1433/wdt:P179* ?venue . ?venue wdt:P123 ?publisher . } GROUP BY ?venue ?publisher } AS %result WHERE { INCLUDE %result SERVICE wikibase:label { bd:serviceParam wikibase:language "en,da,de,es,fr,jp,nl,no,ru,sv,zh" . } } ORDER BY DESC(?count)
Clinical trials on interventions to treat COVID-19 edit
The following query uses these:
- Properties: instance of (P31) , medical condition (P1050) , subclass of (P279) , start time (P580) , research intervention (P4844) , sponsor (P859)
SELECT DISTINCT ?start_date ?trial ?trialLabel ?intervention ?interventionLabel ?sponsor ?sponsorLabel WHERE { ?trial wdt:P31 wd:Q30612 ; wdt:P1050 / wdt:P279* wd:Q84263196 . OPTIONAL { ?trial wdt:P580 ?starttime BIND(SUBSTR(STR(?starttime), 0, 11) AS ?start_date) } OPTIONAL { ?trial wdt:P4844 ?intervention } OPTIONAL { ?trial wdt:P859 ?sponsor } SERVICE wikibase:label { bd:serviceParam wikibase:language "en,da,de,es,fr,jp,nl,no,pl,ru,sv,zh". } } ORDER BY DESC(?starttime)
Awards most frequently received by authors of COVID papers edit
The following query uses these:
- Properties: main subject (P921) , author (P50) , award received (P166)
SELECT ?count ?award ?awardLabel ?recipients ?recipientsUrl WITH { SELECT (COUNT(?researcher) AS ?count) ?award (GROUP_CONCAT(DISTINCT ?researcher_label; separator=", ") AS ?recipients) WHERE { { SELECT DISTINCT ?researcher ?award WHERE { VALUES ?topic { wd:Q84263196 wd:Q81068910 wd:Q82069695 } hint:Query hint:optimizer "None" . ?work wdt:P921 ?topic . ?work wdt:P50 ?researcher . ?researcher wdt:P166 ?award . } LIMIT 100 } ?researcher rdfs:label ?researcher_label . FILTER (LANG(?researcher_label) = 'en') } GROUP BY ?award } AS %result WHERE { INCLUDE %result ?award rdfs:label ?awardLabel . FILTER (LANG(?awardLabel) = 'en') } GROUP BY ?count ?award ?awardLabel ?recipients ?recipientsUrl ORDER BY DESC(?count)
Map of organizations associated with works about COVID edit
Institutions that have published a single paper on the topic are in green, those that have published 1-10 are in orange, and those having published >10 are in blue.
The following query uses these:
- Properties: main subject (P921) , part of (P361)
Features: map (Q24515275)
#defaultView:Map
SELECT ?organization ?organizationLabel ?geo ?count ?layer
WITH {
SELECT DISTINCT ?work WHERE {
# Works on the topic
VALUES ?topic { wd:Q84263196 wd:Q81068910 wd:Q82069695 }
?work wdt:P921 / (wdt:P361+
Online resource locations for information on COVID-19 regional outbreaks edit
Official websites edit
The following query uses these:
- Properties: official website (P856) , instance of (P31) , of (P642)
SELECT * WHERE { ?outbreak p:P31 [ps:P31 wd:Q3241045; pq:P642 wd:Q84263196]. ?outbreak rdfs:label ?label. FILTER(LANG(?label)="en") ?outbreak wdt:P856 ?URL. }
Main hashtags edit
The following query uses these:
- Properties: hashtag (P2572) , instance of (P31) , of (P642)
SELECT * WHERE { ?item p:P31 [ps:P31 wd:Q3241045; pq:P642 wd:Q84263196]. ?item rdfs:label ?label. FILTER(LANG(?label)="en") ?item wdt:P2572 ?hashtag. }
Images from Wikimedia Commons about COVID-19 pandemic and SARS-CoV-2 with a CC-BY license edit
The following query uses these:
- Items: SARS-CoV-2 (Q82069695) , COVID-19 pandemic (Q81068910) , COVID-19 (Q84263196) , Coronaviridae (Q1134583) , disease outbreak (Q3241045)
- Properties: image (P18) , instance of (P31) , of (P642)
Features: ImageGrid (Q24515278)
#defaultView:ImageGrid
SELECT DISTINCT ?item ?image
WHERE
{
{ VALUES ?item {wd:Q82069695 wd:Q81068910 wd:Q84263196 wd:Q1134583} }
UNION
{ ?item p:P31 [ ps:P31 wd:Q3241045 ; pq:P642 wd:Q84263196 ] . }
?item wdt:P18 ?image.
BIND(REPLACE(wikibase:decodeUri(CONCAT("File:", STRAFTER(STR(?image), "/wiki/Special:FilePath/"))), " ", "_") AS ?imageTitle)
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "Categories";
wikibase:endpoint "commons.wikimedia.org";
mwapi:titles ?imageTitle.
?categoryTitle wikibase:apiOutput mwapi:category.
}
FILTER(?categoryTitle = "Category:CC-Zero"
Images of face masks used during COVID-19 pandemic with a CC-BY license edit
The following query uses these:
- Properties: instance of (P31) , subclass of (P279) , on focus list of Wikimedia project (P5008) , image (P18)
Features: ImageGrid (Q24515278)
#defaultView:ImageGrid
SELECT DISTINCT * WHERE {
{?mask wdt:P31 wd:Q271779} UNION {?mask wdt:P279 wd:Q271779}.
?mask wdt:P5008 wd:Q87748614.
?mask rdfs:label ?label.
?mask wdt:P18 ?image.
FILTER(LANG(?label)="en")
BIND(REPLACE(wikibase:decodeUri(CONCAT("File:", STRAFTER(STR(?image), "/wiki/Special:FilePath/"))), " ", "_") AS ?imageTitle)
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "Categories";
wikibase:endpoint "commons.wikimedia.org";
mwapi:titles ?imageTitle.
?categoryTitle wikibase:apiOutput mwapi:category.
}
FILTER(?categoryTitle = "Category:CC-Zero"
People listed in Wikidata deceased due to COVID-19 edit
As tabular output, ranked by date of death edit
The following query uses these:
- Items: COVID-19 (Q84263196)
- Properties: cause of death (P509) , occupation (P106) , country of citizenship (P27) , date of death (P570)
# COVID19 victims SELECT ?dateOfDeath ?name (SAMPLE(?nationality) AS ?citizenship) (SAMPLE(?occupation) AS ?profession) { ?s wdt:P509 wd:Q84263196 . ?s rdfs:label ?name . FILTER(LANG(?name)="en") # occupation OPTIONAL { ?s wdt:P106 ?occupationRes . ?occupationRes rdfs:label ?occupation . FILTER(LANG(?occupation)="en") } # nationality OPTIONAL { ?s wdt:P27 ?nationalityRes . ?nationalityRes rdfs:label ?nationality . FILTER(LANG(?nationality)="en") } # date of death OPTIONAL { ?s wdt:P570 ?dateOfDeath . } } GROUP BY ?name ?dateOfDeath ORDER BY DESC(?dateOfDeath)
With open license portrait images ranked by how well-described they are in Wikidata edit
The following query uses these:
- Items: COVID-19 (Q84263196) , human (Q5)
- Properties: cause of death (P509) , instance of (P31) , date of death (P570) , date of birth (P569) , image (P18)
Features: ImageGrid (Q24515278)
#defaultView:ImageGrid
SELECT ?person ?date_of_death ?age ?image
WHERE {
?person wdt:P509 wd:Q84263196 ; wdt:P31 wd:Q5
OPTIONAL { ?person wdt:P570 ?date_of_death }
OPTIONAL { ?person wikibase:statements ?statements_count ; wikibase:sitelinks ?sitelinks_count ; wikibase:identifiers ?identifiers_count . BIND(?statements_count + ?sitelinks_count + ?identifiers_count AS ?rank)}
OPTIONAL { ?person wdt:P569 ?dob ; wdt:P570 ?dod . BIND(YEAR(?dod)-YEAR(?dob) as ?age) }
?person wdt:P18 ?image .
BIND(REPLACE(wikibase:decodeUri(CONCAT("File:", STRAFTER(STR(?image), "/wiki/Special:FilePath/"))), " ", "_") AS ?imageTitle)
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "Categories";
wikibase:endpoint "commons.wikimedia.org";
mwapi:titles ?imageTitle.
?categoryTitle wikibase:apiOutput mwapi:category.
}
FILTER(?categoryTitle = "Category:CC-Zero"
As bubble diagram of professions edit
The following query uses these:
- Items: COVID-19 (Q84263196) , human (Q5)
- Properties: cause of death (P509) , instance of (P31) , occupation (P106)
Features: BubbleChart (Q24515280)
#defaultView:BubbleChart
SELECT ?occupation ?occupationLabel (COUNT(*) as ?count) WHERE {
?person wdt:P509 wd:Q84263196 ; wdt:P31 wd:Q5 .
?person wdt:P106 ?occupation .
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } .
}
GROUP BY ?occupation ?occupationLabel
ORDER BY DESC(?count)
LIMIT 10000