Skip to content
Snippets Groups Projects
Commit cc045f92 authored by Ilias Dimopoulos's avatar Ilias Dimopoulos
Browse files

ISAICP-8733: Update the predicate and clean up the values from the releases that are not valid.

parent 23c5fc49
No related branches found
Tags v1.112.1
1 merge request!171ISAICP-8733: Update the predicate and clean up the values from the releases that are not valid.
......@@ -8,7 +8,7 @@ third_party_settings:
sparql_entity_storage:
mapping:
target_id:
predicate: 'http://joinup.eu/test_resource_type'
predicate: 'http://purl.org/dc/terms/type'
format: resource
id: rdf_entity.field_isr_solution_type
field_name: field_isr_solution_type
......
......@@ -242,3 +242,55 @@ function joinup_rdf_update_110505(): void {
// Remove provenance records from the RDF backend.
\Drupal::getContainer()->get('sparql.endpoint')->update("CLEAR GRAPH <http://joinup.eu/provenance_activity>;");
}
/**
* Clean up invalid release type entries and update the predicate.
*/
function joinup_rdf_update_110506(): void {
$sparql = \Drupal::getContainer()->get('sparql.endpoint');
$cleanup_query = <<<SPARQL
DELETE {
GRAPH ?g {
?s <http://joinup.eu/test_resource_type> ?deletedTermUri .
}
}
WHERE {
GRAPH ?g {
?s a <http://www.w3.org/ns/dcat#Dataset> .
?s <http://joinup.eu/test_resource_type> ?deletedTermUri .
FILTER NOT EXISTS {
SELECT ?deletedTermUri
WHERE {
GRAPH <http://data> {
?deletedTermUri <http://www.w3.org/2004/02/skos/core#inScheme> <http://data.europa.eu/dr8> .
}
}
}
}
}
SPARQL;
$sparql->update($cleanup_query);
$update_query = <<<SPARQL
DELETE {
GRAPH ?g {
?s <http://joinup.eu/test_resource_type> ?o .
}
}
INSERT {
GRAPH ?g {
?s <http://purl.org/dc/terms/type> ?o .
}
}
WHERE {
GRAPH ?g {
?s a <http://www.w3.org/ns/dcat#Dataset> .
?s <http://joinup.eu/test_resource_type> ?o .
VALUES ?g { <http://joinup.eu/asset_release/published> <http://joinup.eu/asset_release/draft> }
}
}
SPARQL;
$sparql->update($update_query);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment