From b1cc9c7329b6c824fa8b8373faef1c0e769a18ec Mon Sep 17 00:00:00 2001 From: mirdono Date: Thu, 17 Oct 2024 12:51:50 +0200 Subject: [PATCH] fix: correct governing body start dates for new legislature Originally the starting dates for the new governing bodies for the new legislature was set to `2025-01-01` for all relevant municipalities, OCMWs, districts, and provinces. These migrations change that to more correct starting dates: * For organisations that are **not** involved in mergers the new starting data is `2024-12-02`, the first day installation meetings are allowed[1]. * For organisations that are involved in mergers the new starting date is `2025-01-01`, the first work day of the new year on which the mergers take effect. Note: this migration assumes there are no other start dates on `2025-01-01`, so the migrations have to be run in the specified order. [1] https://www.vlaanderen.be/lokaal-bestuur/organisatie-en-werking/gemeenteraad/installatie --- ...-district-governing-body-start-date.sparql | 28 +++++++++++ ...ipalities-governing-body-start-date.sparql | 46 +++++++++++++++++++ ...628-ocmws-governing-body-start-date.sparql | 45 ++++++++++++++++++ ...provinces-governing-body-start-date.sparql | 26 +++++++++++ ...nizations-governing-body-start-date.sparql | 23 ++++++++++ 5 files changed, 168 insertions(+) create mode 100644 config/migrations/2024/20241017102700-fix-governing-bodies-start-date/20241017102700-district-governing-body-start-date.sparql create mode 100644 config/migrations/2024/20241017102700-fix-governing-bodies-start-date/20241017112316-municipalities-governing-body-start-date.sparql create mode 100644 config/migrations/2024/20241017102700-fix-governing-bodies-start-date/20241017114628-ocmws-governing-body-start-date.sparql create mode 100644 config/migrations/2024/20241017102700-fix-governing-bodies-start-date/20241017120456-provinces-governing-body-start-date.sparql create mode 100644 config/migrations/2024/20241017102700-fix-governing-bodies-start-date/20241017121145-merged-organizations-governing-body-start-date.sparql diff --git a/config/migrations/2024/20241017102700-fix-governing-bodies-start-date/20241017102700-district-governing-body-start-date.sparql b/config/migrations/2024/20241017102700-fix-governing-bodies-start-date/20241017102700-district-governing-body-start-date.sparql new file mode 100644 index 0000000..af71824 --- /dev/null +++ b/config/migrations/2024/20241017102700-fix-governing-bodies-start-date/20241017102700-district-governing-body-start-date.sparql @@ -0,0 +1,28 @@ +PREFIX mandaat: +PREFIX org: +PREFIX besluit: +PREFIX generiek: + +DELETE { + GRAPH { + ?timedGoverningBody mandaat:bindingStart "2025-01-01T00:00:00"^^xsd:dateTime . + } +} INSERT { + GRAPH { + ?timedGoverningBody mandaat:bindingStart "2024-12-02T00:00:00"^^xsd:dateTime . + } +} WHERE { + GRAPH { + ?organization org:classification . # District + + # Filter new district Borsbeek which is the result of municipality Borsbeek + # merging into Antwerp + FILTER (?organization != ) + + ?governingBody besluit:bestuurt ?organization . + + ?timedGoverningBody a besluit:Bestuursorgaan ; + generiek:isTijdspecialisatieVan ?governingBody ; + mandaat:bindingStart "2025-01-01T00:00:00"^^xsd:dateTime . + } +} diff --git a/config/migrations/2024/20241017102700-fix-governing-bodies-start-date/20241017112316-municipalities-governing-body-start-date.sparql b/config/migrations/2024/20241017102700-fix-governing-bodies-start-date/20241017112316-municipalities-governing-body-start-date.sparql new file mode 100644 index 0000000..667d93b --- /dev/null +++ b/config/migrations/2024/20241017102700-fix-governing-bodies-start-date/20241017112316-municipalities-governing-body-start-date.sparql @@ -0,0 +1,46 @@ +PREFIX mandaat: +PREFIX org: +PREFIX besluit: +PREFIX generiek: + +DELETE { + GRAPH { + ?timedGoverningBody mandaat:bindingStart "2025-01-01T00:00:00"^^xsd:dateTime . + } +} INSERT { + GRAPH { + ?timedGoverningBody mandaat:bindingStart "2024-12-02T00:00:00"^^xsd:dateTime . + } +} WHERE { + GRAPH { + ?organization org:classification . # Municipality + + # Filter new municipalities that will the result of a merger + FILTER (?organization NOT IN + ( + # Merged municipalities with new URIs + , # Beveren-Kruibeke-Zwijndrecht + , # Merelbeke-Melle + , # Nazareth-De Pinte + , # Pajottegem + # Merged municipalities that keep URI + , # Antwerpen + , # Bilzen + , # Ham + , # Hasselt + , # Lochristi + , # Lokeren + , # Tielt + , # Tongeren + # Wingene + ) + ) + } + GRAPH { + ?governingBody besluit:bestuurt ?organization . + + ?timedGoverningBody a besluit:Bestuursorgaan ; + generiek:isTijdspecialisatieVan ?governingBody ; + mandaat:bindingStart "2025-01-01T00:00:00"^^xsd:dateTime . + } +} diff --git a/config/migrations/2024/20241017102700-fix-governing-bodies-start-date/20241017114628-ocmws-governing-body-start-date.sparql b/config/migrations/2024/20241017102700-fix-governing-bodies-start-date/20241017114628-ocmws-governing-body-start-date.sparql new file mode 100644 index 0000000..6c158b7 --- /dev/null +++ b/config/migrations/2024/20241017102700-fix-governing-bodies-start-date/20241017114628-ocmws-governing-body-start-date.sparql @@ -0,0 +1,45 @@ +PREFIX mandaat: +PREFIX org: +PREFIX besluit: +PREFIX generiek: + +DELETE { + GRAPH { + ?timedGoverningBody mandaat:bindingStart "2025-01-01T00:00:00"^^xsd:dateTime . + } +} INSERT { + GRAPH { + ?timedGoverningBody mandaat:bindingStart "2024-12-02T00:00:00"^^xsd:dateTime . + } +} WHERE { + GRAPH { + ?organization org:classification . # OCMW + + # Filter new OCMWs that will the result of a merger + FILTER (?organization NOT IN + ( + # Merged OCMWs with new URIs + , # Beveren-Kruibeke-Zwijndrecht + , # Merelbeke-Melle + , # Nazareth-De Pinte + , # Pajottegem + # Merged OCMWs that keep URI + , # Antwerpen + , # Bilzen + , # Ham + , # Hasselt + , # Lochristi + , # Lokeren + , # Tielt + , # Tongeren + # Wingene + ) + ) + + ?governingBody besluit:bestuurt ?organization . + + ?timedGoverningBody a besluit:Bestuursorgaan ; + generiek:isTijdspecialisatieVan ?governingBody ; + mandaat:bindingStart "2025-01-01T00:00:00"^^xsd:dateTime . + } +} diff --git a/config/migrations/2024/20241017102700-fix-governing-bodies-start-date/20241017120456-provinces-governing-body-start-date.sparql b/config/migrations/2024/20241017102700-fix-governing-bodies-start-date/20241017120456-provinces-governing-body-start-date.sparql new file mode 100644 index 0000000..3608be1 --- /dev/null +++ b/config/migrations/2024/20241017102700-fix-governing-bodies-start-date/20241017120456-provinces-governing-body-start-date.sparql @@ -0,0 +1,26 @@ +PREFIX mandaat: +PREFIX org: +PREFIX besluit: +PREFIX generiek: + +DELETE { + GRAPH { + ?timedGoverningBody mandaat:bindingStart "2025-01-01T00:00:00"^^xsd:dateTime . + } +} INSERT { + GRAPH { + ?timedGoverningBody mandaat:bindingStart "2024-12-02T00:00:00"^^xsd:dateTime . + } +} WHERE { + GRAPH { + ?organization org:classification . # Province + } + + GRAPH { + ?governingBody besluit:bestuurt ?organization . + + ?timedGoverningBody a besluit:Bestuursorgaan ; + generiek:isTijdspecialisatieVan ?governingBody ; + mandaat:bindingStart "2025-01-01T00:00:00"^^xsd:dateTime . + } +} diff --git a/config/migrations/2024/20241017102700-fix-governing-bodies-start-date/20241017121145-merged-organizations-governing-body-start-date.sparql b/config/migrations/2024/20241017102700-fix-governing-bodies-start-date/20241017121145-merged-organizations-governing-body-start-date.sparql new file mode 100644 index 0000000..f1cd13d --- /dev/null +++ b/config/migrations/2024/20241017102700-fix-governing-bodies-start-date/20241017121145-merged-organizations-governing-body-start-date.sparql @@ -0,0 +1,23 @@ +PREFIX mandaat: +PREFIX org: +PREFIX besluit: +PREFIX generiek: + +# Set the start date for governing bodies for organisations that are the result +# of a merger to 02 January 2025 which is the first working day of the year. +# Note: this migration assumes that all other `2025-01-01` starting dates have +# already been replaced by previous migrations. So order matters here! +DELETE { + GRAPH { + ?timedGoverningBody mandaat:bindingStart "2025-01-01T00:00:00"^^xsd:dateTime . + } +} INSERT { + GRAPH { + ?timedGoverningBody mandaat:bindingStart "2025-01-02T00:00:00"^^xsd:dateTime . + } +} WHERE { + GRAPH { + ?timedGoverningBody a besluit:Bestuursorgaan ; + mandaat:bindingStart "2025-01-01T00:00:00"^^xsd:dateTime . + } +}