OP-3851: added migrations that remove duplicate rechtswege/grote helft mandates from worship services within the same election cycle
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
- Keep werkingsgebied filter up to date via db-cleanup service [OP-3841]
|
||||
- Restrict available imam roles based on worship organisation status [DL-7485]
|
||||
- IMPORTANT NOTE: Make sure first the [DL-7485] loket migration has completed + data has flown from loket to OP
|
||||
- fix duplicate van rechtswege/grote helft mandates [OP-3851]
|
||||
- IMPORTANT NOTE: Make sure first the [OP-3851] loket migration has completed + data has flown from loket to OP
|
||||
|
||||
### Deploy notes
|
||||
```
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
# Delete duplicate van rechtswege mandaten per governing body
|
||||
# Must be run AFTER the corresponding loket migration
|
||||
|
||||
PREFIX ere: <http://data.lblod.info/vocabularies/erediensten/>
|
||||
PREFIX besluit: <http://data.vlaanderen.be/ns/besluit#>
|
||||
PREFIX org: <http://www.w3.org/ns/org#>
|
||||
PREFIX mandaat: <http://data.vlaanderen.be/ns/mandaat#>
|
||||
PREFIX generiek: <https://data.vlaanderen.be/ns/generiek#>
|
||||
|
||||
DELETE {
|
||||
GRAPH <http://mu.semte.ch/graphs/worship-service> {
|
||||
?orgaanInTime org:hasPost ?mandaat .
|
||||
?mandaat ?p ?o .
|
||||
}
|
||||
}
|
||||
INSERT {
|
||||
GRAPH <http://mu.semte.ch/graphs/worship-service> {
|
||||
?orgaanInTime org:hasPost ?canonicalMandaat .
|
||||
}
|
||||
}
|
||||
WHERE {
|
||||
GRAPH <http://mu.semte.ch/graphs/worship-service> {
|
||||
?worshipService a ere:BestuurVanDeEredienst .
|
||||
?orgaan besluit:bestuurt ?worshipService .
|
||||
?orgaanInTime generiek:isTijdspecialisatieVan ?orgaan ;
|
||||
org:hasPost ?mandaat .
|
||||
?mandaat org:role <http://data.vlaanderen.be/id/concept/BestuursfunctieCode/5972fccd87f864c4ec06bfbd20b5008b> ;
|
||||
?p ?o .
|
||||
|
||||
FILTER NOT EXISTS { ?holder org:holds ?mandaat . }
|
||||
}
|
||||
|
||||
{
|
||||
SELECT ?orgaan (IRI(MIN(STR(?anyMandaat))) AS ?canonicalMandaat) WHERE {
|
||||
GRAPH <http://mu.semte.ch/graphs/worship-service> {
|
||||
?anyOrgaanInTime generiek:isTijdspecialisatieVan ?orgaan ;
|
||||
org:hasPost ?anyMandaat .
|
||||
?anyMandaat org:role <http://data.vlaanderen.be/id/concept/BestuursfunctieCode/5972fccd87f864c4ec06bfbd20b5008b> .
|
||||
}
|
||||
}
|
||||
GROUP BY ?orgaan
|
||||
}
|
||||
|
||||
FILTER(?mandaat != ?canonicalMandaat)
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
# Delete duplicate grote helft mandaten within a single election cycle period
|
||||
# Must be run AFTER the corresponding loket migration
|
||||
|
||||
PREFIX ere: <http://data.lblod.info/vocabularies/erediensten/>
|
||||
PREFIX besluit: <http://data.vlaanderen.be/ns/besluit#>
|
||||
PREFIX org: <http://www.w3.org/ns/org#>
|
||||
PREFIX mandaat: <http://data.vlaanderen.be/ns/mandaat#>
|
||||
PREFIX generiek: <https://data.vlaanderen.be/ns/generiek#>
|
||||
|
||||
DELETE {
|
||||
GRAPH <http://mu.semte.ch/graphs/worship-service> {
|
||||
?orgaanInTime org:hasPost ?mandaat .
|
||||
?mandaat ?p ?o .
|
||||
}
|
||||
}
|
||||
INSERT {
|
||||
GRAPH <http://mu.semte.ch/graphs/worship-service> {
|
||||
?orgaanInTime org:hasPost ?canonicalMandaat .
|
||||
}
|
||||
}
|
||||
WHERE {
|
||||
GRAPH <http://mu.semte.ch/graphs/worship-service> {
|
||||
?worshipService a ere:BestuurVanDeEredienst .
|
||||
?orgaan besluit:bestuurt ?worshipService .
|
||||
?orgaanInTime generiek:isTijdspecialisatieVan ?orgaan ;
|
||||
mandaat:bindingStart ?start ;
|
||||
org:hasPost ?mandaat .
|
||||
?mandaat org:role <http://data.vlaanderen.be/id/concept/BestuursfunctieCode/a8b5509b-f86b-48f8-94d6-fe463a9b77e3> ;
|
||||
?p ?o .
|
||||
|
||||
FILTER NOT EXISTS { ?holder org:holds ?mandaat . }
|
||||
}
|
||||
|
||||
BIND(YEAR(?start) AS ?startYear)
|
||||
VALUES (?startYear ?pairIndex) {
|
||||
(2017 0)
|
||||
(2020 1)
|
||||
(2023 1)
|
||||
(2026 2)
|
||||
(2029 2)
|
||||
}
|
||||
|
||||
{
|
||||
SELECT ?orgaan ?pairIndex (IRI(MIN(STR(?anyMandaat))) AS ?canonicalMandaat) WHERE {
|
||||
GRAPH <http://mu.semte.ch/graphs/worship-service> {
|
||||
?anyOrgaanInTime generiek:isTijdspecialisatieVan ?orgaan ;
|
||||
mandaat:bindingStart ?anyStart ;
|
||||
org:hasPost ?anyMandaat .
|
||||
?anyMandaat org:role <http://data.vlaanderen.be/id/concept/BestuursfunctieCode/a8b5509b-f86b-48f8-94d6-fe463a9b77e3> .
|
||||
}
|
||||
|
||||
BIND(YEAR(?anyStart) AS ?anyStartYear)
|
||||
VALUES (?anyStartYear ?pairIndex) {
|
||||
(2017 0)
|
||||
(2020 1)
|
||||
(2023 1)
|
||||
(2026 2)
|
||||
(2029 2)
|
||||
}
|
||||
}
|
||||
GROUP BY ?orgaan ?pairIndex
|
||||
}
|
||||
|
||||
FILTER(?mandaat != ?canonicalMandaat)
|
||||
}
|
||||
Reference in New Issue
Block a user