feat: add cleanup jobs to delete triples

When removing memberships some `org:hasSubOrganization` or `org:linkedTo`
triples may remain in the triplestore. These migrations add jobs to delete such triples.
This commit is contained in:
mirdono
2024-10-02 19:10:18 +02:00
committed by Alexander van den Berghe
parent 7da8ebb695
commit e3ec21eb71
11 changed files with 180 additions and 1 deletions

View File

@@ -27,9 +27,10 @@
?member org:classification ?memberClass .
FILTER ( ?memberClass
IN (
<http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/36a82ba0-7ff1-4697-a9dd-2e94df73b721> ,
<http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/5ab0e9b8a3b2ca7c5e000001> ,
<http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/5ab0e9b8a3b2ca7c5e000002> ,
<http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/36a82ba0-7ff1-4697-a9dd-2e94df73b721> ,
<http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/80310756-ce0a-4a1b-9b8e-7c01b6cc7a2d> ,
<http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/2ad46df5-5c79-4d67-84d5-604c1377231e> ,
<http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/088784b6-e188-48bf-b94f-94665f9e1f53>
)

View File

@@ -0,0 +1,34 @@
@prefix cleanup: <http://mu.semte.ch/vocabularies/ext/cleanup/> .
@prefix mu: <http://mu.semte.ch/vocabularies/core/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
<http://data.lblod.info/id/cleanup-job/679eec55-0f69-4d45-84c1-9f73df966983> a cleanup:Job ;
mu:uuid "679eec55-0f69-4d45-84c1-9f73df966983" ;
dcterms:title "Delete leftover `org:linkedTo` triples for Representative Bodies and [Central] Worship Services." ;
cleanup:randomQuery """
PREFIX org: <http://www.w3.org/ns/org#>
DELETE {
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?s org:linkedTo ?o .
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?s org:linkedTo ?o .
FILTER NOT EXISTS {
?membership a org:Membership ;
org:organization ?o ;
org:member ?s ;
org:role <http://data.lblod.info/id/rollen/4ec7d5c39bdc4e84b4174379b9e22ad8> .
}
?s org:classification <http://data.vlaanderen.be/id/concept/RepresentatiefOrgaanClassificatieCode/89a00b5a-024f-4630-a722-65a5e68967e5> .
?o org:classification ?oClass .
FILTER ( ?oClass IN (
<http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/66ec74fd-8cfc-4e16-99c6-350b35012e86> ,
<http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/f9cac08a-13c1-49da-9bcb-f650b0604054>
))
}
}
""" .

View File

@@ -0,0 +1,29 @@
@prefix cleanup: <http://mu.semte.ch/vocabularies/ext/cleanup/> .
@prefix mu: <http://mu.semte.ch/vocabularies/core/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
<http://data.lblod.info/id/cleanup-job/50cee254-37e4-410e-936a-d974047bdd4b> a cleanup:Job ;
mu:uuid "50cee254-37e4-410e-936a-d974047bdd4b" ;
dcterms:title "Delete leftover `org:hasSubOrganization` triples for Central Worship Services and Worship Services." ;
cleanup:randomQuery """
PREFIX org: <http://www.w3.org/ns/org#>
DELETE {
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?cws org:hasSubOrganization ?ws .
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?cws org:hasSubOrganization ?ws .
FILTER NOT EXISTS {
?membership a org:Membership ;
org:organization ?cws ;
org:member ?ws ;
org:role <http://data.lblod.info/id/rollen/4ec7d5c39bdc4e84b4174379b9e22ad8> .
}
?cws org:classification <http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/f9cac08a-13c1-49da-9bcb-f650b0604054> .
?ws org:classification <http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/66ec74fd-8cfc-4e16-99c6-350b35012e86> .
}
}
""" .

View File

@@ -0,0 +1,26 @@
@prefix cleanup: <http://mu.semte.ch/vocabularies/ext/cleanup/> .
@prefix mu: <http://mu.semte.ch/vocabularies/core/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
<http://data.lblod.info/id/cleanup-job/14cfd05c-7047-43a1-97e4-42d3dd6b048d> a cleanup:Job ;
mu:uuid "14cfd05c-7047-43a1-97e4-42d3dd6b048d" ;
dcterms:title "Delete leftover `org:linkedTo` triples for Municipalities." ;
cleanup:randomQuery """
PREFIX org: <http://www.w3.org/ns/org#>
DELETE {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?municipality org:linkedTo ?member .
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?municipality org:linkedTo ?member .
FILTER NOT EXISTS {
?membership a org:Membership ;
org:organization ?municipality ;
org:member ?member ;
org:role <http://data.lblod.info/id/rollen/4ec7d5c39bdc4e84b4174379b9e22ad8> .
}
}
}
""" .

View File

@@ -0,0 +1,43 @@
@prefix cleanup: <http://mu.semte.ch/vocabularies/ext/cleanup/> .
@prefix mu: <http://mu.semte.ch/vocabularies/core/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
<http://data.lblod.info/id/cleanup-job/141a5f1c-39d5-431a-99e2-9085252654a3> a cleanup:Job ;
mu:uuid "141a5f1c-39d5-431a-99e2-9085252654a3" ;
dcterms:title "Delete leftover `org:hasSubOrganization` triples for Municipalities." ;
cleanup:randomQuery """
PREFIX org: <http://www.w3.org/ns/org#>
DELETE {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?municipality org:hasSubOrganization ?member .
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?municipality org:hasSubOrganization ?member .
FILTER NOT EXISTS {
?membership a org:Membership ;
org:organization ?municipality ;
org:member ?member ;
org:role <http://data.lblod.info/id/rollen/4ec7d5c39bdc4e84b4174379b9e22ad8> .
}
?member org:classification ?memberClass .
FILTER ( ?memberClass
IN (
<http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/36a82ba0-7ff1-4697-a9dd-2e94df73b721> ,
<http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/b156b67f-c5f4-4584-9b30-4c090be02fdc> ,
<http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/d01bb1f6-2439-4e33-9c25-1fc295de2e71> ,
<http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/cd93f147-3ece-4308-acab-5c5ada3ec63d> ,
<http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/4b8450cf-a326-4c66-9e63-b4ec10acc7f6> ,
<http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/ea446861-2c51-45fa-afd3-4e4a37b71562> ,
<http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/a3922c6d-425b-474f-9a02-ffb71a436bfc> ,
<http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/2ad46df5-5c79-4d67-84d5-604c1377231e>
)
)
}
GRAPH <http://mu.semte.ch/graphs/shared> {
?municipality org:classification <http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/5ab0e9b8a3b2ca7c5e000001> .
}
}
""" .

View File

@@ -0,0 +1,41 @@
@prefix cleanup: <http://mu.semte.ch/vocabularies/ext/cleanup/> .
@prefix mu: <http://mu.semte.ch/vocabularies/core/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
<http://data.lblod.info/id/cleanup-job/7b2f66c8-1433-47f4-b730-62316f288631> a cleanup:Job ;
mu:uuid "7b2f66c8-1433-47f4-b730-62316f288631" ;
dcterms:title "Delete leftover `org:hasSubOrganization` triples for Provinces." ;
cleanup:randomQuery """
PREFIX org: <http://www.w3.org/ns/org#>
DELETE {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?province org:hasSubOrganization ?member .
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?province org:hasSubOrganization ?member .
FILTER NOT EXISTS {
?membership a org:Membership ;
org:organization ?province ;
org:member ?member ;
org:role <http://data.lblod.info/id/rollen/4ec7d5c39bdc4e84b4174379b9e22ad8> .
}
}
?member org:classification ?memberClass .
FILTER ( ?memberClass
IN (
<http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/5ab0e9b8a3b2ca7c5e000001> ,
<http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/5ab0e9b8a3b2ca7c5e000002> ,
<http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/36a82ba0-7ff1-4697-a9dd-2e94df73b721> ,
<http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/80310756-ce0a-4a1b-9b8e-7c01b6cc7a2d> ,
<http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/2ad46df5-5c79-4d67-84d5-604c1377231e> ,
<http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/088784b6-e188-48bf-b94f-94665f9e1f53>
)
)
GRAPH <http://mu.semte.ch/graphs/shared> {
?province org:classification <http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/5ab0e9b8a3b2ca7c5e000000> .
}
}
""" .