From 2002099b9875bed403b0a8c47bef80784e0d3429 Mon Sep 17 00:00:00 2001 From: Damon Date: Fri, 31 Jul 2026 09:50:27 +0200 Subject: [PATCH 1/7] DL-7485: draft version imam migration --- CHANGELOG.md | 6 + ...0000-fix-islam-imam-roles-by-status.sparql | 220 ++++++++++++++++++ 2 files changed, 226 insertions(+) create mode 100644 config/migrations/2026/20260720100000-fix-islam-imam-roles-by-status.sparql diff --git a/CHANGELOG.md b/CHANGELOG.md index e6d6860..d1111e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Changelog ## Unreleased +- Islamitisch eredienstbestuur: only offer relevant imam roles based on status (erkenningszoekend -> Waarnemende imam; erkend -> Eerste/Tweede/Derde imam in rang); bump construct-organization-relationships [OP-XXXX] - Added service to link addresses to addressregister uris [OP-3795] - Derive an organization's reference region(s) from its werkingsgebied; bump scope-of-operation to 0.2.0 [OP-3799] - Site type changes [OP-3818] @@ -30,6 +31,11 @@ drc restart migrations drc restart resource cache scripts/reset-elastic.sh ``` + +``` +drc pull construct-organization-relationships && drc up -d construct-organization-relationships +drc restart migrations +``` ``` drc restart migrations frontend db resource cache # reindex elastic search: diff --git a/config/migrations/2026/20260720100000-fix-islam-imam-roles-by-status.sparql b/config/migrations/2026/20260720100000-fix-islam-imam-roles-by-status.sparql new file mode 100644 index 0000000..eb2e5f4 --- /dev/null +++ b/config/migrations/2026/20260720100000-fix-islam-imam-roles-by-status.sparql @@ -0,0 +1,220 @@ +PREFIX ere: +PREFIX mu: +PREFIX org: +PREFIX regorg: + +# Deduplicate islamitisch minister positions: if an eredienstbestuur has more +# than one position for the same function (e.g. 2 "Waarnemende Imam"), keep +# only one - deterministically the lowest-URI position - and merge the rest +# into it: any minister (org:holds) on a non-kept position is reparented onto +# the kept position instead of being dropped. Ministers and their conditions +# (ere:voldoetAan) are left fully intact, just re-pointed to survive the dedup. +DELETE { + GRAPH { + ?minister org:holds ?position . + } +} +INSERT { + GRAPH { + ?minister org:holds ?keptPosition . + } +} +WHERE { + GRAPH { + ?worshipService a ere:BestuurVanDeEredienst ; + ere:typeEredienst ; # Islamitisch + ere:wordtBediendDoor ?position . + + ?position ere:functie ?functie . + ?minister org:holds ?position . + + { + SELECT ?worshipService ?functie (IRI(MIN(STR(?anyPosition))) AS ?keptPosition) WHERE { + GRAPH { + ?worshipService ere:wordtBediendDoor ?anyPosition . + ?anyPosition ere:functie ?functie . + } + } + GROUP BY ?worshipService ?functie + } + + FILTER(?position != ?keptPosition) + } +} +; + +# Delete the now-empty duplicate positions left behind by the reparenting +# above (same "lowest URI wins" rule, kept in sync with it). Since ministers +# were already moved off in the previous step, this only drops the position +# shells and their own triples (org:Post, mu:uuid, ere:functie). +DELETE { + GRAPH { + ?worshipService ere:wordtBediendDoor ?position . + ?position ?p ?o . + } +} +WHERE { + GRAPH { + ?worshipService a ere:BestuurVanDeEredienst ; + ere:typeEredienst ; # Islamitisch + ere:wordtBediendDoor ?position . + + ?position ?p ?o ; + ere:functie ?functie . + + { + SELECT ?worshipService ?functie (IRI(MIN(STR(?anyPosition))) AS ?keptPosition) WHERE { + GRAPH { + ?worshipService ere:wordtBediendDoor ?anyPosition . + ?anyPosition ere:functie ?functie . + } + } + GROUP BY ?worshipService ?functie + } + + FILTER(?position != ?keptPosition) + } +} +; + +## Islamitisch eredienstbesturen "In Oprichting" (erkenningszoekend) should only +## have the "Waarnemende Imam" minister position. Remove the 3 ranked-imam +## positions that were always created before this fix. Any minister +## (ere:RolBedienaar) currently holding such a position is removed along with +## its own conditions (ere:VoorwaardenBedienaar); the person they link to +## (org:heldBy) is left untouched, since that's a shared, reusable resource, +## not owned by this position/minister. +#DELETE { +# GRAPH { +# ?worshipService ere:wordtBediendDoor ?position . +# ?position ?p ?o . +# ?minister ?mp ?mo . +# ?condition ?cp ?co . +# } +#} +#WHERE { +# GRAPH { +# ?worshipService a ere:BestuurVanDeEredienst ; +# ere:typeEredienst ; # Islamitisch +# regorg:orgStatus ; # In Oprichting +# ere:wordtBediendDoor ?position . +# +# ?position ?p ?o ; +# ere:functie ?functie . +# +# VALUES ?functie { +# # Eerste Imam in rang +# # Tweede Imam in rang +# # Derde Imam in rang +# } +# +# OPTIONAL { +# ?minister org:holds ?position ; +# ?mp ?mo . +# +# OPTIONAL { +# ?minister ere:voldoetAan ?condition . +# ?condition ?cp ?co . +# } +# } +# } +#} +#; +# +## Islamitisch eredienstbesturen that are "Actief" (erkend) should only have the +## 3 ranked-imam positions. Remove the "Waarnemende Imam" position that was +## always created before this fix. Same cascade as above: any minister holding +## it (and its conditions) is removed, the person is left untouched. +#DELETE { +# GRAPH { +# ?worshipService ere:wordtBediendDoor ?position . +# ?position ?p ?o . +# ?minister ?mp ?mo . +# ?condition ?cp ?co . +# } +#} +#WHERE { +# GRAPH { +# ?worshipService a ere:BestuurVanDeEredienst ; +# ere:typeEredienst ; # Islamitisch +# regorg:orgStatus ; # Actief +# ere:wordtBediendDoor ?position . +# +# ?position ?p ?o ; +# ere:functie . # Waarnemende Imam +# +# OPTIONAL { +# ?minister org:holds ?position ; +# ?mp ?mo . +# +# OPTIONAL { +# ?minister ere:voldoetAan ?condition . +# ?condition ?cp ?co . +# } +# } +# } +#} +#; +# +## Create the 3 ranked-imam positions for "Actief" islamitisch eredienstbesturen +## that are missing one or more of them (idempotent: MD5-derived deterministic +## UUID + FILTER NOT EXISTS, matching 20221004113653-create-missing-bedienaren-positions.sparql). +#INSERT { +# GRAPH { +# ?worshipService ere:wordtBediendDoor ?newMinisterPosition . +# +# ?newMinisterPosition a org:Post , ere:PositieBedienaar ; +# mu:uuid ?uuidNewMinisterPosition ; +# ere:functie ?functie . +# } +#} +#WHERE { +# GRAPH { +# ?worshipService a ere:BestuurVanDeEredienst ; +# ere:typeEredienst ; # Islamitisch +# regorg:orgStatus . # Actief +# +# VALUES ?functie { +# # Eerste Imam in rang +# # Tweede Imam in rang +# # Derde Imam in rang +# } +# +# FILTER NOT EXISTS { +# ?worshipService ere:wordtBediendDoor ?ministerPosition . +# ?ministerPosition ere:functie ?functie . +# } +# +# BIND(MD5(CONCAT(?worshipService, ?functie)) as ?uuidNewMinisterPosition) +# BIND(IRI(CONCAT("http://data.lblod.info/id/positiesBedienaar/", ?uuidNewMinisterPosition)) AS ?newMinisterPosition) +# } +#} +#; +# +## Create the "Waarnemende Imam" position for "In Oprichting" islamitisch +## eredienstbesturen that are missing it (should be rare, kept for +## completeness/idempotency). +#INSERT { +# GRAPH { +# ?worshipService ere:wordtBediendDoor ?newMinisterPosition . +# +# ?newMinisterPosition a org:Post , ere:PositieBedienaar ; +# mu:uuid ?uuidNewMinisterPosition ; +# ere:functie . # Waarnemende Imam +# } +#} +#WHERE { +# GRAPH { +# ?worshipService a ere:BestuurVanDeEredienst ; +# ere:typeEredienst ; # Islamitisch +# regorg:orgStatus . # In Oprichting +# +# FILTER NOT EXISTS { +# ?worshipService ere:wordtBediendDoor ?ministerPosition . +# ?ministerPosition ere:functie . +# } +# +# BIND(MD5(?worshipService) as ?uuidNewMinisterPosition) +# BIND(IRI(CONCAT("http://data.lblod.info/id/positiesBedienaar/", ?uuidNewMinisterPosition)) AS ?newMinisterPosition) +# } +#} From 641e4054d1620b1db754ac6f600edeb876642ead Mon Sep 17 00:00:00 2001 From: Damon Date: Tue, 4 Aug 2026 13:32:51 +0200 Subject: [PATCH 2/7] DL-7485: updated migration fix islam roles --- ...0000-fix-islam-imam-roles-by-status.sparql | 177 +++++++----------- 1 file changed, 63 insertions(+), 114 deletions(-) diff --git a/config/migrations/2026/20260720100000-fix-islam-imam-roles-by-status.sparql b/config/migrations/2026/20260720100000-fix-islam-imam-roles-by-status.sparql index eb2e5f4..db41194 100644 --- a/config/migrations/2026/20260720100000-fix-islam-imam-roles-by-status.sparql +++ b/config/migrations/2026/20260720100000-fix-islam-imam-roles-by-status.sparql @@ -1,95 +1,62 @@ -PREFIX ere: -PREFIX mu: -PREFIX org: -PREFIX regorg: - -# Deduplicate islamitisch minister positions: if an eredienstbestuur has more -# than one position for the same function (e.g. 2 "Waarnemende Imam"), keep -# only one - deterministically the lowest-URI position - and merge the rest -# into it: any minister (org:holds) on a non-kept position is reparented onto -# the kept position instead of being dropped. Ministers and their conditions -# (ere:voldoetAan) are left fully intact, just re-pointed to survive the dedup. -DELETE { - GRAPH { - ?minister org:holds ?position . - } -} -INSERT { - GRAPH { - ?minister org:holds ?keptPosition . - } -} -WHERE { - GRAPH { - ?worshipService a ere:BestuurVanDeEredienst ; - ere:typeEredienst ; # Islamitisch - ere:wordtBediendDoor ?position . - - ?position ere:functie ?functie . - ?minister org:holds ?position . - - { - SELECT ?worshipService ?functie (IRI(MIN(STR(?anyPosition))) AS ?keptPosition) WHERE { - GRAPH { - ?worshipService ere:wordtBediendDoor ?anyPosition . - ?anyPosition ere:functie ?functie . - } - } - GROUP BY ?worshipService ?functie - } - - FILTER(?position != ?keptPosition) - } -} -; - -# Delete the now-empty duplicate positions left behind by the reparenting -# above (same "lowest URI wins" rule, kept in sync with it). Since ministers -# were already moved off in the previous step, this only drops the position -# shells and their own triples (org:Post, mu:uuid, ere:functie). -DELETE { - GRAPH { - ?worshipService ere:wordtBediendDoor ?position . - ?position ?p ?o . - } -} -WHERE { - GRAPH { - ?worshipService a ere:BestuurVanDeEredienst ; - ere:typeEredienst ; # Islamitisch - ere:wordtBediendDoor ?position . - - ?position ?p ?o ; - ere:functie ?functie . - - { - SELECT ?worshipService ?functie (IRI(MIN(STR(?anyPosition))) AS ?keptPosition) WHERE { - GRAPH { - ?worshipService ere:wordtBediendDoor ?anyPosition . - ?anyPosition ere:functie ?functie . - } - } - GROUP BY ?worshipService ?functie - } - - FILTER(?position != ?keptPosition) - } -} -; - -## Islamitisch eredienstbesturen "In Oprichting" (erkenningszoekend) should only -## have the "Waarnemende Imam" minister position. Remove the 3 ranked-imam -## positions that were always created before this fix. Any minister -## (ere:RolBedienaar) currently holding such a position is removed along with -## its own conditions (ere:VoorwaardenBedienaar); the person they link to -## (org:heldBy) is left untouched, since that's a shared, reusable resource, -## not owned by this position/minister. +#PREFIX ere: +#PREFIX mu: +#PREFIX org: +#PREFIX regorg: +# +## Deduplicate islamitisch minister positions: if an eredienstbestuur has more +## than one position for the same function (e.g. 2 "Waarnemende Imam"), keep +## only one - deterministically the lowest-URI position - and drop the rest +## (their own triples: org:Post, mu:uuid, ere:functie, and the +## ere:wordtBediendDoor link). This only touches ere:PositieBedienaar, which OP +## owns. The bedienaar side (ere:RolBedienaar, org:holds, conditions) is owned +## by loket and is handled there instead (app-digitaal-loket +## 20260803120000-cleanup-islam-imam-bedienaren-by-status.sparql, step 1 - same +## lowest-URI-wins rule, applied to org:holds at the actual source of truth). +## That migration must run first/land before this one, so no bedienaar is +## still pointing at a position this deletes. +#DELETE { +# GRAPH { +# ?worshipService ere:wordtBediendDoor ?position . +# ?position ?p ?o . +# } +#} +#WHERE { +# GRAPH { +# ?worshipService a ere:BestuurVanDeEredienst ; +# ere:typeEredienst ; # Islamitisch +# ere:wordtBediendDoor ?position . +# +# ?position ?p ?o ; +# ere:functie ?functie . +# +# { +# SELECT ?worshipService ?functie (IRI(MIN(STR(?anyPosition))) AS ?keptPosition) WHERE { +# GRAPH { +# ?worshipService ere:wordtBediendDoor ?anyPosition . +# ?anyPosition ere:functie ?functie . +# } +# } +# GROUP BY ?worshipService ?functie +# } +# +# FILTER(?position != ?keptPosition) +# } +#} +#; +# +## Islamitisch eredienstbesturen "In Oprichting" (erkenningszoekend) should only +## have the "Waarnemende Imam" minister position - same rule the +## construct-organization-relationships-service applies going forward +## (WORSHIP_IN_OPRICHTING_MINISTERS). Remove the 3 ranked-imam positions that +## were always created before this fix. Position-only: any bedienaar that was +## still holding one of these is already gone by now, removed by loket's own +## migration (app-digitaal-loket +## 20260803120000-cleanup-islam-imam-bedienaren-by-status.sparql, step 3), +## which must run before this one. #DELETE { # GRAPH { # ?worshipService ere:wordtBediendDoor ?position . # ?position ?p ?o . -# ?minister ?mp ?mo . -# ?condition ?cp ?co . # } #} #WHERE { @@ -107,30 +74,20 @@ WHERE { # # Tweede Imam in rang # # Derde Imam in rang # } -# -# OPTIONAL { -# ?minister org:holds ?position ; -# ?mp ?mo . -# -# OPTIONAL { -# ?minister ere:voldoetAan ?condition . -# ?condition ?cp ?co . -# } -# } # } #} #; # ## Islamitisch eredienstbesturen that are "Actief" (erkend) should only have the -## 3 ranked-imam positions. Remove the "Waarnemende Imam" position that was -## always created before this fix. Same cascade as above: any minister holding -## it (and its conditions) is removed, the person is left untouched. +## 3 ranked-imam positions - same rule as MINISTER_CLASSIFICATIONS in +## construct-organization-relationships-service. Remove the "Waarnemende Imam" +## position that was always created before this fix. Position-only, same +## precondition as above: loket's migration step 2 must have already cleared +## any bedienaar holding it. #DELETE { # GRAPH { # ?worshipService ere:wordtBediendDoor ?position . # ?position ?p ?o . -# ?minister ?mp ?mo . -# ?condition ?cp ?co . # } #} #WHERE { @@ -142,16 +99,6 @@ WHERE { # # ?position ?p ?o ; # ere:functie . # Waarnemende Imam -# -# OPTIONAL { -# ?minister org:holds ?position ; -# ?mp ?mo . -# -# OPTIONAL { -# ?minister ere:voldoetAan ?condition . -# ?condition ?cp ?co . -# } -# } # } #} #; @@ -159,6 +106,7 @@ WHERE { ## Create the 3 ranked-imam positions for "Actief" islamitisch eredienstbesturen ## that are missing one or more of them (idempotent: MD5-derived deterministic ## UUID + FILTER NOT EXISTS, matching 20221004113653-create-missing-bedienaren-positions.sparql). +## Pure creation, nothing to coordinate with loket for. #INSERT { # GRAPH { # ?worshipService ere:wordtBediendDoor ?newMinisterPosition . @@ -193,7 +141,8 @@ WHERE { # ## Create the "Waarnemende Imam" position for "In Oprichting" islamitisch ## eredienstbesturen that are missing it (should be rare, kept for -## completeness/idempotency). +## completeness/idempotency). Pure creation, nothing to coordinate with loket +## for. #INSERT { # GRAPH { # ?worshipService ere:wordtBediendDoor ?newMinisterPosition . From eafee23db1fe1da87a58968d5e0f8cd443791896 Mon Sep 17 00:00:00 2001 From: Damon Date: Wed, 5 Aug 2026 16:47:14 +0200 Subject: [PATCH 3/7] DL-7485: restrict imam selection based on org status + migration to fix imam roles --- config/delta-producer/public/export.json | 3 +- ...0000-fix-islam-imam-roles-by-status.sparql | 240 ++++++------------ ...tatuses-to-islam-minister-functions.sparql | 17 ++ config/resources/domain.json | 7 + 4 files changed, 97 insertions(+), 170 deletions(-) create mode 100644 config/migrations/2026/20260804090000-add-applicable-statuses-to-islam-minister-functions.sparql diff --git a/config/delta-producer/public/export.json b/config/delta-producer/public/export.json index b34ea6f..b13cc52 100644 --- a/config/delta-producer/public/export.json +++ b/config/delta-producer/public/export.json @@ -535,7 +535,8 @@ ], "properties": [ "http://mu.semte.ch/vocabularies/core/uuid", - "http://www.w3.org/2004/02/skos/core#prefLabel" + "http://www.w3.org/2004/02/skos/core#prefLabel", + "http://data.lblod.info/vocabularies/erediensten/vanToepassingBijStatus" ] }, { diff --git a/config/migrations/2026/20260720100000-fix-islam-imam-roles-by-status.sparql b/config/migrations/2026/20260720100000-fix-islam-imam-roles-by-status.sparql index db41194..4377d8f 100644 --- a/config/migrations/2026/20260720100000-fix-islam-imam-roles-by-status.sparql +++ b/config/migrations/2026/20260720100000-fix-islam-imam-roles-by-status.sparql @@ -1,169 +1,71 @@ -#PREFIX ere: -#PREFIX mu: -#PREFIX org: -#PREFIX regorg: -# -## Deduplicate islamitisch minister positions: if an eredienstbestuur has more -## than one position for the same function (e.g. 2 "Waarnemende Imam"), keep -## only one - deterministically the lowest-URI position - and drop the rest -## (their own triples: org:Post, mu:uuid, ere:functie, and the -## ere:wordtBediendDoor link). This only touches ere:PositieBedienaar, which OP -## owns. The bedienaar side (ere:RolBedienaar, org:holds, conditions) is owned -## by loket and is handled there instead (app-digitaal-loket -## 20260803120000-cleanup-islam-imam-bedienaren-by-status.sparql, step 1 - same -## lowest-URI-wins rule, applied to org:holds at the actual source of truth). -## That migration must run first/land before this one, so no bedienaar is -## still pointing at a position this deletes. -#DELETE { -# GRAPH { -# ?worshipService ere:wordtBediendDoor ?position . -# ?position ?p ?o . -# } -#} -#WHERE { -# GRAPH { -# ?worshipService a ere:BestuurVanDeEredienst ; -# ere:typeEredienst ; # Islamitisch -# ere:wordtBediendDoor ?position . -# -# ?position ?p ?o ; -# ere:functie ?functie . -# -# { -# SELECT ?worshipService ?functie (IRI(MIN(STR(?anyPosition))) AS ?keptPosition) WHERE { -# GRAPH { -# ?worshipService ere:wordtBediendDoor ?anyPosition . -# ?anyPosition ere:functie ?functie . -# } -# } -# GROUP BY ?worshipService ?functie -# } -# -# FILTER(?position != ?keptPosition) -# } -#} -#; -# -## Islamitisch eredienstbesturen "In Oprichting" (erkenningszoekend) should only -## have the "Waarnemende Imam" minister position - same rule the -## construct-organization-relationships-service applies going forward -## (WORSHIP_IN_OPRICHTING_MINISTERS). Remove the 3 ranked-imam positions that -## were always created before this fix. Position-only: any bedienaar that was -## still holding one of these is already gone by now, removed by loket's own -## migration (app-digitaal-loket -## 20260803120000-cleanup-islam-imam-bedienaren-by-status.sparql, step 3), -## which must run before this one. -#DELETE { -# GRAPH { -# ?worshipService ere:wordtBediendDoor ?position . -# ?position ?p ?o . -# } -#} -#WHERE { -# GRAPH { -# ?worshipService a ere:BestuurVanDeEredienst ; -# ere:typeEredienst ; # Islamitisch -# regorg:orgStatus ; # In Oprichting -# ere:wordtBediendDoor ?position . -# -# ?position ?p ?o ; -# ere:functie ?functie . -# -# VALUES ?functie { -# # Eerste Imam in rang -# # Tweede Imam in rang -# # Derde Imam in rang -# } -# } -#} -#; -# -## Islamitisch eredienstbesturen that are "Actief" (erkend) should only have the -## 3 ranked-imam positions - same rule as MINISTER_CLASSIFICATIONS in -## construct-organization-relationships-service. Remove the "Waarnemende Imam" -## position that was always created before this fix. Position-only, same -## precondition as above: loket's migration step 2 must have already cleared -## any bedienaar holding it. -#DELETE { -# GRAPH { -# ?worshipService ere:wordtBediendDoor ?position . -# ?position ?p ?o . -# } -#} -#WHERE { -# GRAPH { -# ?worshipService a ere:BestuurVanDeEredienst ; -# ere:typeEredienst ; # Islamitisch -# regorg:orgStatus ; # Actief -# ere:wordtBediendDoor ?position . -# -# ?position ?p ?o ; -# ere:functie . # Waarnemende Imam -# } -#} -#; -# -## Create the 3 ranked-imam positions for "Actief" islamitisch eredienstbesturen -## that are missing one or more of them (idempotent: MD5-derived deterministic -## UUID + FILTER NOT EXISTS, matching 20221004113653-create-missing-bedienaren-positions.sparql). -## Pure creation, nothing to coordinate with loket for. -#INSERT { -# GRAPH { -# ?worshipService ere:wordtBediendDoor ?newMinisterPosition . -# -# ?newMinisterPosition a org:Post , ere:PositieBedienaar ; -# mu:uuid ?uuidNewMinisterPosition ; -# ere:functie ?functie . -# } -#} -#WHERE { -# GRAPH { -# ?worshipService a ere:BestuurVanDeEredienst ; -# ere:typeEredienst ; # Islamitisch -# regorg:orgStatus . # Actief -# -# VALUES ?functie { -# # Eerste Imam in rang -# # Tweede Imam in rang -# # Derde Imam in rang -# } -# -# FILTER NOT EXISTS { -# ?worshipService ere:wordtBediendDoor ?ministerPosition . -# ?ministerPosition ere:functie ?functie . -# } -# -# BIND(MD5(CONCAT(?worshipService, ?functie)) as ?uuidNewMinisterPosition) -# BIND(IRI(CONCAT("http://data.lblod.info/id/positiesBedienaar/", ?uuidNewMinisterPosition)) AS ?newMinisterPosition) -# } -#} -#; -# -## Create the "Waarnemende Imam" position for "In Oprichting" islamitisch -## eredienstbesturen that are missing it (should be rare, kept for -## completeness/idempotency). Pure creation, nothing to coordinate with loket -## for. -#INSERT { -# GRAPH { -# ?worshipService ere:wordtBediendDoor ?newMinisterPosition . -# -# ?newMinisterPosition a org:Post , ere:PositieBedienaar ; -# mu:uuid ?uuidNewMinisterPosition ; -# ere:functie . # Waarnemende Imam -# } -#} -#WHERE { -# GRAPH { -# ?worshipService a ere:BestuurVanDeEredienst ; -# ere:typeEredienst ; # Islamitisch -# regorg:orgStatus . # In Oprichting -# -# FILTER NOT EXISTS { -# ?worshipService ere:wordtBediendDoor ?ministerPosition . -# ?ministerPosition ere:functie . -# } -# -# BIND(MD5(?worshipService) as ?uuidNewMinisterPosition) -# BIND(IRI(CONCAT("http://data.lblod.info/id/positiesBedienaar/", ?uuidNewMinisterPosition)) AS ?newMinisterPosition) -# } -#} +PREFIX ere: +PREFIX mu: +PREFIX org: + +# Deduplicate islamitisch minister positions: if an eredienstbestuur has more +# than one position for the same function (e.g. 2 "Waarnemende Imam"), keep +# only one - deterministically the lowest-URI position - and drop the rest +DELETE { + GRAPH { + ?worshipService ere:wordtBediendDoor ?position . + ?position ?p ?o . + } +} +WHERE { + GRAPH { + ?worshipService a ere:BestuurVanDeEredienst ; + ere:typeEredienst ; # Islamitisch + ere:wordtBediendDoor ?position . + + ?position ?p ?o ; + ere:functie ?functie . + + { + SELECT ?worshipService ?functie (IRI(MIN(STR(?anyPosition))) AS ?keptPosition) WHERE { + GRAPH { + ?worshipService ere:wordtBediendDoor ?anyPosition . + ?anyPosition ere:functie ?functie . + } + } + GROUP BY ?worshipService ?functie + } + + FILTER(?position != ?keptPosition) + } +} +; + +# Create any of the 4 islamitisch minister positions (Waarnemende Imam, Eerste/ +# Tweede/Derde Imam in rang) that a worship service is missing, so every +# islamitisch eredienstbestuur always has all 4 positions, regardless of its +# current status. +INSERT { + GRAPH { + ?worshipService ere:wordtBediendDoor ?newMinisterPosition . + + ?newMinisterPosition a org:Post , ere:PositieBedienaar ; + mu:uuid ?uuidNewMinisterPosition ; + ere:functie ?functie . + } +} +WHERE { + GRAPH { + ?worshipService a ere:BestuurVanDeEredienst ; + ere:typeEredienst . # Islamitisch + + VALUES ?functie { + # Waarnemende Imam + # Eerste Imam in rang + # Tweede Imam in rang + # Derde Imam in rang + } + + FILTER NOT EXISTS { + ?worshipService ere:wordtBediendDoor ?ministerPosition . + ?ministerPosition ere:functie ?functie . + } + + BIND(MD5(CONCAT(?worshipService, ?functie)) as ?uuidNewMinisterPosition) + BIND(IRI(CONCAT("http://data.lblod.info/id/positiesBedienaar/", ?uuidNewMinisterPosition)) AS ?newMinisterPosition) + } +} diff --git a/config/migrations/2026/20260804090000-add-applicable-statuses-to-islam-minister-functions.sparql b/config/migrations/2026/20260804090000-add-applicable-statuses-to-islam-minister-functions.sparql new file mode 100644 index 0000000..ed696a8 --- /dev/null +++ b/config/migrations/2026/20260804090000-add-applicable-statuses-to-islam-minister-functions.sparql @@ -0,0 +1,17 @@ +PREFIX ere: + +INSERT DATA { + GRAPH { + # Waarnemende Imam + ere:vanToepassingBijStatus . # In Oprichting + + # Eerste Imam in rang + ere:vanToepassingBijStatus . # Actief + + # Tweede Imam in rang + ere:vanToepassingBijStatus . # Actief + + # Derde Imam in rang + ere:vanToepassingBijStatus . # Actief + } +} diff --git a/config/resources/domain.json b/config/resources/domain.json index 50fdd45..f23b469 100644 --- a/config/resources/domain.json +++ b/config/resources/domain.json @@ -1150,6 +1150,13 @@ "predicate": "skos:prefLabel" } }, + "relationships": { + "applicable-statuses": { + "predicate": "ere:vanToepassingBijStatus", + "target": "organization-status-codes", + "cardinality": "many" + } + }, "new-resource-base": "http://lblod.data.gift/concepts/" }, "financing-codes": { From 3a19db4a7933f8a0125401b78bcea9a0fbe7b2a5 Mon Sep 17 00:00:00 2001 From: Damon Date: Wed, 5 Aug 2026 16:51:36 +0200 Subject: [PATCH 4/7] DL-7485: revert changelog --- CHANGELOG.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1111e3..e6d6860 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,5 @@ # Changelog ## Unreleased -- Islamitisch eredienstbestuur: only offer relevant imam roles based on status (erkenningszoekend -> Waarnemende imam; erkend -> Eerste/Tweede/Derde imam in rang); bump construct-organization-relationships [OP-XXXX] - Added service to link addresses to addressregister uris [OP-3795] - Derive an organization's reference region(s) from its werkingsgebied; bump scope-of-operation to 0.2.0 [OP-3799] - Site type changes [OP-3818] @@ -31,11 +30,6 @@ drc restart migrations drc restart resource cache scripts/reset-elastic.sh ``` - -``` -drc pull construct-organization-relationships && drc up -d construct-organization-relationships -drc restart migrations -``` ``` drc restart migrations frontend db resource cache # reindex elastic search: From a376dd5ab28d3f74fcbcddb02126ab1ba237a769 Mon Sep 17 00:00:00 2001 From: Damon Date: Thu, 6 Aug 2026 13:29:35 +0200 Subject: [PATCH 5/7] DL-7485: migration fix --- .../2026/20260720100000-fix-islam-imam-roles-by-status.sparql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/migrations/2026/20260720100000-fix-islam-imam-roles-by-status.sparql b/config/migrations/2026/20260720100000-fix-islam-imam-roles-by-status.sparql index 4377d8f..a2b5d1b 100644 --- a/config/migrations/2026/20260720100000-fix-islam-imam-roles-by-status.sparql +++ b/config/migrations/2026/20260720100000-fix-islam-imam-roles-by-status.sparql @@ -31,6 +31,7 @@ WHERE { } FILTER(?position != ?keptPosition) + FILTER NOT EXISTS { ?anyMinister org:holds ?position } } } ; @@ -65,7 +66,7 @@ WHERE { ?ministerPosition ere:functie ?functie . } - BIND(MD5(CONCAT(?worshipService, ?functie)) as ?uuidNewMinisterPosition) + BIND(MD5(CONCAT(?worshipService, ?functie, "fix-islam-imam-roles-by-status")) as ?uuidNewMinisterPosition) BIND(IRI(CONCAT("http://data.lblod.info/id/positiesBedienaar/", ?uuidNewMinisterPosition)) AS ?newMinisterPosition) } } From 6f52c0234d72e5d56a62008365206b754a50b467 Mon Sep 17 00:00:00 2001 From: Damon Date: Fri, 7 Aug 2026 14:15:32 +0200 Subject: [PATCH 6/7] DL-7485: changelog update --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6d6860..03868f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - "In Oprichting" bestuursorgaan lifecycle [OP-3810] - Added "werkingsgebied" filter [OP-3812] - Inhoudelijk thema [OP-3817] +- Restrict available imam roles based on worship organisation status [DL-7485] ### Deploy notes ``` @@ -35,6 +36,9 @@ drc restart migrations frontend db resource cache # reindex elastic search: /bin/bash scripts/reset-elastic.sh ``` +``` +drc restart migrations resource delta-producer-publication-graph-maintainer +``` ## v1.40.0 - Query to check missing address URI's [OP-3784] From f1e4e5acda56916e29c0a6cdcf1f505c26618d1d Mon Sep 17 00:00:00 2001 From: Damon Date: Fri, 7 Aug 2026 16:38:12 +0200 Subject: [PATCH 7/7] DL-7485: edit changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 647ea05..cff6b9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ - Frontend [v1.41.0](https://github.com/lblod/frontend-organization-portal/blob/v1.41.0/CHANGELOG.md) [DL-7438] - Keep werkingsgebied filter up to date via db-cleanup service [OP-3841] - Restrict available imam roles based on worship organisation status [DL-7485] + - IMPORTANT NOTE: Make sure first the [DL-7485] loket migration has completed + data has flown from loket to OP ### Deploy notes ```