diff --git a/config/migrations/2024/20241007091759-insert-memberships-merged-municipalities.sparql b/config/migrations/2024/20241007091759-insert-memberships-merged-municipalities.sparql new file mode 100644 index 0000000..9a10298 --- /dev/null +++ b/config/migrations/2024/20241007091759-insert-memberships-merged-municipalities.sparql @@ -0,0 +1,37 @@ +PREFIX org: +PREFIX mu: + +# Add the "has a relation with" membership between provinces and municipalities +# for the new municipalities that were added for the 2025 mergers. + +INSERT { + GRAPH { + ?membership a org:Membership ; + mu:uuid ?uuid ; + org:organization ?province ; + org:member ?municipality ; + org:role . # has a relation with + } +} WHERE { + GRAPH { + ?province org:hasSubOrganization ?municipality . + FILTER (?province IN + ( + , # Oost-Vlaanderen + , # Vlaams-Brabant + , # Limburg + , # Antwerpen + # 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 { + # Beveren-Kruibeke-Zwijndrecht + # Merelbeke-Melle + # Nazareth-De Pinte + # Pajottegem + } +} diff --git a/config/migrations/2024/20241007094811-insert-membership-new-district-borsbeek.sparql b/config/migrations/2024/20241007094811-insert-membership-new-district-borsbeek.sparql new file mode 100644 index 0000000..29ebfb0 --- /dev/null +++ b/config/migrations/2024/20241007094811-insert-membership-new-district-borsbeek.sparql @@ -0,0 +1,22 @@ +PREFIX org: +PREFIX mu: + +INSERT { + GRAPH { + ?membership a org:Membership ; + mu:uuid ?uuid ; + org:organization ?antwerp ; + org:member ?borsbeek ; + org:role . # has a relation with + } +} WHERE { + GRAPH { + ?antwerp org:hasSubOrganization ?borsbeek . + + FILTER (?antwerp = ) + FILTER (?borsbeek = ) + } + + 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) +} diff --git a/config/migrations/2024/20241007100727-insert-memberships-merged-ocmw.sparql b/config/migrations/2024/20241007100727-insert-memberships-merged-ocmw.sparql new file mode 100644 index 0000000..951fecf --- /dev/null +++ b/config/migrations/2024/20241007100727-insert-memberships-merged-ocmw.sparql @@ -0,0 +1,105 @@ +PREFIX org: +PREFIX mu: + +# Add the "has a relation with" membership between provinces and the new OCMWs +# added for the 2025 mergers. +INSERT { + GRAPH { + ?membership a org:Membership ; + mu:uuid ?uuid ; + org:organization ?province ; + org:member ?ocmw ; + org:role . # has a relation with + } +} WHERE { + GRAPH { + ?province org:hasSubOrganization ?ocmw . + FILTER (?province IN + ( + , # Oost-Vlaanderen + , # Vlaams-Brabant + , # Limburg + , # Antwerpen + # 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 { + # Beveren-Kruibeke-Zwijndrecht + # Merelbeke-Melle + # Nazareth-De Pinte + # Pajottegem + } +} +; +# Relate OCMWs with their municipalities +## Beveren-Kruibeke-Zwijndrecht +### Municipality: +### OCMW: +INSERT { + GRAPH { + org:linkedTo . + ?membership a org:Membership ; + mu:uuid ?uuid ; + org:organization ; + org:member ; + org:role . # has a relation with + } +} WHERE { + BIND (SHA256(CONCAT(STR(), "has a relation with", STR())) AS ?uuid) + BIND (IRI(CONCAT("http://data.lblod.info/id/lidmaatschap/", ?uuid)) AS ?membership) +} +; +## Merelbeke-Melle +### Municipality: +### OCMW: +INSERT { + GRAPH { + org:linkedTo . + ?membership a org:Membership ; + mu:uuid ?uuid ; + org:organization ; + org:member ; + org:role . # has a relation with + } +} WHERE { + BIND (SHA256(CONCAT(STR(), "has a relation with", STR())) AS ?uuid) + BIND (IRI(CONCAT("http://data.lblod.info/id/lidmaatschap/", ?uuid)) AS ?membership) +} +; +## Nazareth-De Pinte +### Municipality: +### OCMW: +INSERT { + GRAPH { + org:linkedTo . + ?membership a org:Membership ; + mu:uuid ?uuid ; + org:organization ; + org:member ; + org:role . # has a relation with + } +} WHERE { + BIND (SHA256(CONCAT(STR(), "has a relation with", STR())) AS ?uuid) + BIND (IRI(CONCAT("http://data.lblod.info/id/lidmaatschap/", ?uuid)) AS ?membership) +} +; +## Pajottegem +### Municipality: +### OCMW: +INSERT { + GRAPH { + org:linkedTo . + ?membership a org:Membership ; + mu:uuid ?uuid ; + org:organization ; + org:member ; + org:role . # has a relation with + } +} WHERE { + BIND (SHA256(CONCAT(STR(), "has a relation with", STR())) AS ?uuid) + BIND (IRI(CONCAT("http://data.lblod.info/id/lidmaatschap/", ?uuid)) AS ?membership) +}