Merge pull request #396 from lblod/chore/add-merge-change-event-pz-aalter-maldegem

Feature: add merge change event pz aalter maldegem
This commit is contained in:
Alexander van den Berghe
2024-03-22 13:55:37 +00:00
committed by GitHub

View File

@@ -0,0 +1,73 @@
PREFIX org: <http://www.w3.org/ns/org#>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX ch: <http://data.lblod.info/vocabularies/contacthub/>
PREFIX lblodOrg: <http://lblod.data.gift/vocabularies/organisatie/>
PREFIX ext: <http://mu.semte.ch/vocabularies/ext/>
PREFIX mu: <http://mu.semte.ch/vocabularies/core/>
PREFIX regorg: <http://www.w3.org/ns/regorg#>
# Add fusion change event
INSERT {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?changeEvent a org:ChangeEvent ;
mu:uuid ?uuidChangeEvent ;
ch:typeWijziging <http://lblod.data.gift/concepts/fa80032794c841ecac73ff874f856db1> ; # Fusie
org:resultingOrganization ?resultingOrganisation ;
dct:date "2024-01-01"^^xsd:date ;
dct:description "Fusie tussen PZ Aalter en PZ Maldegem resulteert in PZ Aalter/Maldegem" ;
org:originalOrganization ?originalAalter ;
org:originalOrganization ?originalMaldegem ;
lblodOrg:veranderingsgebeurtenisResultaat ?changeEventFirstNotActiveResult ;
lblodOrg:veranderingsgebeurtenisResultaat ?changeEventSecondNotActiveResult ;
lblodOrg:veranderingsgebeurtenisResultaat ?changeEventActiveResult .
?changeEventFirstNotActiveResult a lblodOrg:VeranderingsgebeurtenisResultaat ;
mu:uuid ?uuidChangeEventFirstNotActiveResult ;
lblodOrg:resulterendeStatus <http://lblod.data.gift/concepts/d02c4e12bf88d2fdf5123b07f29c9311> ; # not active
ext:resultingOrganization ?originalAalter .
?changeEventSecondNotActiveResult a lblodOrg:VeranderingsgebeurtenisResultaat ;
mu:uuid ?uuidChangeEventSecondNotActiveResult ;
lblodOrg:resulterendeStatus <http://lblod.data.gift/concepts/d02c4e12bf88d2fdf5123b07f29c9311> ; # not active
ext:resultingOrganization ?originalMaldegem .
?changeEventActiveResult a lblodOrg:VeranderingsgebeurtenisResultaat ;
mu:uuid ?uuidChangeEventActiveResult ;
lblodOrg:resulterendeStatus <http://lblod.data.gift/concepts/63cc561de9188d64ba5840a42ae8f0d6> ; # active
ext:resultingOrganization ?resultingOrganisation .
}
} WHERE {
VALUES (?originalAalter ?originalMaldegem ?resultingOrganisation) {
(<http://data.lblod.info/id/bestuurseenheden/e06ce64825e386178b350aa6b2fa869c70ad39aa99ddb3ca2a73d6b103e91161>
<http://data.lblod.info/id/bestuurseenheden/3b7a6d691943806c23f59d22482dea27e451bd440f91f884aeb42e8c72016ee3>
<http://data.lblod.info/id/bestuurseenheden/65EB0324E77A4F2289F6B63D>)
}
BIND(SHA256(CONCAT(STR(?originalAalter), STR(?originalMaldegem), STR(?resultingOrganization))) AS ?uuidChangeEvent) .
BIND(IRI(CONCAT("http://data.lblod.info/id/veranderingsgebeurtenissen/", STR(?uuidChangeEvent))) AS ?changeEvent) .
BIND(SHA256(CONCAT(STR(?originalAalter), "fusieChangeEventFirstNotActiveResult")) AS ?uuidChangeEventFirstNotActiveResult) .
BIND(IRI(CONCAT("http://lblod.data.info/id/veranderingsgebeurtenis-resultaten/", STR(?uuidChangeEventFirstNotActiveResult))) AS ?changeEventFirstNotActiveResult) .
BIND(SHA256(CONCAT(STR(?originalMaldegem), "fusieChangeEventSecondNotActiveResult")) AS ?uuidChangeEventSecondNotActiveResult) .
BIND(IRI(CONCAT("http://lblod.data.info/id/veranderingsgebeurtenis-resultaten/", STR(?uuidChangeEventSecondNotActiveResult))) AS ?changeEventSecondNotActiveResult) .
BIND(SHA256(CONCAT(STR(?originalAalter), STR(?originalMaldegem), STR(?resultingOrganization), "fusieChangeEventActiveResult")) AS ?uuidChangeEventActiveResult) .
BIND(IRI(CONCAT("http://lblod.data.info/id/veranderingsgebeurtenis-resultaten/", STR(?uuidChangeEventActiveResult))) AS ?changeEventActiveResult) .
}
;
# Set merged PZs to not active
DELETE {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?s regorg:orgStatus <http://lblod.data.gift/concepts/63cc561de9188d64ba5840a42ae8f0d6> # Active
}
} INSERT {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?s regorg:orgStatus <http://lblod.data.gift/concepts/d02c4e12bf88d2fdf5123b07f29c9311> # Not active
}
} WHERE {
VALUES ?s {
<http://data.lblod.info/id/bestuurseenheden/e06ce64825e386178b350aa6b2fa869c70ad39aa99ddb3ca2a73d6b103e91161> # PZ Aalter
<http://data.lblod.info/id/bestuurseenheden/3b7a6d691943806c23f59d22482dea27e451bd440f91f884aeb42e8c72016ee3> #PZ Maldegem
}
}