diff --git a/config/migrations/2023/20231112161533-update-phone-numbers.sparql b/config/migrations/2023/20231112161533-update-phone-numbers.sparql new file mode 100644 index 0000000..61556c9 --- /dev/null +++ b/config/migrations/2023/20231112161533-update-phone-numbers.sparql @@ -0,0 +1,38 @@ +DELETE { + ?s ?o . +} +INSERT { + GRAPH { + ?s ?newPhoneNumber . + } +} +WHERE { + GRAPH { + ?s ?o . + } + + FILTER (SUBSTR(?o, 1, 1) != "+" AND STRLEN(STR(?o)) > 4) + BIND(REPLACE(STR(?o),"[. - /]","") AS ?removedSpaces) . + BIND (CONCAT('tel:+32', SUBSTR(?removedSpaces, 2)) as ?newPhoneNumber) +} + +DELETE { + ?s ?o . +} +INSERT { + GRAPH { + ?s ?newPhoneNumber . + } +} +WHERE { + GRAPH { + ?s ?o . + } + + FILTER (SUBSTR(?o, 1, 1) = "+") + BIND(REPLACE(STR(?o),"[. - /]","") AS ?removedSpaces) . + BIND (CONCAT('tel:', ?removedSpaces, 2) as ?newPhoneNumber) +} + + +