feat: add memberships for new organizations

Add the migrations to create the necessary memberships for the newly added
municipalities and OCMWs. These new organizations were added as part of a hotfix
after the memberships were added to development. Consequently, the migrations
inserting these organizations are performed **after** the migrations introducing
membership data. Therefore, we need to add some additional migrations
specifically for these new organizations.
This commit is contained in:
mirdono
2024-10-07 13:08:10 +02:00
committed by Alexander van den Berghe
parent 2ed45e3a5e
commit 64f78722d9
3 changed files with 164 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
PREFIX org: <http://www.w3.org/ns/org#>
PREFIX mu: <http://mu.semte.ch/vocabularies/core/>
# Add the "has a relation with" membership between provinces and municipalities
# for the new municipalities that were added for the 2025 mergers.
INSERT {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?membership a org:Membership ;
mu:uuid ?uuid ;
org:organization ?province ;
org:member ?municipality ;
org:role <http://data.lblod.info/id/rollen/4ec7d5c39bdc4e84b4174379b9e22ad8> . # has a relation with
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?province org:hasSubOrganization ?municipality .
FILTER (?province IN
(
<http://data.lblod.info/id/bestuurseenheden/298b13541e1e85de4b71535197aa1f3bbc4bdb67f0fe0f58ab4a7dc207af61fa> , # Oost-Vlaanderen
<http://data.lblod.info/id/bestuurseenheden/8b7e7bf05ace5bb1a68f5bc0d870e20c20f147b00bd9a3dcce3a01733d4da744> , # Vlaams-Brabant
<http://data.lblod.info/id/bestuurseenheden/14278813524c762255aeba149e7d7134ddecfbb43e7d56910731bd4e13e34f39> , # Limburg
<http://data.lblod.info/id/bestuurseenheden/bd74ee38a4b1e296821a11729c1f704cf439576c7ab2c910c95b067cf183d923> , # Antwerpen
<http://data.lblod.info/id/bestuurseenheden/8152e68420f560b8493d6c555a5bd4186903dc341028bb9855af6c44a9464fea> # West-Vlaanderen
)
)
}
BIND (SHA256(CONCAT(STR(?province), " has a relation with ", STR(?municipality))) AS ?uuid)
BIND (IRI(CONCAT("http://data.lblod.info/id/lidmaatschap/", ?uuid)) AS ?membership)
VALUES ?municipality {
<http://data.lblod.info/id/bestuurseenheden/19483103-318e-435a-aa37-45e485406ee9> # Beveren-Kruibeke-Zwijndrecht
<http://data.lblod.info/id/bestuurseenheden/b8bb293d-aa22-4b43-bda4-0b6af76e9493> # Merelbeke-Melle
<http://data.lblod.info/id/bestuurseenheden/1ca65d65-54ff-4b44-b750-bd70c91191af> # Nazareth-De Pinte
<http://data.lblod.info/id/bestuurseenheden/add1e4eb-9ec7-4ea6-af82-335aa76b7d48> # Pajottegem
}
}

View File

