query-6ea94565ab06eb2c93d329cdbc777e50

rq turtle/ttl

TODO

Use at

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 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#>
SELECT ?item ?itemLabel ?epicenter ?time (SUM(?population) AS ?total_population) (SAMPLE(?place) AS ?sample_place) WHERE {
   {
  SELECT * {
    ?item wdt:P31 wd:Q7944;
          wdt:P625 ?epicenter;
          wdt:P585 ?time;
          wdt:P2527 ?moment .
    FILTER( ?moment >= 6 ) .
    SERVICE wikibase:around {
      ?place wdt:P625 ?location .
      bd:serviceParam wikibase:center ?epicenter .
      bd:serviceParam wikibase:radius 100 .
    } .
  }
}.
  ?place p:P1082 [ ps:P1082 ?population; pq:P585 ?date ] .
  FILTER( ?time >= ?date ) .
  MINUS {
    ?place p:P1082/pq:P585 ?date2 .
    FILTER( ?time >= ?date2 && ?date2 > ?date ) .
  } .
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
    ?item rdfs:label ?itemLabel .
  } .
} GROUP BY ?item ?itemLabel ?epicenter ?time

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?date") v9("?date2") v5("?epicenter"):::projected v4("?item"):::projected v10("?itemLabel"):::projected v7("?location") v3("?moment") v6("?place"):::projected v8("?population"):::projected v12("?sample_place") v1("?time"):::projected v11("?total_population") a1((" ")) a2((" ")) c11(["100^^xsd:integer"]):::literal c8(["bd:serviceParam"]):::iri c3(["wd:Q7944"]):::iri c17(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["?time >= ?date"]] f0 --> v1 f0 --> v2 f1[["?moment >= '6^^xsd:integer'"]] f1 --> v3 v4 --"p:direct/P31"--> c3 v4 --"p:direct/P625"--> v5 v4 --"p:direct/P585"--> v1 v4 --"p:direct/P2527"--> v3 subgraph s1["http://wikiba.se/ontology#around"] style s1 stroke-width:4px; v6 --"p:direct/P625"--> v7 c8 --"wikibase:center"--> v5 c8 --"wikibase:radius"--> c11 end a1 --"p:statement/P1082"--> v8 a1 --"p:qualifier/P585"--> v2 v6 --"p:P1082"--> a1 subgraph minus2["MINUS"] style minus2 stroke-width:6px,fill:pink,stroke:red; f3[["?time >= ?date2?date2 > ?date"]] f3 --> v1 f3 --> v9 f3 --> v2 v6 --"p:P1082"--> a2 a2 --"p:qualifier/P585"--> v9 end subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c8 --"wikibase:language"--> c17 v4 --"rdfs:label"--> v10 end bind6[/"sum(?population)"/] v8 --o bind6 bind6 --as--o v11 bind7[/"sample(?place)"/] v6 --o bind7 bind7 --as--o v12