query-fa2899116a296ffdadf4a848fd67efe1
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
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/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?population ?normalizedarea (ROUND(?hustota*1000)/1000 AS ?hustota_rounded) ?date
WHERE
{
?item p:P31 ?neco .
?neco ps:P31 wd:Q75338598 .
?item wdt:P17 wd:Q213 .
?item wdt:P1082 ?population.
MINUS { ?neco pq:P582 ?dummy0 }
?item p:P2046 [ psn:P2046 [ wikibase:quantityAmount ?normalizedSuperficie; wikibase:quantityUnit ?normalizedUnit ] ] .
?item p:P2046 [ psv:P2046 [ wikibase:quantityAmount ?originalSuperficie; wikibase:quantityUnit ?originalUnit ] ] .
OPTIONAL {
?item p:P6 ?star .
?star a wikibase:BestRank .
?star pq:P580 ?date
MINUS { ?star pq:P582 [] } } .
BIND(?normalizedSuperficie/1000000 AS ?normalizedarea) .
BIND(?population / ?normalizedarea AS ?hustota ) .
?item rdfs:label ?itemlabel . FILTER(LANG(?itemlabel)='cs')
BIND(xsd:integer(REPLACE(?itemlabel,'\\D','')) AS ?numeric_part)
SERVICE wikibase:label { bd:serviceParam wikibase:language "cs" }
}
ORDER BY ?numeric_part
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v12("?date"):::projected
v6("?dummy0")
v14("?hustota"):::projected
v15("?hustota_rounded")
v3("?item"):::projected
v2("?itemlabel")
v4("?neco")
v7("?normalizedSuperficie")
v8("?normalizedUnit")
v13("?normalizedarea"):::projected
v15("?numeric_part")
v9("?originalSuperficie")
v10("?originalUnit")
v5("?population"):::projected
v11("?star")
a2((" "))
a1((" "))
a4((" "))
a3((" "))
a5((" "))
c16(["wikibase:BestRank"]):::iri
c1(["cs"]):::literal
c6(["wd:Q213"]):::iri
c20(["bd:serviceParam"]):::iri
c4(["wd:Q75338598"]):::iri
f0[["?itemlabel = 'cs'"]]
f0 --> v2
v3 --"p:P31"--> v4
v4 --"p:statement/P31"--> c4
v3 --"p:direct/P17"--> c6
v3 --"p:direct/P1082"--> v5
subgraph minus1["MINUS"]
style minus1 stroke-width:6px,fill:pink,stroke:red;
v4 --"p:qualifier/P582"--> v6
end
a1 --"wikibase:quantityAmount"--> v7
a1 --"wikibase:quantityUnit"--> v8
a2 --"p:statement/value-normalized/P2046"--> a1
v3 --"p:P2046"--> a2
a3 --"wikibase:quantityAmount"--> v9
a3 --"wikibase:quantityUnit"--> v10
a4 --"p:statement/value/P2046"--> a3
v3 --"p:P2046"--> a4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:P6".-> v11
v11 --"a"--> c16
v11 --"p:qualifier/P580"--> v12
subgraph minus2["MINUS"]
style minus2 stroke-width:6px,fill:pink,stroke:red;
v11 --"p:qualifier/P582"--> a5
end
end
bind3[/"?normalizedSuperficie / '1000000^^xsd:integer'"/]
v7 --o bind3
bind3 --as--o v13
bind4[/"?population / ?normalizedarea"/]
v5 --o bind4
v13 --o bind4
bind4 --as--o v14
v3 --"rdfs:label"--> v2
bind5[/"http://www.w3.org/2001/XMLSchema#integer(replace(?itemlabel,'\D',''))"/]
v2 --o bind5
bind5 --as--o v15
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c20 --"wikibase:language"--> c1
end
bind6[/"numeric-round(?hustota * '1000^^xsd:integer') / '1000^^xsd:integer'"/]
v14 --o bind6
bind6 --as--o v15