query-1f1b0c47dfbb1ae8f158ac651a31a76d

rq turtle/ttl

10:59, 4 February 2018 (UTC)) talk (Prtksxna Sorry if I misunderstood the question. Almost, but there is still something that is not quite right: if two items have catalogue code F21 and F21b, we should make sure that F21 b comes after F21, which this query does not do. Actually I have just found a way to do it, but it looks awful:Query 11:42, 4 February 2018 (UTC)) talk (ZoloSo maybe there is a cleaner way to convert all those letters into numbers ?--Great ! This way, this way it uses a secondary sortkey with the intended result: 12:09, 4 February 2018 (UTC) Jura--- Maybe using ORDER BY ?catnum ?optionalcatletter 12:05, 4 February 2018 (UTC)) talk (Edgars2007 function, but after a quick googling it doesn't seem to be available for SPARQL. --charOne "solution" would be adding natural sorting in Listeria bot code. Other solution would be some kind of

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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/>
SELECT ?item ?catcode WHERE { 
    ?item p:P528 [ pq:P972 wd:Q17280421 ; ps:P528 ?catcode].  
    BIND( xsd:integer(REPLACE(?catcode, "[a-zA-Z]", "")) AS ?catnum)
    BIND(REPLACE(?catcode, "F[0-9]*", "") AS ?catletter)
  }
ORDER BY ?catnum ?catletter

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?catcode"):::projected v5("?catletter") v5("?catnum") v4("?item"):::projected a1((" ")) c2(["wd:Q17280421"]):::iri a1 --"p:qualifier/P972"--> c2 a1 --"p:statement/P528"--> v3 v4 --"p:P528"--> a1 bind0[/"http://www.w3.org/2001/XMLSchema#integer(replace(?catcode,'#91;a-zA-Z#93;',''))"/] v3 --o bind0 bind0 --as--o v5 bind1[/"replace(?catcode,'F#91;0-9#93;*','')"/] v3 --o bind1 bind1 --as--o v5