diff --git a/config/migrations/2022/20220926150000-fix-status-gemeente-ocmw-voor-fusie.sparql b/config/migrations/2022/20220926150000-fix-status-gemeente-ocmw-voor-fusie.sparql new file mode 100644 index 0000000..9baadc1 --- /dev/null +++ b/config/migrations/2022/20220926150000-fix-status-gemeente-ocmw-voor-fusie.sparql @@ -0,0 +1,40 @@ +PREFIX regorg: + +INSERT { + GRAPH { + ?org + regorg:orgStatus . # Niet Actief + } +} WHERE { + VALUES ?org { + # Gemeente Lovendegem + # Gemeente Puurs + # Gemeente Knesselare + # Gemeente Nevele + # Gemeente Kruishoutem + # Gemeente Neerpelt + # Gemeente Deinze (voor fusie) + # Gemeente Overpelt + # Gemeente Meeuwen-Gruitrode + # Gemeente Sint-Amands + # Gemeente Zingem + # Gemeente Opglabbeek + # Gemeente Zomergem + # Gemeente Waarschoot + + # OCMW Zingem + # OCMW Deinze (voor fusie) + # OCMW Opglabbeek + # OCMW Nevele + # OCMW Waarschoot + # OCMW Meeuwen-Gruitrode + # OCMW Kruishoutem + # OCMW Puurs + # OCMW Zomergem + # OCMW Sint-Amands + # OCMW Overpelt + # OCMW Knesselare + # OCMW Lovendegem + # OCMW Neerpelt + } +} \ No newline at end of file diff --git a/config/migrations/2022/20220926150005-fix-status-district.sparql b/config/migrations/2022/20220926150005-fix-status-district.sparql new file mode 100644 index 0000000..873f25a --- /dev/null +++ b/config/migrations/2022/20220926150005-fix-status-district.sparql @@ -0,0 +1,20 @@ +PREFIX regorg: + +INSERT { + GRAPH { + ?org + regorg:orgStatus . # Actief + } +} WHERE { + VALUES ?org { + # District Ekeren + # District Deurne + # District Berendrecht-Zandvliet-Lillo + # District Berchem + # District Hoboken + # District Wilrijk + # District Antwerpen + # District Borgerhout + # District Merksem + } +} \ No newline at end of file diff --git a/config/migrations/2022/20220927150000-remove-language-tags.sparql b/config/migrations/2022/20220927150000-remove-language-tags.sparql new file mode 100644 index 0000000..0ff5cd4 --- /dev/null +++ b/config/migrations/2022/20220927150000-remove-language-tags.sparql @@ -0,0 +1,185 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX locn: +PREFIX adres: + +# When only a language typed address literal is available, replace it with a plain literal +# When both plain and language typed are available, remove the language typed literal +# Rationale: lang typed literals are inserted via the migrations. When both types are available +# this new value is the plain literal, the old language typed literal is not deleted by the application +# and thus should be deleted via this migration - without - copying the value to a plain literal. + +WITH +DELETE { + ?address locn:fullAddress ?literal_withLang +} +INSERT { + ?address locn:fullAddress ?literal_cleansed +} +WHERE { + ?address locn:fullAddress ?literal_withLang. + FILTER(lang(?literal_withLang) != "") + + FILTER NOT EXISTS { + ?address locn:fullAddress ?literal_withoutLang + FILTER(lang(?literal_withoutLang) = "") + } + + BIND(str(?literal_withLang) AS ?literal_cleansed) +} +; + +WITH +DELETE { + ?address locn:fullAddress ?literal_withLang +} +WHERE { + ?address locn:fullAddress ?literal_withLang. + FILTER(lang(?literal_withLang) != "") + + FILTER EXISTS { + ?address locn:fullAddress ?literal_withoutLang + FILTER(lang(?literal_withoutLang) = "") + } +} +; + +WITH +DELETE { + ?address locn:adminUnitL2 ?literal_withLang +} +INSERT { + ?address locn:adminUnitL2 ?literal_cleansed +} +WHERE { + ?address locn:adminUnitL2 ?literal_withLang. + FILTER(lang(?literal_withLang) != "") + + FILTER NOT EXISTS { + ?address locn:adminUnitL2 ?literal_withoutLang + FILTER(lang(?literal_withoutLang) = "") + } + + BIND(str(?literal_withLang) AS ?literal_cleansed) +} +; + +WITH +DELETE { + ?address locn:adminUnitL2 ?literal_withLang +} +WHERE { + ?address locn:adminUnitL2 ?literal_withLang. + FILTER(lang(?literal_withLang) != "") + + FILTER EXISTS { + ?address locn:adminUnitL2 ?literal_withoutLang + FILTER(lang(?literal_withoutLang) = "") + } +} +; + +WITH +DELETE { + ?address locn:thoroughfare ?literal_withLang +} +INSERT { + ?address locn:thoroughfare ?literal_cleansed +} +WHERE { + ?address locn:thoroughfare ?literal_withLang. + FILTER(lang(?literal_withLang) != "") + + FILTER NOT EXISTS { + ?address locn:thoroughfare ?literal_withoutLang + FILTER(lang(?literal_withoutLang) = "") + } + + BIND(str(?literal_withLang) AS ?literal_cleansed) +} +; + +WITH +DELETE { + ?address locn:thoroughfare ?literal_withLang +} +WHERE { + ?address locn:thoroughfare ?literal_withLang. + FILTER(lang(?literal_withLang) != "") + + FILTER EXISTS { + ?address locn:thoroughfare ?literal_withoutLang + FILTER(lang(?literal_withoutLang) = "") + } +} +; + +WITH +DELETE { + ?address adres:gemeentenaam ?literal_withLang +} +INSERT { + ?address adres:gemeentenaam ?literal_cleansed +} +WHERE { + ?address adres:gemeentenaam ?literal_withLang. + FILTER(lang(?literal_withLang) != "") + + FILTER NOT EXISTS { + ?address adres:gemeentenaam ?literal_withoutLang + FILTER(lang(?literal_withoutLang) = "") + } + + BIND(str(?literal_withLang) AS ?literal_cleansed) +} +; + +WITH +DELETE { + ?address adres:gemeentenaam ?literal_withLang +} +WHERE { + ?address adres:gemeentenaam ?literal_withLang. + FILTER(lang(?literal_withLang) != "") + + FILTER EXISTS { + ?address adres:gemeentenaam ?literal_withoutLang + FILTER(lang(?literal_withoutLang) = "") + } +} +; + +WITH +DELETE { + ?address adres:land ?literal_withLang +} +INSERT { + ?address adres:land ?literal_cleansed +} +WHERE { + ?address adres:land ?literal_withLang. + FILTER(lang(?literal_withLang) != "") + + FILTER NOT EXISTS { + ?address adres:land ?literal_withoutLang + FILTER(lang(?literal_withoutLang) = "") + } + + BIND(str(?literal_withLang) AS ?literal_cleansed) +} +; + +WITH +DELETE { + ?address adres:land ?literal_withLang +} +WHERE { + ?address adres:land ?literal_withLang. + FILTER(lang(?literal_withLang) != "") + + FILTER EXISTS { + ?address adres:land ?literal_withoutLang + FILTER(lang(?literal_withoutLang) = "") + } +} +; \ No newline at end of file diff --git a/config/migrations/2022/20220927160000-remove-country-from-full-address.sparql b/config/migrations/2022/20220927160000-remove-country-from-full-address.sparql new file mode 100644 index 0000000..10d9471 --- /dev/null +++ b/config/migrations/2022/20220927160000-remove-country-from-full-address.sparql @@ -0,0 +1,21 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX locn: +PREFIX adres: + +# In order to be consistent with the rest of the OP application. + +WITH +DELETE { + ?address locn:fullAddress ?fullAddressWithCountry +} +INSERT { + ?address locn:fullAddress ?fullAddressWithoutCountry +} +WHERE { + ?address locn:fullAddress ?fullAddressWithCountry + + FILTER(STRENDS(?fullAddressWithCountry, ", Belgiƫ")) + + BIND(STRBEFORE(?fullAddressWithCountry, ", Belgiƫ") AS ?fullAddressWithoutCountry) +} \ No newline at end of file