Browse Source

modified to include isMemberOf and isPartOf in addition to isMemberOfCollection in mods:relatedItem

pull/105/head
mroy 14 years ago
parent
commit
09ff6035df
  1. 56
      workflow_client/plugins/mods_extend.inc

56
workflow_client/plugins/mods_extend.inc

@ -66,32 +66,36 @@ class mods_extend extends Process {
} }
} }
$collections= $relsExtDom->getElementsByTagName('isMemberOfCollection'); $relationships = array('isMemberOfCollection','isMemberOf','isPartOf');
for ($i=0; $i < $collections->length; $i++) { foreach ($relationships as $relationship)
$collection = $collections->item($i); {
list(, $ident) = explode('/', $collection->getAttribute('rdf:resource')); $collections= $relsExtDom->getElementsByTagName($relationship);
for ($i=0; $i < $collections->length; $i++) {
$collection = new fedora_item($ident); $collection = $collections->item($i);
$dc = new SimpleXMLElement($collection->get_datastream_dissemination('DC'), NULL, FALSE, 'http://purl.org/dc/elements/1.1/'); list(, $ident) = explode('/', $collection->getAttribute('rdf:resource'));
$relatedItem = $modsDom->createElement('mods:relatedItem'); $collection = new fedora_item($ident);
$relatedItem->setAttribute('type', 'host'); $dc = new SimpleXMLElement($collection->get_datastream_dissemination('DC'), NULL, FALSE, 'http://purl.org/dc/elements/1.1/');
$titleInfo = $modsDom->createElement('mods:titleInfo');
$title = $modsDom->createElement('mods:title', $dc->title); $relatedItem = $modsDom->createElement('mods:relatedItem');
$titleInfo->appendChild($title); $relatedItem->setAttribute('type', 'host');
$relatedItem->appendChild($titleInfo); $titleInfo = $modsDom->createElement('mods:titleInfo');
$title = $modsDom->createElement('mods:title', $dc->title);
$identifier = $modsDom->createElement('mods:identifier', $ident); $titleInfo->appendChild($title);
$identifier->setAttribute('type', 'pid'); $relatedItem->appendChild($titleInfo);
$relatedItem->appendChild($identifier);
$identifier = $modsDom->createElement('mods:identifier', $ident);
$ident = preg_replace('/^.*\:/', '10719/', $ident); $identifier->setAttribute('type', 'pid');
$relatedItem->appendChild($identifier);
$identifier = $modsDom->createElement('mods:identifier', $ident);
$identifier->setAttribute('type', 'hdl'); $ident = preg_replace('/^.*\:/', '10719/', $ident);
$relatedItem->appendChild($identifier);
$identifier = $modsDom->createElement('mods:identifier', $ident);
$modsRoot->appendChild($relatedItem); $identifier->setAttribute('type', 'hdl');
$relatedItem->appendChild($identifier);
$modsRoot->appendChild($relatedItem);
}
} }
$identifier = $modsDom->createElement('mods:identifier', $pid); $identifier = $modsDom->createElement('mods:identifier', $pid);

Loading…
Cancel
Save