From ab12f4e15bca4866fd38a45797d445df04e5393b Mon Sep 17 00:00:00 2001 From: Claire Lovisa Date: Mon, 7 Mar 2022 15:20:10 +0100 Subject: [PATCH] Add migration to remove duplicated organizations --- ...-remove-duplicated-bestuurseenheden.sparql | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 config/migrations/2022/20220307140756-remove-duplicated-bestuurseenheden.sparql diff --git a/config/migrations/2022/20220307140756-remove-duplicated-bestuurseenheden.sparql b/config/migrations/2022/20220307140756-remove-duplicated-bestuurseenheden.sparql new file mode 100644 index 0000000..ce65032 --- /dev/null +++ b/config/migrations/2022/20220307140756-remove-duplicated-bestuurseenheden.sparql @@ -0,0 +1,77 @@ +# Splitting the query in two because of execution time + +## Links to the bestuur + + + +DELETE { + GRAPH ?g { + ?representatieveOrgaan ?bestuur . + ?orgaanInTijd ?porgaanInTijd ?oorgaanInTijd . + ?orgaan ?porgaan ?oorgaan . + ?betrokken ?pbetrokken ?obetrokken . + ?eenheid ?betrokken . + } +} WHERE { + GRAPH ?g { + VALUES ?bestuur { + + + } + + ?representatieveOrgaan ?bestuur . + + OPTIONAL { + ?orgaanInTijd ?bestuur ; + ?porgaanInTijd ?oorgaanInTijd . + + ?orgaan ?orgaanInTijd ; + ?porgaan ?oorgaan . + } + + OPTIONAL { + ?betrokken ?bestuur ; + ?pbetrokken ?obetrokken . + ?eenheid ?betrokken . + } + } +} + +; + +## Links from the bestuur + +DELETE { + GRAPH ?g { + ?bestuur ?pbestuur ?obestuur . + ?primarySite ?pprimarySite ?oprimarySite . + ?address ?paddress ?oaddress . + ?contactPoint ?pcontactPoint ?ocontactPoint . + ?identifier ?pidentifier ?oidentifier . + ?structuredIdentifier ?pstructuredIdentifier ?ostructuredIdentifier . + } +} WHERE { + GRAPH ?g { + VALUES ?bestuur { + + + } + + ?bestuur ?primarySite ; + ?identifier ; + ?pbestuur ?obestuur . + + ?primarySite ?address ; + ?contactPoint ; + ?pprimarySite ?oprimarySite . + + ?address ?paddress ?oaddress . + + ?contactPoint ?pcontactPoint ?ocontactPoint . + + ?identifier ?structuredIdentifier ; + ?pidentifier ?oidentifier . + + ?structuredIdentifier ?pstructuredIdentifier ?ostructuredIdentifier . + } +} \ No newline at end of file