Browse Source

formatting, made query more efficient

pull/307/head
Alan Stanley 12 years ago
parent
commit
b58fd31f9c
  1. 13
      includes/utilities.inc

13
includes/utilities.inc

@ -724,18 +724,15 @@ function islandora_get_content_models($ignore_system_namespace = TRUE) {
FROM <#ri> FROM <#ri>
WHERE { WHERE {
{?object fm:hasModel <info:fedora/fedora-system:ContentModel-3.0>; {?object fm:hasModel <info:fedora/fedora-system:ContentModel-3.0>;
fm:state <info:fedora/fedora-system:def/model#Active> fm:state fm:Active
OPTIONAL{
?object fm:label ?label
} }
UNION{
?object fr:isMemberOfCollection <info:fedora/islandora:ContentModelsCollection>;
fm:state fm:Active
} }
UNION
{?object fr:isMemberOfCollection <info:fedora/islandora:ContentModelsCollection>;
fm:state <info:fedora/fedora-system:def/model#Active>
OPTIONAL{ OPTIONAL{
?object fm:label ?label ?object fm:label ?label
} }
}
}"; }";
$content_models = array(); $content_models = array();
$results = $tuque->repository->ri->sparqlQuery($query, 'unlimited'); $results = $tuque->repository->ri->sparqlQuery($query, 'unlimited');
@ -744,7 +741,7 @@ function islandora_get_content_models($ignore_system_namespace = TRUE) {
$label = $result['label']['value']; $label = $result['label']['value'];
$namespace = islandora_get_namespace($content_model); $namespace = islandora_get_namespace($content_model);
$ignore = $ignore_system_namespace && $namespace == 'fedora-system'; $ignore = $ignore_system_namespace && $namespace == 'fedora-system';
$ignore |= ! islandora_namespace_accessible($namespace); $ignore |= !islandora_namespace_accessible($namespace);
if (!$ignore) { if (!$ignore) {
$content_models[$content_model] = array('pid' => $content_model, 'label' => $label); $content_models[$content_model] = array('pid' => $content_model, 'label' => $label);
} }

Loading…
Cancel
Save