$ curl http://digital.stage.lafayette.edu/islandora/object/elc:10/datastream/DC/view
<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
<dc:title>Ledger 1</dc:title>
<dc:identifier>elc:10</dc:identifier>
</oai_dc:dc>
- Please note that the XML Document is missing the XML declaration
- This is because DC datastreams are managed as inline XML
- As such, they are embedded within FOXML Documents (with the XML already declared)
$ cat fixture.dc.xml
<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
<dc:title>Ledger 1</dc:title>
<dc:identifier>elc:10</dc:identifier>
<dc:description>This is a resource with an updated DC datastream</dc:description>
</oai_dc:dc>
$ drush islandora-update-ds elc:10 DC 'Dublin Core Record for this object' `pwd`/fixture.dc.xml X
- Note that this is a Drush task which I've implemented locally. Freely refactor and use the code here:
<?php
//...
function islandora_dss_drush_command() {
//...
$items['islandora-update-ds'] =
array(
'description' => dt('Update/Insert the a datastream for an Islandora Object'),
'arguments' => array('arg1' => dt('The Fedora Commons Object PID'),
'arg2' => dt('The Datastream ID'),
'arg3' => dt('The Datastream label'),
'arg4' => dt('The file path for the Datastream content'),
'arg5' => dt('The type of datastream being updated (e. g. managed, inline XML, redirect...)')
),
'examples' => array('Argument example' => 'drush islandora-update-dc islandora:object1 MODS "MODS Document" object1.mods.xml MODS',
),
'aliases' => array('ds-up'));
//...
function drush_islandora_dss_islandora_update_ds($obj_pid, $ds_id, $ds_label, $ds_content_file_path, $control_group='M') {
// Get the connection
$connection = islandora_get_tuque_connection(user_load(1), $url);
// Load the object
$object = islandora_object_load($obj_pid);
// Create and ingest the Object
if(empty($object[$ds_id])) {
$datastream = $object->constructDatastream($ds_id, $control_group);
$datastream->label = $ds_label;
$object->ingestDatastream($datastream);
$created = TRUE;
} else {
$datastream = $object[$ds_id];
}
$datastream->setContentFromFile($ds_content_file_path);
//...
?>
$ curl http://digital.stage.lafayette.edu/islandora/object/elc:10/datastream/DC/view
<oai_dc:dc xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
<dc:title>Ledger 1</dc:title>
<dc:description>This is a resource with an updated DC datastream</dc:description>
<dc:identifier>elc:10</dc:identifier>
</oai_dc:dc>