DL-7485: restrict imam selection based on org status + migration to fix imam roles

This commit is contained in:
Damon
2026-08-05 16:47:14 +02:00
parent 641e4054d1
commit eafee23db1
4 changed files with 97 additions and 170 deletions

View File

@@ -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"
]
},
{

View File

@@ -1,169 +1,71 @@
#PREFIX ere: <http://data.lblod.info/vocabularies/erediensten/>
#PREFIX mu: <http://mu.semte.ch/vocabularies/core/>
#PREFIX org: <http://www.w3.org/ns/org#>
#PREFIX regorg: <http://www.w3.org/ns/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 <http://mu.semte.ch/graphs/worship-service> {
# ?worshipService ere:wordtBediendDoor ?position .
# ?position ?p ?o .
# }
#}
#WHERE {
# GRAPH <http://mu.semte.ch/graphs/worship-service> {
# ?worshipService a ere:BestuurVanDeEredienst ;
# ere:typeEredienst <http://lblod.data.gift/concepts/9d8bd472a00bf0a5c7b7186606365a52> ; # Islamitisch
# ere:wordtBediendDoor ?position .
#
# ?position ?p ?o ;
# ere:functie ?functie .
#
# {
# SELECT ?worshipService ?functie (IRI(MIN(STR(?anyPosition))) AS ?keptPosition) WHERE {
# GRAPH <http://mu.semte.ch/graphs/worship-service> {
# ?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 <http://mu.semte.ch/graphs/worship-service> {
# ?worshipService ere:wordtBediendDoor ?position .
# ?position ?p ?o .
# }
#}
#WHERE {
# GRAPH <http://mu.semte.ch/graphs/worship-service> {
# ?worshipService a ere:BestuurVanDeEredienst ;
# ere:typeEredienst <http://lblod.data.gift/concepts/9d8bd472a00bf0a5c7b7186606365a52> ; # Islamitisch
# regorg:orgStatus <http://lblod.data.gift/concepts/abf4fee82019f88cf122f986830621ab> ; # In Oprichting
# ere:wordtBediendDoor ?position .
#
# ?position ?p ?o ;
# ere:functie ?functie .
#
# VALUES ?functie {
# <http://lblod.data.gift/concepts/e357bc8f4cc3a694fde2239748768a22> # Eerste Imam in rang
# <http://lblod.data.gift/concepts/c4a3fd586211b17b06f574885e23f355> # Tweede Imam in rang
# <http://lblod.data.gift/concepts/5ebb798bd59c3b48c25116032caa02b7> # 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 <http://mu.semte.ch/graphs/worship-service> {
# ?worshipService ere:wordtBediendDoor ?position .
# ?position ?p ?o .
# }
#}
#WHERE {
# GRAPH <http://mu.semte.ch/graphs/worship-service> {
# ?worshipService a ere:BestuurVanDeEredienst ;
# ere:typeEredienst <http://lblod.data.gift/concepts/9d8bd472a00bf0a5c7b7186606365a52> ; # Islamitisch
# regorg:orgStatus <http://lblod.data.gift/concepts/63cc561de9188d64ba5840a42ae8f0d6> ; # Actief
# ere:wordtBediendDoor ?position .
#
# ?position ?p ?o ;
# ere:functie <http://lblod.data.gift/concepts/7d8e0c15-7726-4196-9416-6dc40ed858bb> . # 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 <http://mu.semte.ch/graphs/worship-service> {
# ?worshipService ere:wordtBediendDoor ?newMinisterPosition .
#
# ?newMinisterPosition a org:Post , ere:PositieBedienaar ;
# mu:uuid ?uuidNewMinisterPosition ;
# ere:functie ?functie .
# }
#}
#WHERE {
# GRAPH <http://mu.semte.ch/graphs/worship-service> {
# ?worshipService a ere:BestuurVanDeEredienst ;
# ere:typeEredienst <http://lblod.data.gift/concepts/9d8bd472a00bf0a5c7b7186606365a52> ; # Islamitisch
# regorg:orgStatus <http://lblod.data.gift/concepts/63cc561de9188d64ba5840a42ae8f0d6> . # Actief
#
# VALUES ?functie {
# <http://lblod.data.gift/concepts/e357bc8f4cc3a694fde2239748768a22> # Eerste Imam in rang
# <http://lblod.data.gift/concepts/c4a3fd586211b17b06f574885e23f355> # Tweede Imam in rang
# <http://lblod.data.gift/concepts/5ebb798bd59c3b48c25116032caa02b7> # 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 <http://mu.semte.ch/graphs/worship-service> {
# ?worshipService ere:wordtBediendDoor ?newMinisterPosition .
#
# ?newMinisterPosition a org:Post , ere:PositieBedienaar ;
# mu:uuid ?uuidNewMinisterPosition ;
# ere:functie <http://lblod.data.gift/concepts/7d8e0c15-7726-4196-9416-6dc40ed858bb> . # Waarnemende Imam
# }
#}
#WHERE {
# GRAPH <http://mu.semte.ch/graphs/worship-service> {
# ?worshipService a ere:BestuurVanDeEredienst ;
# ere:typeEredienst <http://lblod.data.gift/concepts/9d8bd472a00bf0a5c7b7186606365a52> ; # Islamitisch
# regorg:orgStatus <http://lblod.data.gift/concepts/abf4fee82019f88cf122f986830621ab> . # In Oprichting
#
# FILTER NOT EXISTS {
# ?worshipService ere:wordtBediendDoor ?ministerPosition .
# ?ministerPosition ere:functie <http://lblod.data.gift/concepts/7d8e0c15-7726-4196-9416-6dc40ed858bb> .
# }
#
# BIND(MD5(?worshipService) as ?uuidNewMinisterPosition)
# BIND(IRI(CONCAT("http://data.lblod.info/id/positiesBedienaar/", ?uuidNewMinisterPosition)) AS ?newMinisterPosition)
# }
#}
PREFIX ere: <http://data.lblod.info/vocabularies/erediensten/>
PREFIX mu: <http://mu.semte.ch/vocabularies/core/>
PREFIX org: <http://www.w3.org/ns/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 <http://mu.semte.ch/graphs/worship-service> {
?worshipService ere:wordtBediendDoor ?position .
?position ?p ?o .
}
}
WHERE {
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?worshipService a ere:BestuurVanDeEredienst ;
ere:typeEredienst <http://lblod.data.gift/concepts/9d8bd472a00bf0a5c7b7186606365a52> ; # Islamitisch
ere:wordtBediendDoor ?position .
?position ?p ?o ;
ere:functie ?functie .
{
SELECT ?worshipService ?functie (IRI(MIN(STR(?anyPosition))) AS ?keptPosition) WHERE {
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?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 <http://mu.semte.ch/graphs/worship-service> {
?worshipService ere:wordtBediendDoor ?newMinisterPosition .
?newMinisterPosition a org:Post , ere:PositieBedienaar ;
mu:uuid ?uuidNewMinisterPosition ;
ere:functie ?functie .
}
}
WHERE {
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?worshipService a ere:BestuurVanDeEredienst ;
ere:typeEredienst <http://lblod.data.gift/concepts/9d8bd472a00bf0a5c7b7186606365a52> . # Islamitisch
VALUES ?functie {
<http://lblod.data.gift/concepts/7d8e0c15-7726-4196-9416-6dc40ed858bb> # Waarnemende Imam
<http://lblod.data.gift/concepts/e357bc8f4cc3a694fde2239748768a22> # Eerste Imam in rang
<http://lblod.data.gift/concepts/c4a3fd586211b17b06f574885e23f355> # Tweede Imam in rang
<http://lblod.data.gift/concepts/5ebb798bd59c3b48c25116032caa02b7> # 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)
}
}

View File

@@ -0,0 +1,17 @@
PREFIX ere: <http://data.lblod.info/vocabularies/erediensten/>
INSERT DATA {
GRAPH <http://mu.semte.ch/graphs/public> {
<http://lblod.data.gift/concepts/7d8e0c15-7726-4196-9416-6dc40ed858bb> # Waarnemende Imam
ere:vanToepassingBijStatus <http://lblod.data.gift/concepts/abf4fee82019f88cf122f986830621ab> . # In Oprichting
<http://lblod.data.gift/concepts/e357bc8f4cc3a694fde2239748768a22> # Eerste Imam in rang
ere:vanToepassingBijStatus <http://lblod.data.gift/concepts/63cc561de9188d64ba5840a42ae8f0d6> . # Actief
<http://lblod.data.gift/concepts/c4a3fd586211b17b06f574885e23f355> # Tweede Imam in rang
ere:vanToepassingBijStatus <http://lblod.data.gift/concepts/63cc561de9188d64ba5840a42ae8f0d6> . # Actief
<http://lblod.data.gift/concepts/5ebb798bd59c3b48c25116032caa02b7> # Derde Imam in rang
ere:vanToepassingBijStatus <http://lblod.data.gift/concepts/63cc561de9188d64ba5840a42ae8f0d6> . # Actief
}
}

View File

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