|
|
|
@ -140,29 +140,17 @@ function islandora_orphaned_objects_get_orphaned_objects() {
|
|
|
|
|
$connection = islandora_get_tuque_connection(); |
|
|
|
|
// First query: get standard objects. |
|
|
|
|
$object_query = <<<EOQ |
|
|
|
|
SELECT ?object ?collection ?title |
|
|
|
|
SELECT ?object ?otherobject ?title ?p |
|
|
|
|
WHERE { |
|
|
|
|
?object <fedora-model:hasModel> <info:fedora/fedora-system:FedoraObject-3.0> ; |
|
|
|
|
<fedora-rels-ext:isMemberOfCollection> ?collection . |
|
|
|
|
?p ?otherobject . |
|
|
|
|
?object <fedora-model:label> ?title; |
|
|
|
|
FILTER( regex( str(?p), "/fedora-system:def/relations-external#")) |
|
|
|
|
OPTIONAL { |
|
|
|
|
?collection <fedora-model:hasModel> ?model . |
|
|
|
|
?otherobject <fedora-model:hasModel> ?model . |
|
|
|
|
} |
|
|
|
|
FILTER(!bound(?model)) |
|
|
|
|
} |
|
|
|
|
EOQ; |
|
|
|
|
// Second query: get paged objects. |
|
|
|
|
$paged_query = <<<EOQ |
|
|
|
|
SELECT ?object ?book ?title |
|
|
|
|
WHERE { |
|
|
|
|
?object <fedora-model:hasModel> <info:fedora/fedora-system:FedoraObject-3.0> ; |
|
|
|
|
<fedora-rels-ext:isMemberOf> ?book . |
|
|
|
|
?object <fedora-model:label> ?title; |
|
|
|
|
OPTIONAL { |
|
|
|
|
?book <fedora-model:hasModel> ?model . |
|
|
|
|
} |
|
|
|
|
FILTER(!bound(?model)) |
|
|
|
|
} |
|
|
|
|
EOQ; |
|
|
|
|
$optionals = (array) module_invoke('islandora_xacml_api', 'islandora_basic_collection_get_query_optionals', 'view'); |
|
|
|
|
$filter_modules = array( |
|
|
|
@ -181,14 +169,7 @@ EOQ;
|
|
|
|
|
'!optionals' => !empty($optionals) ? ('OPTIONAL {{' . implode('} UNION {', $optionals) . '}}') : '', |
|
|
|
|
'!filters' => !empty($filters) ? implode(' ', array_map($filter_map, $filters)) : '', |
|
|
|
|
)); |
|
|
|
|
$sparql_query_paged = format_string($paged_query, array( |
|
|
|
|
'!optionals' => !empty($optionals) ? ('OPTIONAL {{' . implode('} UNION {', $optionals) . '}}') : '', |
|
|
|
|
'!filters' => !empty($filters) ? implode(' ', array_map($filter_map, $filters)) : '', |
|
|
|
|
)); |
|
|
|
|
$object_results = $connection->repository->ri->sparqlQuery($sparql_query_objects); |
|
|
|
|
$paged_results = $connection->repository->ri->sparqlQuery($sparql_query_paged); |
|
|
|
|
// Merge results of both queries into a single variable and return. |
|
|
|
|
$results = array_merge($object_results, $paged_results); |
|
|
|
|
$results = $connection->repository->ri->sparqlQuery($sparql_query_objects); |
|
|
|
|
return $results; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|