query-80d9aecbbf3c43461a3165b233bf412b
19:11, 10 December 2018 (UTC)) talk (Christoph Braun are included, please? Regards, (Q42744322)urban municipality in Germany . Could you change the query, so that all subclasses of (Q42744322)urban municipality in Germany which is a subclass of (Q22865)independent city of Germany are currently not included by the query, because they rely on (Q586)Bonn . Some cities like (Q42744322)urban municipality in Germany to exclude former filter not exists: Based on your query, I added Tagishsimon@
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
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#>
SELECT distinct ?item ?itemLabel ?urban_municipality_rankLabel ?start_date ?end_date WHERE {
?item p:P31/p:P279* ?statement .
?statement ps:P31 wd:Q42744322.
?statement wikibase:rank ?urban_municipality_rank .
optional {?statement pq:P580 ?start_date . }
optional {?statement pq:P582 ?end_date . }
filter not exists {?statement pq:P582 ?end_date . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} order by ?itemLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?end_date"):::projected
v4("?item"):::projected
v1("?itemLabel"):::projected
v6("?start_date"):::projected
v2("?statement")
v5("?urban_municipality_rank")
a1((" "))
c9(["bd:serviceParam"]):::iri
c5(["wd:Q42744322"]):::iri
c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"p:qualifier/P582"--> e0v2
e0v2("?end_date"):::projected
e0v1("?statement"):::projected
end
f0--EXISTS--> f0e0
f0 --> v2
f0 --> c1
f0 --> v3
v2 --"p:qualifier/P582"--> v3
v4 --"p:P31"--> a1
a1 --"p:P279"--> v2
v2 --"p:statement/P31"--> c5
v2 --"wikibase:rank"--> v5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:qualifier/P580".-> v6
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:qualifier/P582".-> v3
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end