query-1ea2d7b065fcc1fe07c495986039da45
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?epicenter ?time (SUM(?population) AS ?total_population) (SAMPLE(?place) AS ?sample_place) (SAMPLE(?placeLabel) AS ?sample_placeLabel)
WHERE {
{
SELECT * {
?item wdt:P31 wd:Q7944;
wdt:P625 ?epicenter;
wdt:P585 ?time .
#?item wdt:P2527 ?moment FILTER( ?moment >= 7 ) .
FILTER( YEAR( NOW() ) - YEAR( ?time ) <= 200 ) .
SERVICE wikibase:around {
?place wdt:P625 ?location .
bd:serviceParam wikibase:center ?epicenter .
bd:serviceParam wikibase:radius 50 .
} .
}
}.
?place wdt:P1082 ?population .
MINUS { ?place wdt:P150 [] } .
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
?item rdfs:label ?itemLabel .
?place rdfs:label ?placeLabel .
} .
} GROUP BY ?item ?itemLabel ?epicenter ?time ORDER BY DESC(?total_population)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?epicenter"):::projected
v3("?item"):::projected
v8("?itemLabel"):::projected
v6("?location")
v5("?place"):::projected
v9("?placeLabel"):::projected
v7("?population"):::projected
v10("?sample_place")
v11("?sample_placeLabel")
v2("?time"):::projected
v10("?total_population")
a1((" "))
c7(["bd:serviceParam"]):::iri
c3(["wd:Q7944"]):::iri
c15(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c10(["50^^xsd:integer"]):::literal
f0[["year-from-dateTime(NOW()) - year-from-dateTime(?time) <= '200^^xsd:integer'"]]
f0 --> v2
v3 --"wdt:P31"--> c3
v3 --"wdt:P625"--> v4
v3 --"wdt:P585"--> v2
subgraph s1["http://wikiba.se/ontology#around"]
style s1 stroke-width:4px;
v5 --"wdt:P625"--> v6
c7 --"wikibase:center"--> v4
c7 --"wikibase:radius"--> c10
end
v5 --"wdt:P1082"--> v7
subgraph minus1["MINUS"]
style minus1 stroke-width:6px,fill:pink,stroke:red;
v5 --"wdt:P150"--> a1
end
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c7 --"wikibase:language"--> c15
v3 --"rdfs:label"--> v8
v5 --"rdfs:label"--> v9
end
bind5[/"sum(?population)"/]
v7 --o bind5
bind5 --as--o v10
bind6[/"sample(?place)"/]
v5 --o bind6
bind6 --as--o v10
bind7[/"sample(?placeLabel)"/]
v9 --o bind7
bind7 --as--o v11