diff --git a/config/migrations/20210909152600-fix-percentage-sort-part-1.sparql b/config/migrations/20210909152600-fix-percentage-sort-part-1.sparql new file mode 100644 index 0000000..348b6b8 --- /dev/null +++ b/config/migrations/20210909152600-fix-percentage-sort-part-1.sparql @@ -0,0 +1,22 @@ +PREFIX xsd: +PREFIX ere: +PREFIX ext: + +# Convert the xsd:float typed percentages to xsd:decimal. +# This is needed to work around a sorting issue that only happens with xsd:float. +# The migration file is split up in 2 parts since Virtuoso has issues with doing the conversion in a single migration file. + +DELETE { + GRAPH ?g { + ?s ere:financieringspercentage ?percentage. + } +} INSERT { + GRAPH ?g { + ?s ext:decimalPercentage ?decimalPercentage. + } +} WHERE { + GRAPH ?g { + ?s ere:financieringspercentage ?percentage. + BIND (ROUND(xsd:decimal(?percentage)*100)/100 AS ?decimalPercentage). + } +} \ No newline at end of file diff --git a/config/migrations/20210909152630-fix-percentage-sort-part-2.sparql b/config/migrations/20210909152630-fix-percentage-sort-part-2.sparql new file mode 100644 index 0000000..99b8fdf --- /dev/null +++ b/config/migrations/20210909152630-fix-percentage-sort-part-2.sparql @@ -0,0 +1,19 @@ +PREFIX xsd: +PREFIX ere: +PREFIX ext: + +# Part 2 of the percentage sort fix. + +DELETE { + GRAPH ?g { + ?s ext:decimalPercentage ?percentage. + } +} INSERT { + GRAPH ?g { + ?s ere:financieringspercentage ?percentage. + } +} WHERE { + GRAPH ?g { + ?s ext:decimalPercentage ?percentage. + } +} \ No newline at end of file