Browse Source

Merge pull request #161 from adam-vessey/6.x

6.x
pull/162/head
Jonathan Green 13 years ago
parent
commit
c64da6d351
  1. 17
      api/fedora_item.inc

17
api/fedora_item.inc

@ -389,11 +389,12 @@ RDF;
* Whether or not this operation has produced any changes in the RELS-EXT * Whether or not this operation has produced any changes in the RELS-EXT
*/ */
function purge_relationships($relationship, $object, $namespaceURI = RELS_EXT_URI, $literal_value = FALSE) { function purge_relationships($relationship, $object, $namespaceURI = RELS_EXT_URI, $literal_value = FALSE) {
$relsext = $this->get_datastream_dissemination('RELS-EXT'); $relsext = trim($this->get_datastream_dissemination('RELS-EXT'));
$relsextxml = new DomDocument(); $relsextxml = new DOMDocument();
$relsextxml->loadXML($relsext);
$modified = FALSE; $modified = FALSE;
if ($relsext && $relsextxml->loadXML($relsext)) {
$rels = $relsextxml->getElementsByTagNameNS($namespaceURI, $relationship); $rels = $relsextxml->getElementsByTagNameNS($namespaceURI, $relationship);
if (!empty($rels)) { if (!empty($rels)) {
// iterate backwards so if we delete something our pointer doesn't get out of sync // iterate backwards so if we delete something our pointer doesn't get out of sync
@ -416,7 +417,7 @@ RDF;
if ($modified) { if ($modified) {
$this->modify_datastream($relsextxml->saveXML(), 'RELS-EXT', "Fedora Object-to-Object Relationship Metadata", 'text/xml'); $this->modify_datastream($relsextxml->saveXML(), 'RELS-EXT', "Fedora Object-to-Object Relationship Metadata", 'text/xml');
} }
}
//Return whether or not we've introduced any changes. //Return whether or not we've introduced any changes.
return $modified; return $modified;
} }
@ -433,11 +434,11 @@ RDF;
$dsid = $f_prefix . $this->pid . '/' . $dsid; $dsid = $f_prefix . $this->pid . '/' . $dsid;
} }
$relsint = $this->get_datastream_dissemination('RELS-INT');
$relsxml = new DOMDocument(); $relsxml = new DOMDocument();
$relsxml->loadXML($relsint); $relsint = trim($this->get_datastream_dissemination('RELS-INT'));
$modified = FALSE; $modified = FALSE;
if ($relsint && $relsxml->loadXML($relsint)) {
$descs = $relsxml->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'Description'); $descs = $relsxml->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'Description');
$description = NULL; $description = NULL;
@ -467,11 +468,11 @@ RDF;
} }
} }
//Save changes. //Save changes.
if ($modified) { if ($modified) {
$this->modify_datastream($relsxml->saveXML(), 'RELS-INT', "Fedora Datastream Relationship Metadata", 'text/xml'); $this->modify_datastream($relsxml->saveXML(), 'RELS-INT', "Fedora Datastream Relationship Metadata", 'text/xml');
} }
}
//Return whether or not we've introduced any changes. //Return whether or not we've introduced any changes.
return $modified; return $modified;

Loading…
Cancel
Save