66 lines
1.9 KiB
SPARQL
66 lines
1.9 KiB
SPARQL
# 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)
|
|
}
|