|
|
@ -140,26 +140,14 @@ function islandora_orphaned_objects_get_orphaned_objects() { |
|
|
|
$connection = islandora_get_tuque_connection(); |
|
|
|
$connection = islandora_get_tuque_connection(); |
|
|
|
// First query: get standard objects. |
|
|
|
// First query: get standard objects. |
|
|
|
$object_query = <<<EOQ |
|
|
|
$object_query = <<<EOQ |
|
|
|
SELECT ?object ?collection ?title |
|
|
|
SELECT ?object ?otherobject ?title ?p |
|
|
|
WHERE { |
|
|
|
WHERE { |
|
|
|
?object <fedora-model:hasModel> <info:fedora/fedora-system:FedoraObject-3.0> ; |
|
|
|
?object <fedora-model:hasModel> <info:fedora/fedora-system:FedoraObject-3.0> ; |
|
|
|
<fedora-rels-ext:isMemberOfCollection> ?collection . |
|
|
|
?p ?otherobject . |
|
|
|
?object <fedora-model:label> ?title; |
|
|
|
?object <fedora-model:label> ?title; |
|
|
|
|
|
|
|
FILTER( regex( str(?p), "/fedora-system:def/relations-external#")) |
|
|
|
OPTIONAL { |
|
|
|
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)) |
|
|
|
FILTER(!bound(?model)) |
|
|
|
} |
|
|
|
} |
|
|
@ -181,14 +169,7 @@ EOQ; |
|
|
|
'!optionals' => !empty($optionals) ? ('OPTIONAL {{' . implode('} UNION {', $optionals) . '}}') : '', |
|
|
|
'!optionals' => !empty($optionals) ? ('OPTIONAL {{' . implode('} UNION {', $optionals) . '}}') : '', |
|
|
|
'!filters' => !empty($filters) ? implode(' ', array_map($filter_map, $filters)) : '', |
|
|
|
'!filters' => !empty($filters) ? implode(' ', array_map($filter_map, $filters)) : '', |
|
|
|
)); |
|
|
|
)); |
|
|
|
$sparql_query_paged = format_string($paged_query, array( |
|
|
|
$results = $connection->repository->ri->sparqlQuery($sparql_query_objects); |
|
|
|
'!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); |
|
|
|
|
|
|
|
return $results; |
|
|
|
return $results; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|