query-1e059b52b44b39572f6ff737c65c4497

rq turtle/ttl

Propertieslocated in the administrative territorial entity (P131)instance of (P31)population (P1082)point in time (P585)

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT DISTINCT ?municipality WHERE {
  #hint:Query hint:optimizer "None".
  ?municipality wdt:P131+ wd:Q980;
                wdt:P31 wd:Q262166;
                p:P1082 ?populationStatement.
  ?populationStatement pq:P585 ?pointInTime1, ?pointInTime2.
  FILTER(?pointInTime1 != ?pointInTime2)
  BIND(SUBSTR(STR(?municipality), STRLEN(STR(wd:)) + 1) AS ?qid).
}
ORDER BY xsd:integer(REPLACE(?qid,"Q",""))

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?municipality"):::projected v2("?pointInTime1") v3("?pointInTime2") v5("?populationStatement") v6("?qid") c6(["wd:Q262166"]):::iri c4(["wd:Q980"]):::iri f0[["?pointInTime1 != ?pointInTime2"]] f0 --> v2 f0 --> v3 v4 --"p:direct/P131"--> c4 v4 --"p:direct/P31"--> c6 v4 --"p:P1082"--> v5 v5 --"p:qualifier/P585"--> v2 v5 --"p:qualifier/P585"--> v3 bind1[/"substring(str(?municipality),string-length(str('wd:')) + '1^^xsd:integer')"/] v4 --o bind1 bind1 --as--o v6