query-efc31eda93f4e2b536edb7deb67b9a80

rq turtle/ttl

Fires and other disasters in Glasgow area

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 psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map
SELECT DISTINCT (?distypeLabel AS ?layer) ?loc  ?subj ?subjLabel ?dead ?distyp
WHERE
{
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 
    VALUES ?discat {
      wd:Q7625093
      wd:Q168983
      wd:Q179057
      wd:Q68800046
      wd:Q1362483
      wd:Q2165983
      wd:Q1309431
      wd:Q744913
      wd:Q9687
      wd:Q1078765
    }
    {?subj wdt:P1120 ?dead.} UNION {?subj wdt:P793 ?discat}.
    OPTIONAL {?subj wdt:P1120 ?dead}.
    ?subj    wdt:P625 ?loc;
            p:P625/psv:P625 ?coord.
    ?coord wikibase:geoLatitude ?lat .
    ?coord wikibase:geoLongitude ?long .
    FILTER (?lat > 55.6) FILTER (?lat < 55.9)
    FILTER (?long > -4.5) FILTER (?long < -4.11)
    OPTIONAL {?subj wdt:P793 ?specific. ?specific rdfs:label ?specificLabel filter (lang(?specificLabel) = "en"). BIND(IF(?specific = ?discat, ?specificLabel,?NULL) AS ?specificLabel).}.
    ?subj wdt:P31 ?nonspec. ?nonspec rdfs:label ?nonspecLabel filter (lang(?nonspecLabel) = "en").
    BIND(IF(?nonspec = ?discat, ?nonspecLabel,?NULL) AS ?nonspecLabel).
    BIND(IF(BOUND(?specificLabel), ?specificLabel, ?nonspecLabel) AS ?distypeLabel).
  }

Query found at