From 7545270bd48c0075c6ec56ee5a255a87c4aec0e8 Mon Sep 17 00:00:00 2001 From: DiegoPino Date: Tue, 30 Dec 2014 17:56:07 -0300 Subject: [PATCH 1/7] Restored isPartOf, order by, added comp. predicate --- includes/breadcrumb.inc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/includes/breadcrumb.inc b/includes/breadcrumb.inc index e75a0fdd..76d1cb28 100644 --- a/includes/breadcrumb.inc +++ b/includes/breadcrumb.inc @@ -12,7 +12,7 @@ * * Each link in the bread-crumbs represents a member of the given objects * ancestry which is identified by any of the following RELS-EXT terms - * (isMemberOf,isMemberOfCollection,isPartOf). + * (isMemberOf,isMemberOfCollection,isPartOf,isConstituentOf). * * @param AbstractObject $object * An object whose ancestry will be mapped to bread-crumbs. @@ -84,13 +84,14 @@ function islandora_get_breadcrumbs_recursive($pid, FedoraRepository $repository, SELECT DISTINCT ?object ?label FROM <#ri> WHERE { - ?collection_predicate ?object; + ?parentship_predicate ?object; ?label . ?object . !optionals !filters } + !order EOQ; $query_optionals = (array) module_invoke('islandora_xacml_api', 'islandora_basic_collection_get_query_optionals', 'view'); @@ -98,10 +99,15 @@ EOQ; $filter_map = function ($filter) { return "FILTER($filter)"; }; - $query_filters[] = "sameTerm(?collection_predicate, ) || sameTerm(?collection_predicate, )"; + $compound_object_predicate = variable_get('islandora_compound_object_relationship', 'isConstituentOf'); + $parentship_predicate_filters = "sameTerm(?parentship_predicate, ) || sameTerm(?parentship_predicate, )"; + $parentship_predicate_filters .= " || sameTerm(?parentship_predicate, ) || sameTerm(?parentship_predicate, )"; + $query_filters[] = $parentship_predicate_filters; + $query_order = "ORDER BY DESC(?label)"; $query = format_string($query, array( '!optionals' => !empty($query_optionals) ? ('OPTIONAL {{' . implode('} UNION {', $query_optionals) . '}}') : '', '!filters' => implode(' ', array_map($filter_map, $query_filters)), + '!order' => $query_order, )); $query = format_string($query, array( '!pid' => $pid, From d276979548ff0ede989035944aa472f83d20019b Mon Sep 17 00:00:00 2001 From: willtp87 Date: Wed, 25 Feb 2015 10:44:39 -0400 Subject: [PATCH 2/7] Stopped a notice. --- islandora.rules.inc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/islandora.rules.inc b/islandora.rules.inc index 2562656a..2ebaa519 100644 --- a/islandora.rules.inc +++ b/islandora.rules.inc @@ -406,9 +406,11 @@ function islandora_rules_datastream_load_namespace_vocab($xpath, $xpath_vocab) { /** * Rules XPath helper; grab the datastream content and build a DOMXPath. */ -function islandora_rules_datastream_load_xpath(AbstractDatastream $datastream, $xpath_vocab) { - $result = islandora_rules_datastream_load_domxpath($datastream->content, $xpath_vocab); - islandora_rules_datastream_load_namespace_vocab($result['islandora_domxpath'], $xpath_vocab); +function islandora_rules_datastream_load_xpath(AbstractDatastream $datastream, $xpath_vocab = NULL) { + $result = islandora_rules_datastream_load_domxpath($datastream->content); + if (is_object($xpath_vocab)) { + islandora_rules_datastream_load_namespace_vocab($result['islandora_domxpath'], $xpath_vocab); + } return $result; } From a992b742e318690e4afba8772207fc4b5b5a27da Mon Sep 17 00:00:00 2001 From: qadan Date: Thu, 26 Feb 2015 10:39:03 -0400 Subject: [PATCH 3/7] fix everyone yelling at me --- tests/includes/utilities.inc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/includes/utilities.inc b/tests/includes/utilities.inc index e12fab72..5d9501d1 100644 --- a/tests/includes/utilities.inc +++ b/tests/includes/utilities.inc @@ -314,7 +314,8 @@ class IslandoraTestUtilities extends IslandoraTestUtilityClass { * The user whose objects we'd like to remove. * * @return bool - * TRUE on success, FALSE on failure. + * TRUE if all objects were removed, or FALSE if any of them still remained + * after removal. */ public function deleteUserCreatedObjects($username) { if ($username === $this->configuration['admin_user']) { @@ -330,16 +331,19 @@ SELECT ?object FROM <#ri> WHERE QUERY; $objects = $this->repository->ri->sparqlQuery($query); + $return_value = TRUE; foreach ($objects as $object) { $loaded_object = islandora_object_load($object['object']['value']); $this->repository->api->m->purgeObject($loaded_object->id); if (islandora_object_load($object['object']['value'])) { $this->addResult(TRUE, "Object {$object['object']['value']} successfully removed from repository."); - return TRUE; } - $this->addResult(FALSE, "Unable to remove object {$object['object']['value']} from the repository."); - return FALSE; + else { + $this->addResult(FALSE, "Unable to remove object {$object['object']['value']} from the repository."); + $return_value = FALSE; + } } + return $return_value; } /** From 6645c6901583eab653bd06821482f6ed3252700e Mon Sep 17 00:00:00 2001 From: qadan Date: Thu, 26 Feb 2015 10:42:33 -0400 Subject: [PATCH 4/7] unimportant commit, doesn't really change functionality any --- tests/includes/utilities.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/includes/utilities.inc b/tests/includes/utilities.inc index 5d9501d1..3d49936c 100644 --- a/tests/includes/utilities.inc +++ b/tests/includes/utilities.inc @@ -335,7 +335,7 @@ QUERY; foreach ($objects as $object) { $loaded_object = islandora_object_load($object['object']['value']); $this->repository->api->m->purgeObject($loaded_object->id); - if (islandora_object_load($object['object']['value'])) { + if (!islandora_object_load($object['object']['value'])) { $this->addResult(TRUE, "Object {$object['object']['value']} successfully removed from repository."); } else { From d7b4a0de1e3fb2f8efa0c9c1863461935207ed79 Mon Sep 17 00:00:00 2001 From: qadan Date: Thu, 26 Feb 2015 10:45:39 -0400 Subject: [PATCH 5/7] can i get back to work now --- tests/includes/utilities.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/includes/utilities.inc b/tests/includes/utilities.inc index 3d49936c..4eef5255 100644 --- a/tests/includes/utilities.inc +++ b/tests/includes/utilities.inc @@ -334,7 +334,7 @@ QUERY; $return_value = TRUE; foreach ($objects as $object) { $loaded_object = islandora_object_load($object['object']['value']); - $this->repository->api->m->purgeObject($loaded_object->id); + $this->repository->purgeObject($loaded_object->id); if (!islandora_object_load($object['object']['value'])) { $this->addResult(TRUE, "Object {$object['object']['value']} successfully removed from repository."); } From d5660bd0a0b36a29341cfdb21515d8a2d16d92bd Mon Sep 17 00:00:00 2001 From: DiegoPino Date: Thu, 26 Feb 2015 12:21:25 -0300 Subject: [PATCH 6/7] Restored predicate var, removed ext. mod. var get as defined by committers call Feb. 19, 2015 --- includes/breadcrumb.inc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/includes/breadcrumb.inc b/includes/breadcrumb.inc index 76d1cb28..fb1054fc 100644 --- a/includes/breadcrumb.inc +++ b/includes/breadcrumb.inc @@ -84,7 +84,7 @@ function islandora_get_breadcrumbs_recursive($pid, FedoraRepository $repository, SELECT DISTINCT ?object ?label FROM <#ri> WHERE { - ?parentship_predicate ?object; + ?collection_predicate ?object; ?label . ?object . @@ -99,10 +99,9 @@ EOQ; $filter_map = function ($filter) { return "FILTER($filter)"; }; - $compound_object_predicate = variable_get('islandora_compound_object_relationship', 'isConstituentOf'); - $parentship_predicate_filters = "sameTerm(?parentship_predicate, ) || sameTerm(?parentship_predicate, )"; - $parentship_predicate_filters .= " || sameTerm(?parentship_predicate, ) || sameTerm(?parentship_predicate, )"; - $query_filters[] = $parentship_predicate_filters; + $collection_predicate_filters = "sameTerm(?collection_predicate, )"; + $collection_predicate_filters .= " || sameTerm(?collection_predicate, ) || sameTerm(?collection_predicate, )"; + $query_filters[] = $collection_predicate_filters; $query_order = "ORDER BY DESC(?label)"; $query = format_string($query, array( '!optionals' => !empty($query_optionals) ? ('OPTIONAL {{' . implode('} UNION {', $query_optionals) . '}}') : '', From a07f6b144b8a20aee9b665a98e20cd662390a9b1 Mon Sep 17 00:00:00 2001 From: DiegoPino Date: Thu, 26 Feb 2015 12:27:15 -0300 Subject: [PATCH 7/7] Removed comment in ref. to removed code flushing all reference to isConstituentOf --- includes/breadcrumb.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/breadcrumb.inc b/includes/breadcrumb.inc index fb1054fc..e3eb2782 100644 --- a/includes/breadcrumb.inc +++ b/includes/breadcrumb.inc @@ -12,7 +12,7 @@ * * Each link in the bread-crumbs represents a member of the given objects * ancestry which is identified by any of the following RELS-EXT terms - * (isMemberOf,isMemberOfCollection,isPartOf,isConstituentOf). + * (isMemberOf,isMemberOfCollection,isPartOf). * * @param AbstractObject $object * An object whose ancestry will be mapped to bread-crumbs.