query-99075a142a47749e2a2a582e9adf1167
TODO
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(year(?start_date)>2017) # FROM
filter(year(?start_date)<2019) # TO
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} order by ?start_date
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?end_date"):::projected
v2("?item"):::projected
v1("?start_date"):::projected
v3("?statement")
v4("?urban_municipality_rank")
a1((" "))
c6(["wd:Q42744322"]):::iri
c11(["bd:serviceParam"]):::iri
c13(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["year-from-dateTime(?start_date) < '2019^^xsd:integer'"]]
f0 --> v1
f1[["year-from-dateTime(?start_date) > '2017^^xsd:integer'"]]
f1 --> v1
v2 --"p:P31"--> a1
a1 --"p:P279"--> v3
v3 --"p:statement/P31"--> c6
v3 --"wikibase:rank"--> v4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P580".-> v1
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P582".-> v5
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
end