adding linktypes to dc:identifier content for aoi-pmh repository

Hi Folks,

We're implementing omeka for a local history archive and have successfully installed the OAI-PMH repository plugin so that our National Library can harvest our records for their excellent Trove project (http://trove.nla.gov.au/)

I've requested a test harvest with them and all of our records check out okay, except that they have requested the following:

for images the dc:identifier should have a dc:identifier linktype="thumbnail" for the thumbnail image and a dc:identifier linktype="fulltext" for the location of the full record"

I notice that the image files and the link to the full record are automatically created by omeka, however the "linktype" value is not added to these elements. Is there a way I can do this within Omeka to satisfy the requirements of the National Library?

Hello Tom,
What you describe above can be accomplished by modifying OaiPmhRepository/metadata/Mets.php and for harvesting modify OaipmhHarvester/models/OaipmhHarvester/Harvest/Mets.php.

Hi Roberto,

Thanks very much for this.

I'm running Omeka 1.5 (waiting for the contribution plugin before I upgrade) and don't have a Harvest folder, nor am I seeing this file in my metadata folder, However it looks like I can tweak this section of OaiDc.php?


/* Must create elements using createElement to make DOM allow a
* top-level xmlns declaration instead of wasteful and non-
* compliant per-node declarations.
*/
foreach($dcElementNames as $elementName)
{
$upperName = Inflector::camelize($elementName);
$dcElements = $this->item->getElementTextsByElementNameAndSetName(
$upperName, 'Dublin Core');
foreach($dcElements as $elementText)
{
$this->appendNewElement($oai_dc,
'dc:'.$elementName, $elementText->text);
}
// Append the browse URI to all results
if($elementName == 'identifier')
{
$this->appendNewElement($oai_dc,
'dc:identifier', abs_item_uri($this->item));

// Also append an identifier for each file
if(get_option('oaipmh_repository_expose_files')) {
$files = $this->item->getFiles();
foreach($files as $file)
{
$this->appendNewElement($oai_dc,
'dc:identifier', $file->getWebPath('archive'));
}
}
}
}
}

Hello Tom,

If you are running Omeka 1.5 that file should be in OaipmhHarvester/libraries/OaipmhHarvester/Harvest/Mets.php. However Mets wast not implemented in this version of the harvester. You can copy the content of OaiDc.php into Mets.php and modify it so that harvesting Mets metadata is possible. The block of code you outlined above would be the one that does all the work you need done. Let me know if that helps.

Hi Roberto,

Looks like your last post refers to a different plugin - i.e. the Harvester, not the Repository?
I've tried editing the OaiDc.php with no success yet. Will post if I can make it work...

In the response above, you say "can be accomplished by modifying OaiPmhRepository/metadata/Mets.php" Can you be more specific? What needs to be modified?

Shannon,

It looks like this thread focuses on a very old version of the plugin. So, before I continue on, could you tell what, exactly you are looking to achieve -- is it still the same thing this thread started on? (If not, starting a new thread might also be a good idea).

Thanks

Yes, the same thing. For contributing records to DPLA, it'd be helpful to have an attribute on the identifier field that indicates it's a thumbnail image. I'm not sure how to modify the Mets.php file to accomplish this. We have Omeka 1.5 now, but are moving to Omeka 2.3 as soon as bugs are ironed out.

Haven't tested this yet, but following through the thread and the code that was pasted it _looks_ like it's all in the appendMetadata function. Most of the code above would get moved into the corresponding foreach($dcElementNames as $elementName) loop.

The only thing that isn't part of that loop is the section for adding to the file metadata:

$this->appendNewElement($oai_dc,
'dc:identifier', $file->getWebPath('archive'));

That would be added to the foreach ($this->item->getFiles() as $file) loop, also in the same function in Mets.php

I tried editing the code with what's pasted below, but it seems to have broken something. http://omeka.wustl.edu/omeka/oai-pmh-repository/request?verb=ListRecords&metadataPrefix=oai_dc&set=62 produces a blank screen now. Any help?

// Also append an identifier for each file
if(get_option('oaipmh_repository_expose_files')) {
$files = $this->item->getFiles();
foreach($files as $file)
{
$this->appendNewElement($oai_dc,
'dc:identifier', $this->setAttribute('linktype','thumbnail'), $file->getWebPath('archive'));
}
}

I just followed that link and got XML. Did you solve it?

No, I reverted back to the original OaiDc.php file. I tried a few different things and couldn't get an attribute to work for dc:identifier.