query-f58a8e3187b886aa2fab67124fc23d5a

rq turtle/ttl

Converting strings to numbers in SPARQLDoes anyone know how to use the Sparql REPLACE function (I can't find a complete documentation). What I want to do is: F21 - > 21.01 F21 - > 21 10:43, 4 February 2018 (UTC)) talk (Zolo . --Wikidata:WikiProject sum of all paintings/Catalog/L'Œuvre de Vincent van Gogh, catalogue raisonnéthe leading "F" is the same for all inputs The trailing letter can be anything from a to z, I think. My purpose is to enhance the sorting of within the query, and use the new variable to sort the results. For example:BINDWould it make sense to use

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 ?catnum WHERE { 
    ?item p:P528 [ pq:P972 wd:Q17280421 ; ps:P528 ?catcode].  
    BIND(REPLACE(?catcode, "[a-zA-Z]", "") AS ?catnum)
  } ORDER BY xsd:integer(?catnum)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?catcode"):::projected v4("?catnum"):::projected v3("?item"):::projected a1((" ")) c2(["wd:Q17280421"]):::iri a1 --"p:qualifier/P972"--> c2 a1 --"p:statement/P528"--> v2 v3 --"p:P528"--> a1 bind0[/"replace(?catcode,'#91;a-zA-Z#93;','')"/] v2 --o bind0 bind0 --as--o v4