|
|
@ -216,26 +216,29 @@ function islandora_delete_form_contentmodels(array $form, array &$form_state) { |
|
|
|
function islandora_get_deleted_objects($content_models) { |
|
|
|
function islandora_get_deleted_objects($content_models) { |
|
|
|
$tuque = islandora_get_tuque_connection(); |
|
|
|
$tuque = islandora_get_tuque_connection(); |
|
|
|
$repository = $tuque->repository; |
|
|
|
$repository = $tuque->repository; |
|
|
|
$qualifier = ''; |
|
|
|
$first_contentmodel = array_shift($content_models); |
|
|
|
$last_content_model = key(array_slice($content_models, -1, 1, TRUE)); |
|
|
|
$prefix = "PREFIX fm: <" . FEDORA_MODEL_URI . "> "; |
|
|
|
foreach ($content_models as $content_model) { |
|
|
|
$select = "SELECT ?subject ?label ?object FROM <#ri> WHERE { "; |
|
|
|
$qualifier .= "\$subject <" . FEDORA_MODEL_URI . "hasModel> <info:fedora/$content_model>"; |
|
|
|
$where_clause = "{?subject fm:hasModel <info:fedora/$first_contentmodel>; |
|
|
|
if ($content_model != $last_content_model) { |
|
|
|
fm:state fm:Deleted; |
|
|
|
$qualifier .= ' or '; |
|
|
|
fm:hasModel ?object; |
|
|
|
} |
|
|
|
}"; |
|
|
|
|
|
|
|
$suffix = '}'; |
|
|
|
|
|
|
|
$unions = ''; |
|
|
|
|
|
|
|
foreach ($content_models as $contentmodel) { |
|
|
|
|
|
|
|
$unions .= "UNION {?subject fm:hasModel <info:fedora/$contentmodel>; |
|
|
|
|
|
|
|
fm:state fm:Deleted; |
|
|
|
|
|
|
|
fm:hasModel ?object; |
|
|
|
|
|
|
|
} "; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$optional = "OPTIONAL{?subject fm:label ?label}"; |
|
|
|
$query = "select \$subject \$title \$object from <#ri>"; |
|
|
|
$query = "$prefix $select $where_clause $unions $optional $suffix"; |
|
|
|
$query .= "where ($qualifier)"; |
|
|
|
$objects = $repository->ri->sparqlQuery($query, -1); |
|
|
|
$query .= "and \$subject <" . FEDORA_MODEL_URI . "state> <" . FEDORA_MODEL_URI . "Deleted>"; |
|
|
|
|
|
|
|
$query .= "and \$subject<" . FEDORA_MODEL_URI . "hasModel> \$object "; |
|
|
|
|
|
|
|
$query .= "and \$subject <dc:title> \$title"; |
|
|
|
|
|
|
|
$objects = $repository->ri->itqlQuery($query, 'unlimited'); |
|
|
|
|
|
|
|
$deleted_objects = array(); |
|
|
|
$deleted_objects = array(); |
|
|
|
foreach ($objects as $object) { |
|
|
|
foreach ($objects as $object) { |
|
|
|
if ($object['object']['value'] != "fedora-system:FedoraObject-3.0") { |
|
|
|
if ($object['object']['value'] != "fedora-system:FedoraObject-3.0") { |
|
|
|
$pid = $object['subject']['value']; |
|
|
|
$pid = $object['subject']['value']; |
|
|
|
$title = $object['title']['value']; |
|
|
|
$title = $object['label']['value']; |
|
|
|
$content_model = islandora_object_load($object['object']['value']); |
|
|
|
$content_model = islandora_object_load($object['object']['value']); |
|
|
|
$deleted_objects[$pid] = array( |
|
|
|
$deleted_objects[$pid] = array( |
|
|
|
'title' => $title, 'pid' => $pid, |
|
|
|
'title' => $title, 'pid' => $pid, |
|
|
@ -256,11 +259,15 @@ function islandora_get_contentmodels_with_deleted_members() { |
|
|
|
|
|
|
|
|
|
|
|
$tuque = new IslandoraTuque(); |
|
|
|
$tuque = new IslandoraTuque(); |
|
|
|
$repository = $tuque->repository; |
|
|
|
$repository = $tuque->repository; |
|
|
|
$query = "select \$object from <#ri>"; |
|
|
|
$query = "PREFIX fm: <info:fedora/fedora-system:def/model#> |
|
|
|
$query .= "where \$subject <" . FEDORA_MODEL_URI . "state> <" . FEDORA_MODEL_URI . "Deleted>"; |
|
|
|
SELECT DISTINCT ?object FROM <#ri> |
|
|
|
$query .= "and \$subject<" . FEDORA_MODEL_URI . "hasModel> \$object"; |
|
|
|
WHERE { |
|
|
|
|
|
|
|
{?subject fm:state fm:Deleted; |
|
|
|
|
|
|
|
fm:hasModel ?object; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}"; |
|
|
|
|
|
|
|
|
|
|
|
$objects = $repository->ri->itqlQuery($query, 'unlimited'); |
|
|
|
$objects = $repository->ri->sparqlQuery($query, -1); |
|
|
|
$content_models = array(); |
|
|
|
$content_models = array(); |
|
|
|
foreach ($objects as $object) { |
|
|
|
foreach ($objects as $object) { |
|
|
|
if ($object['object']['value'] != "fedora-system:FedoraObject-3.0") { |
|
|
|
if ($object['object']['value'] != "fedora-system:FedoraObject-3.0") { |
|
|
|