query-ed184edd1000f061b1553733d1aac975

rq turtle/ttl

Places in Berlin with located in the administrative territorial entity (P131) not pointing to a Ortsteil (Q253019)

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#>
SELECT ?s ?sLabel ?veLabel ?vetLabel WHERE {
    ?s wdt:P131+ wd:Q64 .  # everything located in Berlin (or a subdivision)
    ?s wdt:P131 ?ve .      # the subdivisions this is located in
    ?ve wdt:P131+ wd:Q64 . # filter out all non-Berlin subdivisions (for subjects in multiple states)
    ?ve wdt:P31 ?vet .     # type of the subdivision
    # filter everything located in an Ortsteil or Ortslage
    FILTER (?vet != wd:Q253019 && ?vet != wd:Q1669338) .
    # filter Orteile
    ?s wdt:P31 ?st .
    FILTER (?st != wd:Q253019) .
    SERVICE wikibase:label {
      bd:serviceParam wikibase:language "de" .
    }
} ORDER BY ?veLabel ?sLabel LIMIT 100

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?s"):::projected v2("?sLabel"):::projected v3("?st") v6("?ve") v1("?veLabel"):::projected v4("?vet") c9(["de"]):::literal c7(["bd:serviceParam"]):::iri c4(["wd:Q64"]):::iri f0[["?st != 'wd:Q253019'"]] f0 --> v3 f1[["?vet != 'wd:Q253019'?vet != 'wd:Q1669338'"]] f1 --> v4 v5 --"wdt:P131"--> c4 v5 --"wdt:P131"--> v6 v6 --"wdt:P131"--> c4 v6 --"wdt:P31"--> v4 v5 --"wdt:P31"--> v3 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end