Files
app-organization-portal/config/migrations-triggering-indexing/2025/20250429103515-remove-has-suborganization-from-inactive-ckb-deinze.sparql
Riad Abdallah eb7d8949cd Remove Active Organization from Inactive CKB Deinze
There is a 'double' instance of CKB Deinze in the database. One is active, and the other is inactive. This confuses systems, and it doesn't make sense that active organizations are linked (almost managed) by an inactive organization.

* Insert suborganization(s) belonging to non-active org to the active one
  * Insert new membership belonging to the suborganization(s) and active org
* Delete memberships for non-active org
2025-05-08 16:26:52 +02:00

56 lines
1.6 KiB
SPARQL

PREFIX org: <http://www.w3.org/ns/org#>
PREFIX mu: <http://mu.semte.ch/vocabularies/core/>
INSERT {
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?activeOrg
<http://www.w3.org/ns/org#hasSubOrganization> ?sub .
?membership a org:Membership ;
mu:uuid ?uuid ;
org:organization ?activeOrg ;
org:member ?sub ;
org:role <http://data.lblod.info/id/rollen/4ec7d5c39bdc4e84b4174379b9e22ad8> .
}
}
WHERE {
BIND(<http://data.lblod.info/id/centraleBesturenVanDeEredienst/643ddbd9448ca43828702527af7bfbb8> AS ?inactiveOrg)
BIND(<http://data.lblod.info/id/centraleBesturenVanDeEredienst/7f5475cfb202d12f54779f046441c9e1> AS ?activeOrg)
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?inactiveOrg
<http://www.w3.org/ns/org#hasSubOrganization> ?sub .
}
FILTER NOT EXISTS {
?activeOrg
<http://www.w3.org/ns/org#hasSubOrganization> ?sub .
}
BIND(SHA1(CONCAT(STR(?activeOrg), STR(?sub), "sub organization")) as ?uuid)
BIND(IRI(CONCAT("http://data.lblod.info/id/lidmaatschap/", ?uuid)) AS ?membership)
}
;
DELETE {
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?inactiveOrg
<http://www.w3.org/ns/org#hasSubOrganization> ?sub .
?membership ?membershipP ?membershipO .
}
}
WHERE {
BIND(<http://data.lblod.info/id/centraleBesturenVanDeEredienst/643ddbd9448ca43828702527af7bfbb8> AS ?inactiveOrg)
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?inactiveOrg
<http://www.w3.org/ns/org#hasSubOrganization> ?sub .
?membership a org:Membership ;
org:organization ?inactiveOrg ;
?membershipP ?membershipO .
}
}