query-36243c0cfb978fd77fc79f2ca3b13860
带图例+自定义表头
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 bd: <http://www.bigdata.com/rdf#>
#defaultView:Map
SELECT DISTINCT ?item ?itemLabel ?deathNumberText ?aircraftLabel ?geo ?date ?layer WHERE {
?item (wdt:P31/(wdt:P279*)) wd:Q744913.
OPTIONAL {
?item wdt:P121 ?aircraft;
wdt:P585 ?date;
wdt:P625 ?geo;
wdt:P1120 ?deathNumber.
}
#自定义表头内容
BIND( CONCAT("死亡人数:", STR(?deathNumber)) AS ?deathNumberText)
BIND (
IF(?deathNumber <=1, "<=1",
IF(?deathNumber <=5, "1,5",
IF(?deathNumber <=10, "5,10",
IF(?deathNumber <=50, "10,50",
IF(?deathNumber <=100, "50,100",
">=100")))))
AS ?layer)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],zh". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?aircraft")
v3("?date"):::projected
v5("?deathNumber")
v6("?deathNumberText"):::projected
v4("?geo"):::projected
v1("?item"):::projected
v7("?layer"):::projected
a1((" "))
c9(["bd:serviceParam"]):::iri
c11(["#91;AUTO_LANGUAGE#93;,zh"]):::literal
c3(["wd:Q744913"]):::iri
v1 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P121".-> v2
v1 --"wdt:P585"--> v3
v1 --"wdt:P625"--> v4
v1 --"wdt:P1120"--> v5
end
bind0[/"concat('死亡人数:',str(?deathNumber))"/]
v5 --o bind0
bind0 --as--o v6
bind1[/"if(?deathNumber <= '1^^xsd:integer','<=1',if(?deathNumber <= '5^^xsd:integer','1,5',if(?deathNumber <= '10^^xsd:integer','5,10',if(?deathNumber <= '50^^xsd:integer','10,50',if(?deathNumber <= '100^^xsd:integer','50,100','>=100')))))"/]
v5 --o bind1
bind1 --as--o v7
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end