Commit 8937d974 authored by Claudiu Cristea's avatar Claudiu Cristea
Browse files

Merge branch 'ISAICP-7163' into 'master'

ISAICP-7163: Orphaned triples and wrong predicates.

See merge request !46
parents 98359a75 e07b8daa
Pipeline #437990 passed with stages
in 2 minutes and 2 seconds
......@@ -20,3 +20,28 @@
function joinup_core_deploy_108200(): void {
\Drupal::database()->schema()->dropTable('site_verify');
}
/**
* Update the predicates for field 'test_resource_type'.
*/
function joinup_core_deploy_108201() {
/** @var \Drupal\Core\Database\Connection $query */
$query = \Drupal::service('sparql.endpoint');
$test_resource_type_query = <<<QUERY
DELETE { GRAPH ?g { ?subject <http://purl.org/dc/terms/DCMIType> ?object } }
INSERT { GRAPH ?g { ?subject <http://joinup.eu/test_resource_type> ?object } }
USING <http://joinup.eu/asset_release/draft>
USING <http://joinup.eu/asset_release/published>
WHERE { GRAPH ?g { ?subject <http://purl.org/dc/terms/DCMIType> ?object } }
QUERY;
$query->query($test_resource_type_query);
$orphaned_triples_query = <<<QUERY
DELETE { GRAPH ?g { ?s <http://joinup.eu/test_resource_type> ?o } }
WHERE { ?s <http://joinup.eu/test_resource_type> ?o
. VALUES ?g {<http://joinup.eu/asset_release/published> <http://joinup.eu/asset_release/draft> }
. FILTER NOT EXISTS { ?s a ?type }
}
QUERY;
$query->query($orphaned_triples_query);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment