query-e4c6de79fe9b42f760f09a99d05bf9df

rq turtle/ttl

d'une ville au NB

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#>
# Stations du NB < 10km d'une ville
#defaultView:Map
SELECT DISTINCT ?station ?coordonn_es_g_ographiques WHERE {
  {
    # City/town: Q7930989  Airport: Q1248784 Port: Q44782
    SELECT ?city WHERE { ?city (wdt:P31/wdt:P279*) wd:Q7930989. }
  }
  ?city wdt:P131* wd:Q1965. # In NB

  ?city wdt:P625 ?cityLoc # Cities location
  SERVICE wikibase:around {
    ?station wdt:P625 ?location .
    bd:serviceParam wikibase:center ?cityLoc .
    bd:serviceParam wikibase:radius "10" . # within 10 km radius
  } .
   # is close from a Wx station
  FILTER EXISTS { ?station wdt:P31/wdt:P279* wd:Q190107 } .

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  OPTIONAL { ?station wdt:P625 ?coordonn_es_g_ographiques. }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?city") v3("?cityLoc") v5("?coordonn_es_g_ographiques"):::projected v4("?location") v1("?station"):::projected a2((" ")) a1((" ")) c6(["wd:Q1965"]):::iri c4(["wd:Q7930989"]):::iri c3(["wd:Q190107"]):::iri c9(["bd:serviceParam"]):::iri c15(["#91;AUTO_LANGUAGE#93;,en"]):::literal c12(["10"]):::literal f0[[" "]] subgraph f0e0["Exists Clause"] e0v1 --"wdt:P31"--> e0a1 e0a1 --"wdt:P279"--> e0c3 e0v1("?station"):::projected e0a1((" ")):::projected e0c3(["wd:Q190107"]):::iri end f0--EXISTS--> f0e0 f0 --> v1 f0 --> c1 f0 --> a1 f0 --> c2 f0 --> c3 v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 v2 --"wdt:P31"--> a2 a2 --"wdt:P279"--> c4 v2 --"wdt:P131"--> c6 v2 --"wdt:P625"--> v3 subgraph s1["http://wikiba.se/ontology#around"] style s1 stroke-width:4px; v1 --"wdt:P625"--> v4 c9 --"wikibase:center"--> v3 c9 --"wikibase:radius"--> c12 end subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c9 --"wikibase:language"--> c15 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P625".-> v5 end