query-5939d7c561df720871699369c2ba8b6c

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#>
#defaultView:Map
SELECT ?place ?placeLabel ?population ?location WHERE {
   {
  SELECT * {
    VALUES ?item {wd:Q38982786}. # Q38982786 is the Wikidata identifier for the 2017 Chiapas earthquake; change this value if you want to run the query for another earthquake
    ?item wdt:P625 ?epicenter.
    OPTIONAL {?item wdt:P585 ?time .}
    SERVICE wikibase:around {
      ?place wdt:P625 ?location .
      bd:serviceParam wikibase:center ?epicenter .
      bd:serviceParam wikibase:radius 150 .
    } .
  }
}.
  ?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" .
    ?place rdfs:label ?placeLabel .
  } .
} GROUP BY ?place ?placeLabel ?population ?location

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?date") v8("?date2") v4("?epicenter") v3("?item") v6("?location"):::projected v5("?place"):::projected v9("?placeLabel"):::projected v7("?population"):::projected v1("?time") a1((" ")) a2((" ")) c7(["150^^xsd:integer"]):::literal c4(["bd:serviceParam"]):::iri c13(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["?time >= ?date"]] f0 --> v1 f0 --> v2 bind1[/VALUES ?item/] bind1-->v3 bind10(["wd:Q38982786"]) bind10 --> bind1 v3 --"p:direct/P625"--> v4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:direct/P585".-> v1 end subgraph s1["http://wikiba.se/ontology#around"] style s1 stroke-width:4px; v5 --"p:direct/P625"--> v6 c4 --"wikibase:center"--> v4 c4 --"wikibase:radius"--> c7 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; c4 --"wikibase:language"--> c13 v5 --"rdfs:label"--> v9 end