From 3d7d56d9da308cb759e4d0ea9e46bf2dfe27a657 Mon Sep 17 00:00:00 2001 From: Panos Alexopoulos Date: Fri, 24 Oct 2025 09:57:15 +0200 Subject: [PATCH] Added a cleanup query to find the triples that involve entities of type Bestuurseenheid either as subject or object, and are shared between the shared and administrative unit graphs, and then remove them from the administrative unit graph --- ...plicate-municipalities-and-provinces.graph | 1 + ...duplicate-municipalities-and-provinces.ttl | 58 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 config/migrations/2025/20251024093007-cleanup-deduplicate-municipalities-and-provinces.graph create mode 100644 config/migrations/2025/20251024093007-cleanup-deduplicate-municipalities-and-provinces.ttl diff --git a/config/migrations/2025/20251024093007-cleanup-deduplicate-municipalities-and-provinces.graph b/config/migrations/2025/20251024093007-cleanup-deduplicate-municipalities-and-provinces.graph new file mode 100644 index 0000000..d5c0765 --- /dev/null +++ b/config/migrations/2025/20251024093007-cleanup-deduplicate-municipalities-and-provinces.graph @@ -0,0 +1 @@ +http://mu.semte.ch/graphs/public \ No newline at end of file diff --git a/config/migrations/2025/20251024093007-cleanup-deduplicate-municipalities-and-provinces.ttl b/config/migrations/2025/20251024093007-cleanup-deduplicate-municipalities-and-provinces.ttl new file mode 100644 index 0000000..e541d45 --- /dev/null +++ b/config/migrations/2025/20251024093007-cleanup-deduplicate-municipalities-and-provinces.ttl @@ -0,0 +1,58 @@ +@prefix cleanup: . +@prefix mu: . +@prefix dcterms: . + + a cleanup:Job ; + mu:uuid "8ffd9f11-db25-430d-a66a-31fc8b393d5f" ; + dcterms:title "Insert missing province uris for addresses of administrative units" ; + cleanup:randomQuery """ + + PREFIX besluit: + + DELETE { + GRAPH { + ?s ?p ?o . + } + } + WHERE { + VALUES (?g1 ?g2) { + ( ) + } + + { + # Subject is a Bestuurseenheid + GRAPH ?g1 { + ?s a besluit:Bestuurseenheid ; + ?p ?o . + FILTER(?p != rdf:type) + } + GRAPH ?g2 { + ?s a besluit:Bestuurseenheid ; + ?p ?o . + FILTER(?p != rdf:type) + } + } + UNION + { + # Object is a Bestuurseenheid + GRAPH ?g1 { + ?s ?p ?o . + ?o a besluit:Bestuurseenheid . + FILTER(?p != rdf:type) + } + GRAPH ?g2 { + ?s ?p ?o . + ?o a besluit:Bestuurseenheid . + FILTER(?p != rdf:type) + } + } + } + ORDER BY ?s ?p ?o + + + """ . + + + + +