diff --git a/config/migrations/2022/202206131O4623-normalize-space.sparql b/config/migrations/2022/202206131O4623-normalize-space.sparql new file mode 100644 index 0000000..ca1b34d --- /dev/null +++ b/config/migrations/2022/202206131O4623-normalize-space.sparql @@ -0,0 +1,20 @@ +DELETE { + graph { + ?s ?p ?o. + } + +} +INSERT { + graph { + ?s ?p ?normalize. + } +} +WHERE { + graph { + ?s ?p ?o. + BIND(replace(?o, "\\s+|\\t", " ") AS ?single_space) + BIND(replace(?single_space, "^(\\s+)|(\\s+)$|(\\t)$|(\\t)", "") AS ?normalize) + + FILTER ( isLiteral(?o) && ( regex(?o, "\\s+|\\t") || regex(?o, "^(\\s+)|(\\s+)$|(\\t)$|(\\t)") ) ) + } +} \ No newline at end of file