query-d0795f1f3f931b60b6e50e3b183ad390

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 .
    FILTER( YEAR( ?time ) > 2007 ) .
    SERVICE wikibase:around {
      ?place wdt:P625 ?location .
      bd:serviceParam wikibase:center ?epicenter .
      bd:serviceParam wikibase:radius 50 .
    } .
  }
}.
  ?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") v8("?date2") v4("?epicenter"):::projected v3("?item"):::projected v9("?itemLabel"):::projected v6("?location") v5("?place"):::projected v7("?population"):::projected v11("?sample_place") v1("?time"):::projected v10("?total_population") a1((" ")) a2((" ")) c7(["bd:serviceParam"]):::iri c3(["wd:Q7944"]):::iri c16(["#91;AUTO_LANGUAGE#93;,en"]):::literal c10(["50^^xsd:integer"]):::literal f0[["?time >= ?date"]] f0 --> v1 f0 --> v2 f1[["year-from-dateTime(?time) > '2007^^xsd:integer'"]] f1 --> v1 v3 --"p:direct/P31"--> c3 v3 --"p:direct/P625"--> v4 v3 --"p:direct/P585"--> v1 subgraph s1["http://wikiba.se/ontology#around"] style s1 stroke-width:4px; v5 --"p:direct/P625"--> v6 c7 --"wikibase:center"--> v4 c7 --"wikibase:radius"--> c10 end a1 --"p:statement/P1082"--> v7 a1 --"p:qualifier/P585"--> v2 v5 --"p:P1082"--> a1 subgraph minus2["MINUS"] style minus2 stroke-width:6px,fill:pink,stroke:red; f3[["?time >= ?date2?date2 > ?date"]] f3 --> v1 f3 --> v8 f3 --> v2 v5 --"p:P1082"--> a2 a2 --"p:qualifier/P585"--> v8 end subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c7 --"wikibase:language"--> c16 v3 --"rdfs:label"--> v9 end bind6[/"sum(?population)"/] v7 --o bind6 bind6 --as--o v10 bind7[/"sample(?place)"/] v5 --o bind7 bind7 --as--o v11