query-1065673035d0998945e7683eea4bfb2e

rq turtle/ttl

Conversion from format2 to format3 and format1 SELECT ?format1 ?format2 ?format3 { VALUES ?format2 { "091-002-2008-0003" "398-001-1100-0001" "529-102-0011-0001" "148-402-0027-0001" }

BIND (REPLACE(?format2, "(\d+)-(\d+)-(\d+)-(\d+)", "$1$2$3$4") AS ?format3)

BIND (REPLACE(?format2, "0{0,2}(\d+)-0{0,2}(\d+)-0{0,3}(\d+)-0{0,3}(\d+)", "$1-$2-$3-$4") AS ?format1) }

Use at

# Conversion from format2 to format3 and format1
SELECT ?format1 ?format2 ?format3
{
  VALUES ?format2 { "091-002-2008-0003" "398-001-1100-0001" "529-102-0011-0001" "148-402-0027-0001" }

  BIND (REPLACE(?format2, "(\\d+)-(\\d+)-(\\d+)-(\\d+)", "$1$2$3$4") AS ?format3)

  BIND (REPLACE(?format2, "0{0,2}(\\d+)-0{0,2}(\\d+)-0{0,3}(\\d+)-0{0,3}(\\d+)", "$1-$2-$3-$4") AS ?format1)
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?format1"):::projected v1("?format2"):::projected v2("?format3"):::projected bind0[/VALUES ?format2/] bind0-->v1 bind00(["091-002-2008-0003"]) bind00 --> bind0 bind01(["398-001-1100-0001"]) bind01 --> bind0 bind02(["529-102-0011-0001"]) bind02 --> bind0 bind03(["148-402-0027-0001"]) bind03 --> bind0 bind1[/"replace(?format2,'(\d+)-(\d+)-(\d+)-(\d+)','$1$2$3$4')"/] v1 --o bind1 bind1 --as--o v2 bind2[/"replace(?format2,'0{0,2}(\d+)-0{0,2}(\d+)-0{0,3}(\d+)-0{0,3}(\d+)','$1-$2-$3-$4')"/] v1 --o bind2 bind2 --as--o v3