@@ -0,0 +1,22 @@
PREFIX org: <http://www.w3.org/ns/org#>
PREFIX mu: <http://mu.semte.ch/vocabularies/core/>
INSERT {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?membership a org:Membership ;
mu:uuid ?uuid ;
org:organization ?antwerp ;
org:member ?borsbeek ;
org:role <http://data.lblod.info/id/rollen/4ec7d5c39bdc4e84b4174379b9e22ad8> . # has a relation with
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?antwerp org:hasSubOrganization ?borsbeek .
FILTER (?antwerp = <http://data.lblod.info/id/bestuurseenheden/670db1d66c0de3b931962e1044033ccfa9d6e3023aa9828a5f252c3bc69bd32c>)
FILTER (?borsbeek = <http://data.lblod.info/id/bestuurseenheden/4b44e6f1-113b-4692-b149-44a889b215f2>)
}
BIND (SHA256(CONCAT(STR(?antwerp), " has a relation with ", STR(?borsbeek))) AS ?uuid)
BIND (IRI(CONCAT("http://data.lblod.info/id/lidmaatschap/", ?uuid)) AS ?membership)
}

View File

@@ -0,0 +1,105 @@
PREFIX org: <http://www.w3.org/ns/org#>
PREFIX mu: <http://mu.semte.ch/vocabularies/core/>
# Add the "has a relation with" membership between provinces and the new OCMWs
# added for the 2025 mergers.
INSERT {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?membership a org:Membership ;
mu:uuid ?uuid ;
org:organization ?province ;
org:member ?ocmw ;
org:role <http://data.lblod.info/id/rollen/4ec7d5c39bdc4e84b4174379b9e22ad8> . # has a relation with
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?province org:hasSubOrganization ?ocmw .
FILTER (?province IN
(
<http://data.lblod.info/id/bestuurseenheden/298b13541e1e85de4b71535197aa1f3bbc4bdb67f0fe0f58ab4a7dc207af61fa> , # Oost-Vlaanderen
<http://data.lblod.info/id/bestuurseenheden/8b7e7bf05ace5bb1a68f5bc0d870e20c20f147b00bd9a3dcce3a01733d4da744> , # Vlaams-Brabant
<http://data.lblod.info/id/bestuurseenheden/14278813524c762255aeba149e7d7134ddecfbb43e7d56910731bd4e13e34f39> , # Limburg
<http://data.lblod.info/id/bestuurseenheden/bd74ee38a4b1e296821a11729c1f704cf439576c7ab2c910c95b067cf183d923> , # Antwerpen
<http://data.lblod.info/id/bestuurseenheden/8152e68420f560b8493d6c555a5bd4186903dc341028bb9855af6c44a9464fea> # West-Vlaanderen
)
)
}
BIND (SHA256(CONCAT(STR(?province), " has a relation with ", STR(?ocmw))) AS ?uuid)
BIND (IRI(CONCAT("http://data.lblod.info/id/lidmaatschap/", ?uuid)) AS ?membership)
VALUES ?ocmw {
<http://data.lblod.info/id/bestuurseenheden/fd41f573-7d9a-4d9f-b7d0-d5b6114d1622> # Beveren-Kruibeke-Zwijndrecht
<http://data.lblod.info/id/bestuurseenheden/5d94b2fd-60ee-4e56-a1f0-a586d596adf6> # Merelbeke-Melle
<http://data.lblod.info/id/bestuurseenheden/7d53f659-3a3b-44b1-9e77-3ea067678c0e> # Nazareth-De Pinte
<http://data.lblod.info/id/bestuurseenheden/650378e7-1bee-4737-91ff-5b20ac4623cf> # Pajottegem
}
}
;
# Relate OCMWs with their municipalities
## Beveren-Kruibeke-Zwijndrecht
### Municipality: <http://data.lblod.info/id/bestuurseenheden/19483103-318e-435a-aa37-45e485406ee9>
### OCMW: <http://data.lblod.info/id/bestuurseenheden/fd41f573-7d9a-4d9f-b7d0-d5b6114d1622>
INSERT {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
<http://data.lblod.info/id/bestuurseenheden/19483103-318e-435a-aa37-45e485406ee9> org:linkedTo <http://data.lblod.info/id/bestuurseenheden/fd41f573-7d9a-4d9f-b7d0-d5b6114d1622> .
?membership a org:Membership ;
mu:uuid ?uuid ;
org:organization <http://data.lblod.info/id/bestuurseenheden/19483103-318e-435a-aa37-45e485406ee9> ;
org:member <http://data.lblod.info/id/bestuurseenheden/fd41f573-7d9a-4d9f-b7d0-d5b6114d1622> ;
org:role <http://data.lblod.info/id/rollen/4ec7d5c39bdc4e84b4174379b9e22ad8> . # has a relation with
}
} WHERE {
BIND (SHA256(CONCAT(STR(<http://data.lblod.info/id/bestuurseenheden/19483103-318e-435a-aa37-45e485406ee9>), "has a relation with", STR(<http://data.lblod.info/id/bestuurseenheden/fd41f573-7d9a-4d9f-b7d0-d5b6114d1622>))) AS ?uuid)
BIND (IRI(CONCAT("http://data.lblod.info/id/lidmaatschap/", ?uuid)) AS ?membership)
}
;
## Merelbeke-Melle
### Municipality: <http://data.lblod.info/id/bestuurseenheden/b8bb293d-aa22-4b43-bda4-0b6af76e9493>
### OCMW: <http://data.lblod.info/id/bestuurseenheden/5d94b2fd-60ee-4e56-a1f0-a586d596adf6>
INSERT {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
<http://data.lblod.info/id/bestuurseenheden/b8bb293d-aa22-4b43-bda4-0b6af76e9493> org:linkedTo <http://data.lblod.info/id/bestuurseenheden/5d94b2fd-60ee-4e56-a1f0-a586d596adf6> .
?membership a org:Membership ;
mu:uuid ?uuid ;
org:organization <http://data.lblod.info/id/bestuurseenheden/b8bb293d-aa22-4b43-bda4-0b6af76e9493> ;
org:member <http://data.lblod.info/id/bestuurseenheden/5d94b2fd-60ee-4e56-a1f0-a586d596adf6> ;
org:role <http://data.lblod.info/id/rollen/4ec7d5c39bdc4e84b4174379b9e22ad8> . # has a relation with
}
} WHERE {
BIND (SHA256(CONCAT(STR(<http://data.lblod.info/id/bestuurseenheden/b8bb293d-aa22-4b43-bda4-0b6af76e9493>), "has a relation with", STR(<http://data.lblod.info/id/bestuurseenheden/5d94b2fd-60ee-4e56-a1f0-a586d596adf6>))) AS ?uuid)
BIND (IRI(CONCAT("http://data.lblod.info/id/lidmaatschap/", ?uuid)) AS ?membership)
}
;
## Nazareth-De Pinte
### Municipality: <http://data.lblod.info/id/bestuurseenheden/1ca65d65-54ff-4b44-b750-bd70c91191af>
### OCMW: <http://data.lblod.info/id/bestuurseenheden/7d53f659-3a3b-44b1-9e77-3ea067678c0e>
INSERT {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
<http://data.lblod.info/id/bestuurseenheden/1ca65d65-54ff-4b44-b750-bd70c91191af> org:linkedTo <http://data.lblod.info/id/bestuurseenheden/7d53f659-3a3b-44b1-9e77-3ea067678c0e> .
?membership a org:Membership ;
mu:uuid ?uuid ;
org:organization <http://data.lblod.info/id/bestuurseenheden/1ca65d65-54ff-4b44-b750-bd70c91191af> ;
org:member <http://data.lblod.info/id/bestuurseenheden/7d53f659-3a3b-44b1-9e77-3ea067678c0e> ;
org:role <http://data.lblod.info/id/rollen/4ec7d5c39bdc4e84b4174379b9e22ad8> . # has a relation with
}
} WHERE {
BIND (SHA256(CONCAT(STR(<http://data.lblod.info/id/bestuurseenheden/1ca65d65-54ff-4b44-b750-bd70c91191af>), "has a relation with", STR(<http://data.lblod.info/id/bestuurseenheden/7d53f659-3a3b-44b1-9e77-3ea067678c0e>))) AS ?uuid)
BIND (IRI(CONCAT("http://data.lblod.info/id/lidmaatschap/", ?uuid)) AS ?membership)
}
;
## Pajottegem
### Municipality: <http://data.lblod.info/id/bestuurseenheden/add1e4eb-9ec7-4ea6-af82-335aa76b7d48>
### OCMW: <http://data.lblod.info/id/bestuurseenheden/650378e7-1bee-4737-91ff-5b20ac4623cf>
INSERT {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
<http://data.lblod.info/id/bestuurseenheden/add1e4eb-9ec7-4ea6-af82-335aa76b7d48> org:linkedTo <http://data.lblod.info/id/bestuurseenheden/650378e7-1bee-4737-91ff-5b20ac4623cf> .
?membership a org:Membership ;
mu:uuid ?uuid ;
org:organization <http://data.lblod.info/id/bestuurseenheden/add1e4eb-9ec7-4ea6-af82-335aa76b7d48> ;
org:member <http://data.lblod.info/id/bestuurseenheden/650378e7-1bee-4737-91ff-5b20ac4623cf> ;
org:role <http://data.lblod.info/id/rollen/4ec7d5c39bdc4e84b4174379b9e22ad8> . # has a relation with
}
} WHERE {
BIND (SHA256(CONCAT(STR(<http://data.lblod.info/id/bestuurseenheden/add1e4eb-9ec7-4ea6-af82-335aa76b7d48>), "has a relation with", STR(<http://data.lblod.info/id/bestuurseenheden/650378e7-1bee-4737-91ff-5b20ac4623cf>))) AS ?uuid)
BIND (IRI(CONCAT("http://data.lblod.info/id/lidmaatschap/", ?uuid)) AS ?membership)
}