query-1b86f6e0df69a0361a3ae5322b1a3a20
Largest EU citiesThis query:
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX psn: <http://www.wikidata.org/prop/statement/value-normalized/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT DISTINCT ?item ?pocetobyvatel ?pocetobyvatel_upr ?rozloha (ROUND(?rozloha/1000000) AS ?rozloha_upr) ?date WHERE {
{
SELECT DISTINCT ?item WHERE {
?item wdt:P31/wdt:P279* wd:Q515 . } #city, dute to disuniformity expensive P31/wdt:P279* is needed
}. #optimization
?item wdt:P17 ?zeme .
?zeme wdt:P463 wd:Q458 . #EU member
MINUS { ?zeme p:P463 ?P363node .
?P363node ps:P463 wd:Q458 .
?P363node pq:P582 ?end .} #minus former EU member
?item wdt:P1082 ?pocetobyvatel .
?item p:P1082 ?pobSt .
?pobSt a wikibase:BestRank . #population with best rank
OPTIONAL { ?pobSt pq:P585 ?date }
?item p:P2046/psn:P2046/wikibase:quantityAmount ?rozloha . #normalized area
?item p:P2046 ?ArSt .
?ArSt rdf:type wikibase:BestRank #area with best rank (hope so), not sure how to select best rank before unit normalization
bind(concat("",str(?pocetobyvatel),"") as ?pocetobyvatel_upr)
}
order by desc(?pocetobyvatel) desc(?rozloha)
LIMIT 100
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v9("?ArSt")
v5("?P363node")
v8("?date"):::projected
v6("?end")
v3("?item"):::projected
v7("?pobSt")
v1("?pocetobyvatel"):::projected
v10("?pocetobyvatel_upr"):::projected
v2("?rozloha"):::projected
v11("?rozloha_upr")
v4("?zeme")
a1((" "))
a2((" "))
a3((" "))
c13(["wikibase:BestRank"]):::iri
c3(["wd:Q515"]):::iri
c6(["wd:Q458"]):::iri
v3 --"p:direct/P31"--> a1
a1 --"p:direct/P279"--> c3
v3 --"p:direct/P17"--> v4
v4 --"p:direct/P463"--> c6
subgraph minus0["MINUS"]
style minus0 stroke-width:6px,fill:pink,stroke:red;
v4 --"p:P463"--> v5
v5 --"p:statement/P463"--> c6
v5 --"p:qualifier/P582"--> v6
end
v3 --"p:direct/P1082"--> v1
v3 --"p:P1082"--> v7
v7 --"a"--> c13
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v7 -."p:qualifier/P585".-> v8
end
v3 --"p:P2046"--> a2
a2 --"p:statement/value-normalized/P2046"--> a3
a3 --"wikibase:quantityAmount"--> v2
v3 --"p:P2046"--> v9
v9 --"a"--> c13
bind1[/"concat('',str(?pocetobyvatel),'')"/]
v1 --o bind1
bind1 --as--o v10
bind2[/"numeric-round(?rozloha / '1000000^^xsd:integer')"/]
v2 --o bind2
bind2 --as--o v11