query-0e8e2134bfa21792df1d5f9fceb192bb
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)
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
# 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)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?citizenship")
v1("?dateOfDeath"):::projected
v3("?name"):::projected
v2("?nationality"):::projected
v7("?nationalityRes")
v4("?occupation"):::projected
v6("?occupationRes")
v9("?profession")
v5("?s")
c3(["wd:Q84263196"]):::iri
f0[["?name = 'en'"]]
f0 --> v3
v5 --"wdt:P509"--> c3
v5 --"rdfs:label"--> v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P106".-> v6
v6 --"rdfs:label"--> v4
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P27".-> v7
v7 --"rdfs:label"--> v2
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P570".-> v1
end
bind3[/"sample(?nationality)"/]
v2 --o bind3
bind3 --as--o v8
bind4[/"sample(?occupation)"/]
v4 --o bind4
bind4 --as--o v9