query-619fd6ef8b924e0f146cc4c743c2ffd4

rq turtle/ttl

Alphabetical and numberical sortingI have this query:

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
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 ?hustota ?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 ) .
    SERVICE wikibase:label { bd:serviceParam wikibase:language "cs" }
}
ORDER BY ?itemLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v11("?date"):::projected v5("?dummy0") v13("?hustota"):::projected v2("?item"):::projected v1("?itemLabel"):::projected v3("?neco") v6("?normalizedSuperficie") v7("?normalizedUnit") v12("?normalizedarea"):::projected v8("?originalSuperficie") v9("?originalUnit") v4("?population"):::projected v10("?star") a5((" ")) a2((" ")) a1((" ")) a4((" ")) a3((" ")) c15(["wikibase:BestRank"]):::iri c20(["cs"]):::literal c5(["wd:Q213"]):::iri c18(["bd:serviceParam"]):::iri c3(["wd:Q75338598"]):::iri v2 --"p:P31"--> v3 v3 --"p:statement/P31"--> c3 v2 --"p:direct/P17"--> c5 v2 --"p:direct/P1082"--> v4 subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; v3 --"p:qualifier/P582"--> v5 end a1 --"wikibase:quantityAmount"--> v6 a1 --"wikibase:quantityUnit"--> v7 a2 --"p:statement/value-normalized/P2046"--> a1 v2 --"p:P2046"--> a2 a3 --"wikibase:quantityAmount"--> v8 a3 --"wikibase:quantityUnit"--> v9 a4 --"p:statement/value/P2046"--> a3 v2 --"p:P2046"--> a4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:P6".-> v10 v10 --"a"--> c15 v10 --"p:qualifier/P580"--> v11 subgraph minus1["MINUS"] style minus1 stroke-width:6px,fill:pink,stroke:red; v10 --"p:qualifier/P582"--> a5 end end bind2[/"?normalizedSuperficie / '1000000^^xsd:integer'"/] v6 --o bind2 bind2 --as--o v12 bind3[/"?population / ?normalizedarea"/] v4 --o bind3 v12 --o bind3 bind3 --as--o v13 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c18 --"wikibase:language"--> c20 end