From 8c1538d45ed14fcbfb3dc5033c93c18ed11930e7 Mon Sep 17 00:00:00 2001 From: mirdono Date: Thu, 29 Aug 2024 16:07:04 +0200 Subject: [PATCH] feat: add migrations for governing bodies 2025 These migrations create the necessary time specialised governing bodies for municipalities, OCMWs, district and provinces for the next legislature. The migrations work by creating a new time specialisation, with an appropriate starting date, for each abstract governing body associated with an active organisation. For municipalities and OCMWs some instances are explicitly filtered, these are municipalities (OCMWs) that will be merged with another one as of 01-01-2025 and therefore will become inactive. The listed municipalities (OCMWs) are extracted from data provided by business. --- ...imed-governing-bodies-gemeente-2025.sparql | 60 +++++++++++++++++++ ...05-timed-governing-bodies-ocmw-2025.sparql | 60 +++++++++++++++++++ ...imed-governing-bodies-district-2025.sparql | 35 +++++++++++ ...med-governing-bodies-provincie-2025.sparql | 35 +++++++++++ 4 files changed, 190 insertions(+) create mode 100644 config/migrations/2024/20240828104739-governing-bodies-mandates-2025-legislation/20240829160204-timed-governing-bodies-gemeente-2025.sparql create mode 100644 config/migrations/2024/20240828104739-governing-bodies-mandates-2025-legislation/20240829160205-timed-governing-bodies-ocmw-2025.sparql create mode 100644 config/migrations/2024/20240828104739-governing-bodies-mandates-2025-legislation/20240829160206-timed-governing-bodies-district-2025.sparql create mode 100644 config/migrations/2024/20240828104739-governing-bodies-mandates-2025-legislation/20240829160207-timed-governing-bodies-provincie-2025.sparql diff --git a/config/migrations/2024/20240828104739-governing-bodies-mandates-2025-legislation/20240829160204-timed-governing-bodies-gemeente-2025.sparql b/config/migrations/2024/20240828104739-governing-bodies-mandates-2025-legislation/20240829160204-timed-governing-bodies-gemeente-2025.sparql new file mode 100644 index 0000000..deefd6e --- /dev/null +++ b/config/migrations/2024/20240828104739-governing-bodies-mandates-2025-legislation/20240829160204-timed-governing-bodies-gemeente-2025.sparql @@ -0,0 +1,60 @@ +PREFIX besluit: +PREFIX mu: +PREFIX generiek: +PREFIX mandaat: +PREFIX skos: +PREFIX org: +PREFIX regorg: + +INSERT { + GRAPH { + ?timedGoverningBody a besluit:Bestuursorgaan ; + mu:uuid ?timedGoverningBodyUuid ; + generiek:isTijdspecialisatieVan ?governingBody ; + mandaat:bindingStart "2025-01-01T00:00:00"^^xsd:dateTime . + } +} WHERE { + # Note: for municipalities and provinces the graphs differ, splitting this + # WHERE clause in two GRAPH clauses simplifies the generation of these + # migrations. + GRAPH { + ?organization mu:uuid ?organizationUuid ; + org:classification . # Gemeente + } + + GRAPH { + ?governingBody besluit:bestuurt ?organization ; + org:classification ?governingBodyClassification . + + # Only active organizations should get new timed governing bodies + ?organization regorg:orgStatus . # Actief (Eng. Active) + } + + FILTER ( + ?organization + NOT IN + ( # Beveren + , # Borgloon + , # Borsbeek + , # De Pinte + , # Galmaarden + , # Gooik + , # Herne + , # Hoeselt + , # Kortessem + , # Kruibeke + , # Melle + , # Merelbeke + , # Meulebeke + , # Moerbeke + , # Nazareth + , # Ruiselede + , # Tessenderlo + , # Wachtebeke + , # Zwijndrecht + ) + ) + + BIND(SHA256(CONCAT(STR(?governingBodyClassification), " 2025 ", STR(?governingBody), STR(?organizationUuid))) AS ?timedGoverningBodyUuid) + BIND(IRI(CONCAT("http://data.lblod.info/id/bestuursorganen/", STR(?timedGoverningBodyUuid))) AS ?timedGoverningBody) +} diff --git a/config/migrations/2024/20240828104739-governing-bodies-mandates-2025-legislation/20240829160205-timed-governing-bodies-ocmw-2025.sparql b/config/migrations/2024/20240828104739-governing-bodies-mandates-2025-legislation/20240829160205-timed-governing-bodies-ocmw-2025.sparql new file mode 100644 index 0000000..8995b56 --- /dev/null +++ b/config/migrations/2024/20240828104739-governing-bodies-mandates-2025-legislation/20240829160205-timed-governing-bodies-ocmw-2025.sparql @@ -0,0 +1,60 @@ +PREFIX besluit: +PREFIX mu: +PREFIX generiek: +PREFIX mandaat: +PREFIX skos: +PREFIX org: +PREFIX regorg: + +INSERT { + GRAPH { + ?timedGoverningBody a besluit:Bestuursorgaan ; + mu:uuid ?timedGoverningBodyUuid ; + generiek:isTijdspecialisatieVan ?governingBody ; + mandaat:bindingStart "2025-01-01T00:00:00"^^xsd:dateTime . + } +} WHERE { + # Note: for municipalities and provinces the graphs differ, splitting this + # WHERE clause in two GRAPH clauses simplifies the generation of these + # migrations. + GRAPH { + ?organization mu:uuid ?organizationUuid ; + org:classification . # OCMW + } + + GRAPH { + ?governingBody besluit:bestuurt ?organization ; + org:classification ?governingBodyClassification . + + # Only active organizations should get new timed governing bodies + ?organization regorg:orgStatus . # Actief (Eng. Active) + } + + FILTER ( + ?organization + NOT IN + ( # Beveren + , # Borgloon + , # Borsbeek + , # De Pinte + , # Galmaarden + , # Gooik + , # Herne + , # Hoeselt + , # Kortessem + , # Kruibeke + , # Melle + , # Merelbeke + , # Meulebeke + , # Moerbeke + , # Nazareth + , # Ruiselede + , # Tessenderlo + , # Wachtebeke + , # Zwijndrecht + ) + ) + + BIND(SHA256(CONCAT(STR(?governingBodyClassification), " 2025 ", STR(?governingBody), STR(?organizationUuid))) AS ?timedGoverningBodyUuid) + BIND(IRI(CONCAT("http://data.lblod.info/id/bestuursorganen/", STR(?timedGoverningBodyUuid))) AS ?timedGoverningBody) +} diff --git a/config/migrations/2024/20240828104739-governing-bodies-mandates-2025-legislation/20240829160206-timed-governing-bodies-district-2025.sparql b/config/migrations/2024/20240828104739-governing-bodies-mandates-2025-legislation/20240829160206-timed-governing-bodies-district-2025.sparql new file mode 100644 index 0000000..1c27560 --- /dev/null +++ b/config/migrations/2024/20240828104739-governing-bodies-mandates-2025-legislation/20240829160206-timed-governing-bodies-district-2025.sparql @@ -0,0 +1,35 @@ +PREFIX besluit: +PREFIX mu: +PREFIX generiek: +PREFIX mandaat: +PREFIX skos: +PREFIX org: +PREFIX regorg: + +INSERT { + GRAPH { + ?timedGoverningBody a besluit:Bestuursorgaan ; + mu:uuid ?timedGoverningBodyUuid ; + generiek:isTijdspecialisatieVan ?governingBody ; + mandaat:bindingStart "2025-01-01T00:00:00"^^xsd:dateTime . + } +} WHERE { + # Note: for municipalities and provinces the graphs differ, splitting this + # WHERE clause in two GRAPH clauses simplifies the generation of these + # migrations. + GRAPH { + ?organization mu:uuid ?organizationUuid ; + org:classification . # District + } + + GRAPH { + ?governingBody besluit:bestuurt ?organization ; + org:classification ?governingBodyClassification . + + # Only active organizations should get new timed governing bodies + ?organization regorg:orgStatus . # Actief (Eng. Active) + } + + BIND(SHA256(CONCAT(STR(?governingBodyClassification), " 2025 ", STR(?governingBody), STR(?organizationUuid))) AS ?timedGoverningBodyUuid) + BIND(IRI(CONCAT("http://data.lblod.info/id/bestuursorganen/", STR(?timedGoverningBodyUuid))) AS ?timedGoverningBody) +} diff --git a/config/migrations/2024/20240828104739-governing-bodies-mandates-2025-legislation/20240829160207-timed-governing-bodies-provincie-2025.sparql b/config/migrations/2024/20240828104739-governing-bodies-mandates-2025-legislation/20240829160207-timed-governing-bodies-provincie-2025.sparql new file mode 100644 index 0000000..074f97d --- /dev/null +++ b/config/migrations/2024/20240828104739-governing-bodies-mandates-2025-legislation/20240829160207-timed-governing-bodies-provincie-2025.sparql @@ -0,0 +1,35 @@ +PREFIX besluit: +PREFIX mu: +PREFIX generiek: +PREFIX mandaat: +PREFIX skos: +PREFIX org: +PREFIX regorg: + +INSERT { + GRAPH { + ?timedGoverningBody a besluit:Bestuursorgaan ; + mu:uuid ?timedGoverningBodyUuid ; + generiek:isTijdspecialisatieVan ?governingBody ; + mandaat:bindingStart "2025-01-01T00:00:00"^^xsd:dateTime . + } +} WHERE { + # Note: for municipalities and provinces the graphs differ, splitting this + # WHERE clause in two GRAPH clauses simplifies the generation of these + # migrations. + GRAPH { + ?organization mu:uuid ?organizationUuid ; + org:classification . # Provincie + } + + GRAPH { + ?governingBody besluit:bestuurt ?organization ; + org:classification ?governingBodyClassification . + + # Only active organizations should get new timed governing bodies + ?organization regorg:orgStatus . # Actief (Eng. Active) + } + + BIND(SHA256(CONCAT(STR(?governingBodyClassification), " 2025 ", STR(?governingBody), STR(?organizationUuid))) AS ?timedGoverningBodyUuid) + BIND(IRI(CONCAT("http://data.lblod.info/id/bestuursorganen/", STR(?timedGoverningBodyUuid))) AS ?timedGoverningBody) +}