Merge pull request #619 from lblod/OP-3851-migration-to-fix-duplicate-worship-service-mandates
OP-3851: added migrations that remove duplicate rechtswege/grote helf…
This commit is contained in:
@@ -28,7 +28,9 @@
|
|||||||
- Frontend [v1.41.1](https://github.com/lblod/frontend-organization-portal/blob/v1.41.1/CHANGELOG.md) [DL-7438]
|
- Frontend [v1.41.1](https://github.com/lblod/frontend-organization-portal/blob/v1.41.1/CHANGELOG.md) [DL-7438]
|
||||||
- Fix broken lmb mandataris mappin query [OP-3867]
|
- Fix broken lmb mandataris mappin query [OP-3867]
|
||||||
- Add the value politiecollege to the existing dropdown list beslissingsorgaan [DL-7473]
|
- Add the value politiecollege to the existing dropdown list beslissingsorgaan [DL-7473]
|
||||||
- Bump construct-organization-relationships [DL-7473]
|
- Bump construct-organization-relationships [DL-7473] [OP-3851]
|
||||||
|
- fix duplicate van rechtswege/grote helft mandates [OP-3851]
|
||||||
|
- IMPORTANT NOTE: Make sure first the loket migration has completed + data has flown from loket to OP
|
||||||
|
|
||||||
### Deploy notes
|
### 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