diff --git a/CHANGELOG.md b/CHANGELOG.md index 4744b29..cadb2f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Add a service to manage organisation's their scope of operation [OP-3205] - datamodel: Allow a location to be within multiple other locations [OP-3205] - datafix: set scope of operation for worship administrative units [OP-3626] +- Clean addresses linked to both sites and contact points of mandatarissen and addresses that are in the wrong graph (admin unit graph but linked to a contact point in the worship graph) [DL-6701] - datafix: cleanup of general memberships if specific ones exist [OP-3640] ### Deploy notes ``` @@ -33,7 +34,6 @@ drc restart migrations; drc logs -ft --tail=200 migrations - Add URI to resource's organization responses - Fix query for organizations report [OP-3636] - Bump report-generation-service to most recent version -- Write migration to harmonize date formats of change events [OP-3559] ### Deploy notes ``` drc pull deltanotifier; drc up -d deltanotifier diff --git a/config/migrations/2025/20250708142100-fix-same-address-linked-to-both-site-and-contact-point.sparql b/config/migrations/2025/20250708142100-fix-same-address-linked-to-both-site-and-contact-point.sparql new file mode 100644 index 0000000..bbd4003 --- /dev/null +++ b/config/migrations/2025/20250708142100-fix-same-address-linked-to-both-site-and-contact-point.sparql @@ -0,0 +1,30 @@ +DELETE { + GRAPH ?h { + ?site ?oldAddressUri . + } +} INSERT { + GRAPH ?g { + ?newAddressUri a ; + ?newAddressUuid ; + ?p ?o . + + ?site ?newAddressUri . + } +} WHERE { + GRAPH ?g { + ?oldAddressUri a ; + ?p ?o . + + FILTER (?p NOT IN ()) + } + + ?mandatarisContact ?oldAddressUri . + + GRAPH ?h { + ?site a ; + ?oldAddressUri . + } + + BIND(MD5(CONCAT(?oldAddressUri,"NEW_ADDRESS")) AS ?newAddressUuid) . + BIND(IRI(CONCAT("http://data.lblod.info/id/adressen/", STR(?newAddressUuid))) AS ?newAddressUri) . +} diff --git a/config/migrations/2025/20250722114200-fix-contact-addresses-being-in-wrong-graph.sparql b/config/migrations/2025/20250722114200-fix-contact-addresses-being-in-wrong-graph.sparql new file mode 100644 index 0000000..d91d279 --- /dev/null +++ b/config/migrations/2025/20250722114200-fix-contact-addresses-being-in-wrong-graph.sparql @@ -0,0 +1,18 @@ +DELETE { + GRAPH { + ?address ?p ?o . + } +} INSERT { + GRAPH { + ?address ?p ?o . + } +} WHERE { + GRAPH { + ?contactPoint a ; + ?address . + } + + GRAPH { + ?address ?p ?o . + } +}