Merge pull request #41 from lblod/fix/financing-percentage-sort

Make sure financing percentages are sorted as expected
This commit is contained in:
Boris De Vloed
2021-09-10 14:44:34 +02:00
committed by GitHub
2 changed files with 41 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ere: <http://data.lblod.info/vocabularies/erediensten/>
PREFIX ext: <http://mu.semte.ch/vocabularies/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).
}
}

View File

@@ -0,0 +1,19 @@
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ere: <http://data.lblod.info/vocabularies/erediensten/>
PREFIX ext: <http://mu.semte.ch/vocabularies/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.
}
}