From 8f8557d733e95f0dbced350c8e02fd930fb080cc Mon Sep 17 00:00:00 2001 From: felix Date: Wed, 23 Oct 2024 12:46:34 +0200 Subject: [PATCH 1/4] Added migration to add end-dates to bestuursorganen --- .../2024/20241023123139-add-end-dates-bestuursorganen.sparql | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 config/migrations/2024/20241023123139-add-end-dates-bestuursorganen.sparql diff --git a/config/migrations/2024/20241023123139-add-end-dates-bestuursorganen.sparql b/config/migrations/2024/20241023123139-add-end-dates-bestuursorganen.sparql new file mode 100644 index 0000000..e69de29 From 799999f05178f7198598177d2812949d7931cb72 Mon Sep 17 00:00:00 2001 From: felix Date: Wed, 23 Oct 2024 13:21:01 +0200 Subject: [PATCH 2/4] updated migration --- ...23139-add-end-dates-bestuursorganen.sparql | 0 ...23140-add-end-dates-bestuursorganen.sparql | 59 +++++++++++++++++++ 2 files changed, 59 insertions(+) delete mode 100644 config/migrations/2024/20241023123139-add-end-dates-bestuursorganen.sparql create mode 100644 config/migrations/2024/20241023123140-add-end-dates-bestuursorganen.sparql diff --git a/config/migrations/2024/20241023123139-add-end-dates-bestuursorganen.sparql b/config/migrations/2024/20241023123139-add-end-dates-bestuursorganen.sparql deleted file mode 100644 index e69de29..0000000 diff --git a/config/migrations/2024/20241023123140-add-end-dates-bestuursorganen.sparql b/config/migrations/2024/20241023123140-add-end-dates-bestuursorganen.sparql new file mode 100644 index 0000000..e095eba --- /dev/null +++ b/config/migrations/2024/20241023123140-add-end-dates-bestuursorganen.sparql @@ -0,0 +1,59 @@ +PREFIX besluit: +PREFIX mandaat: +PREFIX generiek: +PREFIX org: +PREFIX skos: + +INSERT { + GRAPH { + ?oldVersion mandaat:bindingEinde ?newStartDate . + } +} +WHERE { + + VALUES ?orgaanClass { + #Gouverneur + # Provincieraad + # deputatie + + # Burgemeester + # gemeenteraad + # college + + # rmw + # Vast Bureau + # Voorzitter van het Bijzonder Comité voor de Sociale Dienst + # Bijzonder Comité voor de Sociale Dienst + + #districtburgemeester + # Districtsraad + # Districtscollege + } + + GRAPH { + + ?bestuursorgaan besluit:bestuurt ?bestuurseenheid; + skos:prefLabel ?orgaanLabel; + ?orgaanClass. + + # Find the bestuursorgaan version without an end date + ?oldVersion a besluit:Bestuursorgaan ; + generiek:isTijdspecialisatieVan ?bestuursorgaan ; + mandaat:bindingStart ?oldStartDate . + FILTER NOT EXISTS { ?oldVersion mandaat:bindingEinde ?_ } + + # Find newer bestuursorgaan version + ?newVersion a besluit:Bestuursorgaan ; + generiek:isTijdspecialisatieVan ?bestuursorgaan ; + mandaat:bindingStart ?newStartDate . + FILTER (?newStartDate > ?oldStartDate) + + # Ensure there's no version with an earlier or same start date than the new one + FILTER NOT EXISTS { + ?otherVersion a besluit:Bestuursorgaan ; + generiek:isTijdspecialisatieVan ?bestuursorgaan ; + mandaat:bindingStart ?otherStartDate . + FILTER (?otherStartDate > ?oldStartDate && ?otherStartDate < ?newStartDate) + } + } +} \ No newline at end of file From 5d20fee49484040cd9a9287559fb15c0a95d10da Mon Sep 17 00:00:00 2001 From: felix Date: Mon, 28 Oct 2024 13:02:22 +0100 Subject: [PATCH 3/4] Removes the newly created bestuursorganen for leidinggevenden They have another lifecycle than political mandates. --- ...nctionarissen-newly-created-organen.sparql | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 config/migrations/2024/20241028125621-remove-functionarissen-newly-created-organen.sparql diff --git a/config/migrations/2024/20241028125621-remove-functionarissen-newly-created-organen.sparql b/config/migrations/2024/20241028125621-remove-functionarissen-newly-created-organen.sparql new file mode 100644 index 0000000..257b4eb --- /dev/null +++ b/config/migrations/2024/20241028125621-remove-functionarissen-newly-created-organen.sparql @@ -0,0 +1,37 @@ +PREFIX skos: + +DELETE { + GRAPH ?g { + ?orgIntijdNew ?orgIntijdNewP ?orgIntijdNewO. + ?bestuursfunctie ?bestuursfunctieP ?bestuursfunctieO. + } +} + +WHERE { + VALUES ?class { + # "Adjunct-algemeen directeur" + # "Algemeen directeur" + # "Leidend Ambtenaar" + # "Financieel directeu" + # "Adjunct-financieel directeur" + # "Financieel beheerder" + # Griffier + } + + ?s a ; + ?class. + + ?orgIntijdOld ?s; + ?old. + + ?orgIntijdNew ?s; + ?new. + + FILTER(?new > ?old) + + GRAPH ?g { + ?orgIntijdNew ?orgIntijdNewP ?orgIntijdNewO. + ?orgIntijdNew ?bestuursfunctie. + ?bestuursfunctie ?bestuursfunctieP ?bestuursfunctieO. + } +} \ No newline at end of file From 9b3dd7201bb643b92a92e0e822ec65607010d132 Mon Sep 17 00:00:00 2001 From: felix Date: Mon, 28 Oct 2024 14:50:56 +0100 Subject: [PATCH 4/4] update migration --- ...nctionarissen-newly-created-organen.sparql | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/config/migrations/2024/20241028125621-remove-functionarissen-newly-created-organen.sparql b/config/migrations/2024/20241028125621-remove-functionarissen-newly-created-organen.sparql index 257b4eb..ac9e148 100644 --- a/config/migrations/2024/20241028125621-remove-functionarissen-newly-created-organen.sparql +++ b/config/migrations/2024/20241028125621-remove-functionarissen-newly-created-organen.sparql @@ -1,12 +1,12 @@ PREFIX skos: +PREFIX generiek: DELETE { - GRAPH ?g { + GRAPH { ?orgIntijdNew ?orgIntijdNewP ?orgIntijdNewO. ?bestuursfunctie ?bestuursfunctieP ?bestuursfunctieO. } } - WHERE { VALUES ?class { # "Adjunct-algemeen directeur" @@ -18,18 +18,19 @@ WHERE { # Griffier } - ?s a ; - ?class. + GRAPH { - ?orgIntijdOld ?s; - ?old. + ?s a ; + ?class. - ?orgIntijdNew ?s; - ?new. + ?orgIntijdOld generiek:isTijdspecialisatieVan ?s; + ?old. + + ?orgIntijdNew generiek:isTijdspecialisatieVan ?s; + ?new. FILTER(?new > ?old) - GRAPH ?g { ?orgIntijdNew ?orgIntijdNewP ?orgIntijdNewO. ?orgIntijdNew ?bestuursfunctie. ?bestuursfunctie ?bestuursfunctieP ?bestuursfunctieO.