Added two migrations, one for adding province URIs to address entities, and one for adding a concept scheme for provinces

Updated add province uri migration to avoid duplicates

Added a cleanup migration for adding province URIs to addresses

Updated the export,json config to expose the province URI of addresses

Fixing errors after review

Updated CHANGELOG

Refactored and corrected migrations, changed the timestamps

refactoring cleanup migrations

Refactored the cleanup add province migrations

Updated changelog to ensure db-cleanup-service picks up the new jobs.
This commit is contained in:
Panos Alexopoulos
2025-05-07 16:38:26 +02:00
parent 34244b699b
commit 73e6c2c60c
9 changed files with 153 additions and 0 deletions

View File

@@ -9,6 +9,7 @@
+ Move werkingsgebieden to public graph
+ Link district werkingsgebieden to Antwerp municipality werkingsgebied
+ Add missing werkingsgebied for Borsbeek district
- Write migration to extract from existing primary sites the province URI [OP-3597]
### Deploy Notes
```
drc restart migrations; drc logs -ft --tail=200 migrations
@@ -18,6 +19,7 @@ drc exec kbo-data-sync curl -X POST http://localhost/sync-all-kbo-data
drc restart delta-producer-publication-graph-maintainer
drc exec delta-producer-background-jobs-initiator curl -X POST http://localhost/public/healing-jobs # or wait until nightly healing kicks in
drc exec delta-producer-background-jobs-initiator curl -X POST http://localhost/organizations/healing-jobs # or wait until nightly healing kicks in
drc exec db-cleanup curl -X POST "http://localhost/cleanup"
```
## v1.31.2 (2025-04-02)

View File

@@ -336,6 +336,7 @@
"http://www.w3.org/ns/locn#postCode",
"https://data.vlaanderen.be/ns/adres#gemeentenaam",
"http://www.w3.org/ns/locn#adminUnitL2",
"https://data.vlaanderen.be/ns/adres#adresIsGelegenIn",
"https://data.vlaanderen.be/ns/adres#land",
"http://www.w3.org/ns/locn#fullAddress",
"https://data.vlaanderen.be/ns/adres#verwijstNaar",

View File

@@ -252,6 +252,7 @@
"http://www.w3.org/ns/locn#postCode",
"https://data.vlaanderen.be/ns/adres#gemeentenaam",
"http://www.w3.org/ns/locn#adminUnitL2",
"https://data.vlaanderen.be/ns/adres#adresIsGelegenIn",
"https://data.vlaanderen.be/ns/adres#land",
"http://www.w3.org/ns/locn#fullAddress",
"https://data.vlaanderen.be/ns/adres#verwijstNaar",
@@ -279,6 +280,7 @@
"http://www.w3.org/ns/locn#postCode",
"https://data.vlaanderen.be/ns/adres#gemeentenaam",
"http://www.w3.org/ns/locn#adminUnitL2",
"https://data.vlaanderen.be/ns/adres#adresIsGelegenIn",
"https://data.vlaanderen.be/ns/adres#land",
"http://www.w3.org/ns/locn#fullAddress",
"https://data.vlaanderen.be/ns/adres#verwijstNaar",

View File

@@ -0,0 +1,26 @@
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX concept_schemes: <http://data.lblod.info/doc/conceptscheme#>
PREFIX ext: <http://mu.semte.ch/vocabularies/ext/>
PREFIX dcterms: <http://purl.org/dc/terms/>
INSERT DATA {
GRAPH <http://mu.semte.ch/graphs/public> {
concept_schemes:ProvincesConceptScheme a skos:ConceptScheme ;
skos:prefLabel "Provinces Concept Scheme" ;
dcterms:description "A concept scheme containing all the location entities that are provinces".
}
}
;
INSERT
{
GRAPH <http://mu.semte.ch/graphs/public> {
?province_uri rdf:type skos:Concept ;
skos:inScheme concept_schemes:ProvincesConceptScheme .
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/public> {
?province_uri ext:werkingsgebiedNiveau "Provincie".
}
}

View File

@@ -0,0 +1,40 @@
PREFIX locn: <http://www.w3.org/ns/locn#>
PREFIX ext: <http://mu.semte.ch/vocabularies/ext/>
PREFIX adres: <https://data.vlaanderen.be/ns/adres#>
INSERT {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?address adres:adresIsGelegenIn ?province_uri .
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?address rdf:type locn:Address ;
locn:adminUnitL2 ?province_literal .
}
GRAPH <http://mu.semte.ch/graphs/public> {
?province_uri rdfs:label ?province_literal ;
ext:werkingsgebiedNiveau "Provincie" .
}
}
;
INSERT {
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?address adres:adresIsGelegenIn ?province_uri .
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?address rdf:type locn:Address ;
locn:adminUnitL2 ?province_literal .
}
GRAPH <http://mu.semte.ch/graphs/public> {
?province_uri rdfs:label ?province_literal ;
ext:werkingsgebiedNiveau "Provincie" .
}
}

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/42245582-ea60-4d44-80ef-c686901eccb5> a cleanup:Job ;
mu:uuid "42245582-ea60-4d44-80ef-c686901eccb5" ;
dcterms:title "Insert missing province uris for addresses of administrative units" ;
cleanup:randomQuery """
PREFIX locn: <http://www.w3.org/ns/locn#>
PREFIX ext: <http://mu.semte.ch/vocabularies/ext/>
PREFIX adres: <https://data.vlaanderen.be/ns/adres#>
INSERT {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?address adres:adresIsGelegenIn ?province_uri .
}
}
WHERE {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?address rdf:type locn:Address ;
locn:adminUnitL2 ?province_literal .
FILTER NOT EXISTS {
?address adres:adresIsGelegenIn ?province_uri2 .
}
}
GRAPH <http://mu.semte.ch/graphs/public> {
?province_uri rdfs:label ?province_literal ;
ext:werkingsgebiedNiveau "Provincie" .
BIND (?province_uri as ?province_uri2)
}
}
""" .

View File

@@ -0,0 +1,39 @@
@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/cdbb9f4e-90cc-40f6-a0a9-bd0bd8c9105f> a cleanup:Job ;
mu:uuid "cdbb9f4e-90cc-40f6-a0a9-bd0bd8c9105f" ;
dcterms:title "Insert missing province uris for addresses of worship services" ;
cleanup:randomQuery """
PREFIX locn: <http://www.w3.org/ns/locn#>
PREFIX ext: <http://mu.semte.ch/vocabularies/ext/>
PREFIX adres: <https://data.vlaanderen.be/ns/adres#>
INSERT {
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?address adres:adresIsGelegenIn ?province_uri .
}
}
WHERE {
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?address rdf:type locn:Address ;
locn:adminUnitL2 ?province_literal .
FILTER NOT EXISTS {
?address adres:adresIsGelegenIn ?province_uri2 .
}
}
GRAPH <http://mu.semte.ch/graphs/public> {
?province_uri rdfs:label ?province_literal ;
ext:werkingsgebiedNiveau "Provincie" .
BIND (?province_uri as ?province_uri2)
}
}
""" .