query-dac3e117fff0515341f70421b0473ae5

rq turtle/ttl

Propertieslocated in the administrative territorial entity (P131)instance of (P31)coordinate location (P625)collection (P195)location (P276)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Table
SELECT DISTINCT ?cooncilLabel ?placeLabel ?pic ?picTitle
WHERE { { 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  ?cooncil wdt:P131 wd:Q22}  ?cooncil wdt:P31 wd:Q15060255. 
 { {?place wdt:P31 wd:Q207694 } UNION { ?place wdt:P31 wd:Q33506}  } { ?place wdt:P131 ?cooncil MINUS { ?place wdt:P131 wd:Q2379199.} }. 
       ?place wdt:P625 ?loc .
 { ?pic wdt:P195 ?place } UNION { ?pic wdt:P276 ?place } ?pic wdt:P31 wd:Q3305213 . 
       OPTIONAL { ?pic rdfs:label ?picLabel. FILTER(LANG(?picLabel) = "en"). }
       OPTIONAL { ?pic schema:description ?picDesc. FILTER(LANG(?picDesc) = "en"). }
       BIND(IF(BOUND(?picLabel),?picLabel,?picDesc) AS ?picTitle).
}
GROUP BY ?cooncilLabel ?placeLabel ?pic ?picTitle

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?cooncil") v5("?loc") v6("?pic"):::projected v1("?picDesc") v2("?picLabel") v7("?picTitle"):::projected v4("?place") c10(["wd:Q207694"]):::iri c11(["wd:Q33506"]):::iri c7(["wd:Q22"]):::iri c9(["wd:Q15060255"]):::iri c3(["bd:serviceParam"]):::iri c16(["wd:Q3305213"]):::iri c12(["wd:Q2379199"]):::iri c5(["#91;AUTO_LANGUAGE#93;,en"]):::literal subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c3 --"wikibase:language"--> c5 end v3 --"wdt:P131"--> c7 v3 --"wdt:P31"--> c9 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v4 --"wdt:P31"--> c11 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v4 --"wdt:P31"--> c10 end union0r <== or ==> union0l end v4 --"wdt:P131"--> v3 subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; v4 --"wdt:P131"--> c12 end v4 --"wdt:P625"--> v5 subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v6 --"wdt:P276"--> v4 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v6 --"wdt:P195"--> v4 end union1r <== or ==> union1l end v6 --"wdt:P31"--> c16 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v6 -."rdfs:label".-> v2 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v6 -."schema:description".-> v1 end bind1[/"if(bound(?picLabel),?picLabel,?picDesc)"/] v2 --o bind1 v1 --o bind1 bind1 --as--o v7