query-571bd16db65a17fc451c40fc094f0a1b

rq turtle/ttl

...as a Map and only from Schleswig-Holstein

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map
SELECT DISTINCT ?w ?wLabel ?geo
WHERE 
{
    {
    ?w wdt:P463 wd:Q105757481 .
    ?w wdt:P131+ ?bundesland . 
    ?bundesland  wdt:P31 wd:Q1221156 .
     OPTIONAL { ?w wdt:P625 ?geo }
  } UNION {
    ?p wdt:P31 wd:Q98270496 .
    ?p p:P1416 ?statement .
    ?statement ps:P1416 ?w .
    ?w wdt:P131+ ?bundesland . 
    ?bundesland  wdt:P31 wd:Q1221156 .
    OPTIONAL { ?w wdt:P625 ?geo }
    OPTIONAL { ?statement pq:P3831 ?affiliationType .}  
  }
  FILTER (?bundesland = wd:Q1194)
  BIND(IF(! Bound(?affiliationType), "Vereinsmitglied", ?affiliationTypeLabel) AS ?affiliationTypeLabel)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" . }
} ORDER BY ASC(?wLabel)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v7("?affiliationType") v8("?affiliationTypeLabel") v2("?bundesland") v4("?geo"):::projected v5("?p") v6("?statement") v3("?w"):::projected v1("?wLabel"):::projected c3(["wd:Q105757481"]):::iri c13(["bd:serviceParam"]):::iri c6(["wd:Q1221156"]):::iri c15(["de,en"]):::literal c8(["wd:Q98270496"]):::iri f0[["?bundesland = 'wd:Q1194'"]] f0 --> v2 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v5 --"p:direct/P31"--> c8 v5 --"p:P1416"--> v6 v6 --"p:statement/P1416"--> v3 v3 --"p:direct/P131"--> v2 v2 --"p:direct/P31"--> c6 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:direct/P625".-> v4 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v6 -."p:qualifier/P3831".-> v7 end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"p:direct/P463"--> c3 v3 --"p:direct/P131"--> v2 v2 --"p:direct/P31"--> c6 subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:direct/P625".-> v4 end end union0r <== or ==> union0l end bind1[/"if(not bound(?affiliationType),'Vereinsmitglied',?affiliationTypeLabel)"/] v7 --o bind1 v8 --o bind1 bind1 --as--o v8 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c13 --"wikibase:language"--> c15 end