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": {