query-9d177566627aeb669c995ae63d2257d1
TODO
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#>
#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". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?cases"):::projected
v8("?cases_")
v5("?casestmt")
v4("?dist"):::projected
v3("?item"):::projected
v9("?mc")
v10("?rgb"):::projected
v6("?shape"):::projected
v1("?time"):::projected
v2("?time_")
a2((" "))
a3((" "))
a4((" "))
a1((" "))
c10(["bd:serviceParam"]):::iri
c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c3(["wd:Q84055514"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0f0[["?time < ?time_"]]
e0f0 --> e0v1
e0f0 --> e0v2
e0v3 --"p:P1603"--> e0a1
e0a1 --"p:qualifier/P585"--> e0v2
e0v3("?item"):::projected
e0v1("?time"):::projected
e0v2("?time_"):::projected
e0a1((" ")):::projected
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> v2
f0 --> v3
f0 --> c1
f0 --> a1
f0 --> c2
f1[["?time < ?time_"]]
f1 --> v1
f1 --> v2
v3 --"p:P1603"--> a1
a1 --"p:qualifier/P585"--> v2
c3 --"p:direct/P527"--> a2
a2 --"p:direct/P527"--> v3
v3 --"p:direct/P276"--> v4
v3 --"p:P1603"--> v5
v4 --"p:direct/P3896"--> v6
v5 --"p:statement/P1603"--> v7
v5 --"p:qualifier/P585"--> v1
c3 --"p:direct/P527"--> a3
a3 --"p:direct/P527"--> a4
a4 --"p:direct/P1603"--> v8
bind3[/"max(?cases_)"/]
v8 --o bind3
bind3 --as--o v9
bind4[/"if(?cases > '9^^xsd:integer' * ?mc / '10^^xsd:integer','290205',if(?cases > '4^^xsd:integer' * ?mc / '5^^xsd:integer','66080f',if(?cases > '7^^xsd:integer' * ?mc / '10^^xsd:integer','a60c17',if(?cases > '3^^xsd:integer' * ?mc / '5^^xsd:integer','db0f1e',if(?cases > ?mc / '2^^xsd:integer','f02937',if(?cases > '2^^xsd:integer' * ?mc / '5^^xsd:integer','ed4e59',if(?cases > '3^^xsd:integer' * ?mc / '10^^xsd:integer','ed727a',if(?cases > ?mc / '5^^xsd:integer','f79ca2','f5cbce'))))))))"/]
v7 --o bind4
v9 --o bind4
bind4 --as--o v10
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end