query-9f541afe3a7c14457da992413b0e43ca

rq turtle/ttl

Map

Use at

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 ?image ?date ?geo ?type ?typeLabel WHERE {
  # find items of some type ...
  ?item wdt:P31 ?type.

  # ... where the type is a subclass of disaster, conflict or crime ...
  { ?type (wdt:P279*) wd:Q3839081. }
  UNION
  { ?type (wdt:P279*) wd:Q180684. }
  UNION
  { ?type (wdt:P279*) wd:Q83267. }

  # ... with a point in time or start date ...
  ?item (wdt:P585|wdt:P580) ?date.

  # ... not more than 1 day in the future (allowing for time zone differences) and not more than 90 days ago
  BIND(NOW() - ?date AS ?distance).
  FILTER(-1 <= ?distance && ?distance < 90).

  # Fetch the item's position, label and image
  ?item wdt:P625 ?geo.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  OPTIONAL { ?item wdt:P18 ?image. }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?date"):::projected v5("?distance") v5("?geo"):::projected v6("?image"):::projected v2("?item"):::projected v3("?type"):::projected c6(["wd:Q180684"]):::iri c12(["bd:serviceParam"]):::iri c7(["wd:Q83267"]):::iri c14(["#91;AUTO_LANGUAGE#93;,en"]):::literal c5(["wd:Q3839081"]):::iri f0[["'-1^^xsd:integer' <= ?distance?distance < '90^^xsd:integer'"]] f0 --> v5 v2 --"wdt:P31"--> v3 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P279"--> c7 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P279"--> c6 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P279"--> c5 end union0r <== or ==> union0l end subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P580"--> v4 end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P585"--> v4 end union2r <== or ==> union2l end bind1[/"NOW() - ?date"/] v4 --o bind1 bind1 --as--o v5 v2 --"wdt:P625"--> v5 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c12 --"wikibase:language"--> c14 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P18".-> v6 end