query-c4f3766227b5ca48c35b27031d3ecada
For this to work, ideally ?cases and ?deaths would have a value of 1
"significant event" (P793) could store the actual dates
SELECT ?item ?itemLabel
?firstdeath ?deaths
?firstcase ?cases
(?firstdeath - ?firstcase as ?diff)
WHERE
{
# VALUES ?item { wd:Q83872271 }
?item wdt:P31 wd:Q3241045 .
?item wdt:P361 wd:Q81068910 .
?item p:P1120 [pq:P585 ?firstdeath ; ps:P1120 ?deaths ] .
FILTER ( ?deaths > 0 )
FILTER NOT EXISTS
{
?item p:P1120 [pq:P585 ?date_deaths2 ; ps:P1120 ?deaths2 ].
FILTER( ?firstdeath > ?date_deaths2 )
}
?item p:P1603 [pq:P585 ?firstcase ; ps:P1603 ?cases ] .
FILTER ( ?cases > 0 )
FILTER NOT EXISTS
{
?item p:P1603 [pq:P585 ?date_cases2 ; ps:P1603 ?cases2 ]
FILTER ( ?firstcase > ?date_cases2 )
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#For this to work, ideally ?cases and ?deaths would have a value of 1
#"significant event" (P793) could store the actual dates
#
SELECT ?item ?itemLabel
?firstdeath ?deaths
?firstcase ?cases
(?firstdeath - ?firstcase as ?diff)
WHERE
{
# VALUES ?item { wd:Q83872271 }
?item wdt:P31 wd:Q3241045 .
?item wdt:P361 wd:Q81068910 .
?item p:P1120 [pq:P585 ?firstdeath ; ps:P1120 ?deaths ] .
FILTER ( ?deaths > 0 )
FILTER NOT EXISTS
{
?item p:P1120 [pq:P585 ?date_deaths2 ; ps:P1120 ?deaths2 ].
FILTER( ?firstdeath > ?date_deaths2 )
}
?item p:P1603 [pq:P585 ?firstcase ; ps:P1603 ?cases ] .
FILTER ( ?cases > 0 )
FILTER NOT EXISTS
{
?item p:P1603 [pq:P585 ?date_cases2 ; ps:P1603 ?cases2 ]
FILTER ( ?firstcase > ?date_cases2 )
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}