query-dfa53e7420f3cc5fe03db747843bd0f3

rq turtle/ttl

Propertiescoordinate location (P625)instance of (P31)located in the administrative territorial entity (P131)country (P17)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?place ?dist ?placeLabel ?placeDescription ?istEinLabel ?liegtInLabel
WHERE
{
  # Nearby, mit Geokoordinaten aber ohne "ist ein", Staat oder "liegt in"
  wd:Q494631 wdt:P625 ?loc . # Objekt mit Geokoordinaten
  #BIND ( "Point(-79.71 15.8)"^^geo:wktLiteral AS ?loc ) . # Beliebige Position. Erst Ost/West. keine Blanks vor oder nach den Koordinaten!
  SERVICE wikibase:around {
      ?place wdt:P625 ?location .
      bd:serviceParam wikibase:center ?loc .
      bd:serviceParam wikibase:radius "10" .
  }
  OPTIONAL { ?place wdt:P31 ?istEin }
  OPTIONAL { ?place wdt:P131 ?liegtIn }
  OPTIONAL { ?place wdt:P17 ?staat }
  FILTER ( ! (BOUND(?istEin ) && BOUND(?staat ) && BOUND(?liegtIn )) ) # nur wenn kein P31 oder P17 oder P131 angegeben
  FILTER ( ?istEin != wd:Q26703203 && ?istEin != wd:Q29023906) # keine Stolpersteine und keine Sonderausstellungen
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de" }
  BIND(geof:distance(?loc, ?location) as ?dist)
} ORDER BY ?dist
LIMIT 50

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?dist"):::projected v2("?istEin") v4("?liegtIn") v5("?loc") v7("?location") v6("?place"):::projected v3("?staat") c15(["de"]):::literal c6(["bd:serviceParam"]):::iri c3(["wd:Q494631"]):::iri c9(["10"]):::literal f0[["?istEin != 'wd:Q26703203'?istEin != 'wd:Q29023906'"]] f0 --> v2 f1[["not bound(?istEin)bound(?staat)bound(?liegtIn)"]] f1 --> v2 f1 --> v3 f1 --> v4 c3 --"wdt:P625"--> v5 subgraph s1["http://wikiba.se/ontology#around"] style s1 stroke-width:4px; v6 --"wdt:P625"--> v7 c6 --"wikibase:center"--> v5 c6 --"wikibase:radius"--> c9 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v6 -."wdt:P31".-> v2 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v6 -."wdt:P131".-> v4 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v6 -."wdt:P17".-> v3 end subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c6 --"wikibase:language"--> c15 end bind2[/"http://www.opengis.net/def/function/geosparql/distance(?loc,?location)"/] v5 --o bind2 v7 --o bind2 bind2 --as--o v8