Wikidata:WikiProject India/COVID-19 task force/Queries
WikiProject India COVID-19 task force |
There may be queries posted on behalf of Wikidata's WikiProject India that display maps attempting to show the entirety of India, and which in the process may indicate national borders that you do not accept. The maps that Wikidata's Query Service uses come from OpenStreetMap, and therefore the practices in use there with regard to international borders will necessarily be mirrored in Wikidata's Query Service. We do not endorse nor condemn any particular borders that are provided by OpenStreetMap, and Wikidata's WikiProject India does not have the capability nor the authority to adjust the borders. We thus request that, if you have any complaints about the maps that are being used in our queries, you get in touch with the people behind OpenStreetMap and air your concerns there. Thank you. |
Map of India showing confirmed cases at the state and union territory level |
---|
#created by Mahir256
#defaultView:Map{"hide":["?shape", "?rgb"]}
SELECT ?item ?itemLabel ?state ?stateLabel ?cases ?shape ?rgb ?time WHERE {
wd:Q84055514 wdt:P527 ?item.
?item wdt:P276 ?state ; p:P1603 ?casestmt.
?state wdt:P3896 ?shape.
?casestmt ps:P1603 ?cases ; pq:P585 ?time .
{ SELECT (MAX(?cases_) as ?mc) {
wd:Q84055514 wdt:P527/wdt:P1603 ?cases_
} }
FILTER NOT EXISTS { ?item p:P1603/pq:P585 ?time_. FILTER(?time < ?time_) }
BIND(IF(?cases > (9 * ?mc)/10,"290205",
IF(?cases > (4 * ?mc)/5,"66080f",
IF(?cases > (7 * ?mc)/10,"a60c17",
IF(?cases > (3 *?mc)/5,"db0f1e",
IF(?cases > ?mc/2,"f02937",
IF(?cases > (2 * ?mc)/5,"ed4e59",
IF(?cases > (3 * ?mc)/10,"ed727a",
IF(?cases > ?mc/5,"f79ca2",
"f5cbce")))))))) as ?rgb)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
|
Map of India showing confirmed cases at the district level |
---|
#created by Mahir256
#defaultView:Map{"hide":["?shape", "?rgb"]}
SELECT ?item ?itemLabel ?dist ?distLabel ?cases ?shape ?rgb ?time WHERE {
wd:Q84055514 wdt:P527/wdt:P527 ?item.
?item wdt:P276 ?dist ; p:P1603 ?casestmt.
?dist wdt:P3896 ?shape.
?casestmt ps:P1603 ?cases ; pq:P585 ?time .
{ SELECT (MAX(?cases_) as ?mc) {
wd:Q84055514 wdt:P527/wdt:P527/wdt:P1603 ?cases_
} }
FILTER NOT EXISTS { ?item p:P1603/pq:P585 ?time_. FILTER(?time < ?time_) }
BIND(IF(?cases > (9 * ?mc)/10,"290205",
IF(?cases > (4 * ?mc)/5,"66080f",
IF(?cases > (7 * ?mc)/10,"a60c17",
IF(?cases > (3 *?mc)/5,"db0f1e",
IF(?cases > ?mc/2,"f02937",
IF(?cases > (2 * ?mc)/5,"ed4e59",
IF(?cases > (3 * ?mc)/10,"ed727a",
IF(?cases > ?mc/5,"f79ca2",
"f5cbce")))))))) as ?rgb)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
|
Map of India showing confirmed deaths at the state and union territory level |
---|
#created by Mahir256
#defaultView:Map{"hide":["?shape", "?rgb"]}
SELECT ?item ?itemLabel ?state ?stateLabel ?cases ?shape ?rgb ?time WHERE {
wd:Q84055514 wdt:P527 ?item.
?item wdt:P276 ?state ; p:P1120 ?casestmt.
?state wdt:P3896 ?shape.
?casestmt ps:P1120 ?cases ; pq:P585 ?time .
{ SELECT (MAX(?cases_) as ?mc) {
wd:Q84055514 wdt:P527/wdt:P1120 ?cases_
} }
FILTER NOT EXISTS { ?item p:P1120/pq:P585 ?time_. FILTER(?time < ?time_) }
BIND(IF(?cases > (9 * ?mc)/10,"290205",
IF(?cases > (4 * ?mc)/5,"66080f",
IF(?cases > (7 * ?mc)/10,"a60c17",
IF(?cases > (3 *?mc)/5,"db0f1e",
IF(?cases > ?mc/2,"f02937",
IF(?cases > (2 * ?mc)/5,"ed4e59",
IF(?cases > (3 * ?mc)/10,"ed727a",
IF(?cases > ?mc/5,"f79ca2",
"f5cbce")))))))) as ?rgb)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
|
Map of India showing confirmed deaths at the district level |
---|
#created by Mahir256
#defaultView:Map{"hide":["?shape", "?rgb"]}
SELECT ?item ?itemLabel ?dist ?distLabel ?cases ?shape ?rgb ?time WHERE {
wd:Q84055514 wdt:P527/wdt:P527 ?item.
?item wdt:P276 ?dist ; p:P1120 ?casestmt.
?dist wdt:P3896 ?shape.
?casestmt ps:P1120 ?cases ; pq:P585 ?time .
{ SELECT (MAX(?cases_) as ?mc) {
wd:Q84055514 wdt:P527/wdt:P527/wdt:P1120 ?cases_
} }
FILTER NOT EXISTS { ?item p:P1120/pq:P585 ?time_. FILTER(?time < ?time_) }
BIND(IF(?cases > (9 * ?mc)/10,"290205",
IF(?cases > (4 * ?mc)/5,"66080f",
IF(?cases > (7 * ?mc)/10,"a60c17",
IF(?cases > (3 *?mc)/5,"db0f1e",
IF(?cases > ?mc/2,"f02937",
IF(?cases > (2 * ?mc)/5,"ed4e59",
IF(?cases > (3 * ?mc)/10,"ed727a",
IF(?cases > ?mc/5,"f79ca2",
"f5cbce")))))))) as ?rgb)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
|
Line graph of cases by state/UT |
---|
#created by Mahir256
#defaultView:LineChart
SELECT ?state ?time ?cases ?stateLabel {
wd:Q84055514 wdt:P527 ?statecases.
?statecases wdt:P276 ?state ; p:P1603 ?casestmt.
?casestmt ps:P1603 ?cases ; pq:P585 ?time.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
|
Line graph of cases by districts |
---|
#defaultView:LineChart
SELECT ?district ?time ?cases ?districtLabel {
wd:Q84055514 wdt:P527/wdt:P527 ?districtcases.
?districtcases wdt:P276 ?district ; p:P1603 ?casestmt.
?casestmt ps:P1603 ?cases ; pq:P585 ?time.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
|
Line graph of deaths by state/UT |
---|
#created by Mahir256
#defaultView:LineChart
SELECT ?state ?time ?cases ?stateLabel {
wd:Q84055514 wdt:P527 ?statecases.
?statecases wdt:P276 ?state ; p:P1120 ?casestmt.
?casestmt ps:P1120 ?cases ; pq:P585 ?time.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
|
Line graph of clinical tests by state/UT |
---|
#defaultView:LineChart
SELECT ?state ?time ?cases ?stateLabel {
wd:Q84055514 wdt:P527 ?statecases.
?statecases wdt:P276 ?state ; p:P8011 ?casestmt.
?casestmt ps:P8011 ?cases ; pq:P585 ?time.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
|
Line graph of new cases by state/UT |
---|
#created by Mahir256
#defaultView:LineChart
SELECT ?state ?time_new ?newcases ?stateLabel {
{ SELECT ?state ?time_new ?case_old ?case_new {
wd:Q84055514 wdt:P527 ?statecases.
?statecases wdt:P276 ?state ; p:P1603 ?casestmt1 ; p:P1603 ?casestmt2.
?casestmt1 ps:P1603 ?case_old ; pq:P585 ?time_old.
?casestmt2 ps:P1603 ?case_new ; pq:P585 ?time_new.
FILTER(?time_new - ?time_old = 1.0)
} ORDER BY ?state ?time_new }
BIND(?case_new - ?case_old as ?newcases)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
|
Line graph of new deaths by state/UT |
---|
#created by Mahir256
#defaultView:LineChart
SELECT ?state ?time_new ?newdeaths ?stateLabel {
{ SELECT ?state ?time_new ?case_old ?case_new {
wd:Q84055514 wdt:P527 ?statecases.
?statecases wdt:P276 ?state ; p:P1120 ?casestmt1 ; p:P1120 ?casestmt2.
?casestmt1 ps:P1120 ?case_old ; pq:P585 ?time_old.
?casestmt2 ps:P1120 ?case_new ; pq:P585 ?time_new.
FILTER(?time_new - ?time_old = 1.0)
} ORDER BY ?state ?time_new }
BIND(?case_new - ?case_old as ?newdeaths)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
|
Line graph of cases, deaths, recoveries, and tests for West Bengal |
---|
#defaultView:LineChart
#created by Mahir256
SELECT ?time ?number ?figure {
BIND(wd:Q87833915 as ?pandemic_item)
{ ?pandemic_item p:P1603 [ps:P1603 ?number ; pq:P585 ?time]. BIND("cases" as ?figure) }
UNION
{ ?pandemic_item p:P1120 [ps:P1120 ?number ; pq:P585 ?time]. BIND("deaths" as ?figure) }
UNION
{ ?pandemic_item p:P8010 [ps:P8010 ?number ; pq:P585 ?time]. BIND("recoveries" as ?figure) }
UNION
{ ?pandemic_item p:P8011 [ps:P8011 ?number ; pq:P585 ?time]. BIND("tests" as ?figure) }
}
|
Plot of total cases versus new cases for each state/union territory |
---|
#created by Mahir256, with help from CamelCaseNick
#defaultView:LineChart
select ?total (?totalCases - ?oldTotal as ?deltaCases) ?stateLabel {
{
wd:Q84055514 wdt:P527 ?statecases.
?statecases wdt:P276 ?state; p:P1603 ?a,?b.
?a ps:P1603 ?oldTotal; pq:P585 ?oldDate.
?b ps:P1603 ?totalCases; pq:P585 ?date.
filter(?date - ?oldDate = 1.0)
service wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} union {
{ select (max(?cases_) as ?mc) {
wd:Q84055514 wdt:P527/wdt:P1603 ?cases_
} }
[] wdt:P31 wd:Q21199 ; wdt:P1181 ?totalCases.
filter(?totalCases <= xsd:integer(?mc))
bind("(scale)" AS ?stateLabel)
bind(?totalCases as ?oldTotal)
}
bind(str(?totalCases) as ?t)
bind(concat(substr("0000", strlen(?t) + 1), ?t) as ?total)
}
|