DL-7485: draft version imam migration
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -0,0 +1,220 @@
|
||||
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 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 <http://mu.semte.ch/graphs/worship-service> {
|
||||
?minister org:holds ?position .
|
||||
}
|
||||
}
|
||||
INSERT {
|
||||
GRAPH <http://mu.semte.ch/graphs/worship-service> {
|
||||
?minister org:holds ?keptPosition .
|
||||
}
|
||||
}
|
||||
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 ere:functie ?functie .
|
||||
?minister org:holds ?position .
|
||||
|
||||
{
|
||||
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)
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
# 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 <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. 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 <http://mu.semte.ch/graphs/worship-service> {
|
||||
# ?worshipService ere:wordtBediendDoor ?position .
|
||||
# ?position ?p ?o .
|
||||
# ?minister ?mp ?mo .
|
||||
# ?condition ?cp ?co .
|
||||
# }
|
||||
#}
|
||||
#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
|
||||
# }
|
||||
#
|
||||
# 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 <http://mu.semte.ch/graphs/worship-service> {
|
||||
# ?worshipService ere:wordtBediendDoor ?position .
|
||||
# ?position ?p ?o .
|
||||
# ?minister ?mp ?mo .
|
||||
# ?condition ?cp ?co .
|
||||
# }
|
||||
#}
|
||||
#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
|
||||
#
|
||||
# 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 <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).
|
||||
#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)
|
||||
# }
|
||||
#}
|
||||
Reference in New Issue
Block a user