Jump to content
Wiki Home
EPrints Home
Bazaar
Files
Main menu
Main menu
move to sidebar
hide
Navigation
Front Page
EPrints 3 Manual
EPrints Training Course
EPrints Glossary
Installing EPrints
How-to Configure EPrints
EPrints 3.2+ API
EPrints 3 Reference
EPrints Plugins
Wiki
All categories
Recent changes
Main Page
Help
EPrints Documentation
Search
Search
Appearance
Log in
Request account
Personal tools
Log in
Request account
Pages for logged out editors
learn more
Contributions
Talk
Editing
ORCID
(section)
Page
Discussion
British English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
= OAI-PMH (Experimental) = '''[[User:Libjlrs]] 2016-09-29 Warning: this is experimental. I hope others will read, understand, question and improve on this before it becomes some form of best practice!''' Some metadata profiles support attributes that are useful to propagate ORCIDs e.g. RIOXX (see the [[#Exposing_the_ORCID_in_RIOXX]] section above, and the 'rioxxterms:author' section on http://www.rioxx.net/profiles/v2-0-final/ ). A lot of harvesters use the oai_dc metadata profile when harvesting records. The DC schema doesn't allow attributes on the dc:creator element, so ORCIDs cannot be added in a sensible way to this profile. The details below create an additional metadata prefix that adds an attribute to the dc:creator field. The original <code>metadataPrefix=oai_dc</code> output remains unchanged. Using <code>metadataPrefix=oai_dc_orcid</code> will add the orcid attribute where available. Currently there is not an XSD that describes this change, so a harvester that validates the feed may stop when it encounters an ORCID. This example is based on the <code>EPrints::Plugin::Export::OAI_DC</code> module from EPrints 3.3.10. You may need to tweak it to make it work for you! File: <code>~/archives/ARCHIVEID/cfg/plugins/EPrints/Plugin/Export/OAI_DC_ORCID.pm</code> <source lang="perl"> package EPrints::Plugin::Export::OAI_DC_ORCID; use EPrints::Plugin::Export::OAI_DC; @ISA = ( "EPrints::Plugin::Export::OAI_DC", "EPrints::Plugin::Export::DC" ); use strict; sub new { my( $class, %opts ) = @_; my $self = $class->SUPER::new( %opts ); $self->{name} = "Dublin Core - OAI + ORCID Schema"; $self->{accept} = [ 'dataobj/eprint' ]; $self->{visible} = ""; $self->{suffix} = ".xml"; $self->{mimetype} = "text/xml"; $self->{metadataPrefix} = "oai_dc_orcid"; $self->{xmlns} = "http://www.openarchives.org/OAI/2.0/oai_dc/"; $self->{schemaLocation} = "http://www.openarchives.org/OAI/2.0/oai_dc.xsd"; return $self; } sub xml_dataobj { my( $plugin, $dataobj ) = @_; my $data = $plugin->convert_dataobj( $dataobj ); my $dc = $plugin->{session}->make_element( "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" ); # turn the list of pairs into XML blocks (indented by 8) and add them # them to the DC element. foreach( @{$data} ) { $dc->appendChild( $plugin->{session}->render_data_element( 8, "dc:".$_->[0], $_->[1], %{$_->[2]} ) ); # produces <key>value</key> } return $dc; } sub convert_dataobj { my( $plugin, $eprint ) = @_; my $dataset = $eprint->{dataset}; my @dcdata = (); push @dcdata, $plugin->simple_value( $eprint, title => "title" ); if( $eprint->exists_and_set( "creators" ) ) { my $creators = $eprint->get_value( "creators" ); foreach my $creator ( @$creators ) { next if !defined $creator; # Add ORCID if it exists if( EPrints::Utils::is_set( $creator->{orcid} ) ){ push @dcdata, [ "creator", EPrints::Utils::make_name_string( $creator->{name} ), { 'orcid' => $creator->{orcid} } ]; } else { push @dcdata, [ "creator", EPrints::Utils::make_name_string( $creator->{name} ) ]; } } } if( $eprint->exists_and_set( "subjects" ) ) { my $subjectid; foreach $subjectid ( @{$eprint->get_value( "subjects" )} ) { my $subject = EPrints::DataObj::Subject->new( $plugin->{session}, $subjectid ); # avoid problems with bad subjects next unless( defined $subject ); push @dcdata, [ "subject", EPrints::Utils::tree_to_utf8( $subject->render_description() ) ]; } } push @dcdata, $plugin->simple_value( $eprint, abstract => "description" ); push @dcdata, $plugin->simple_value( $eprint, publisher => "publisher" ); if( $eprint->exists_and_set( "editors_name" ) ) { my $editors = $eprint->get_value( "editors_name" ); if( defined $editors ) { foreach my $editor ( @{$editors} ) { push @dcdata, [ "contributor", EPrints::Utils::make_name_string( $editor ) ]; } } } ## Date for discovery. For a month/day we don't have, assume 01. if( $eprint->exists_and_set( "date" ) ) { my $date = $eprint->get_value( "date" ); if( defined $date ) { $date =~ s/(-0+)+$//; push @dcdata, [ "date", $date ]; } } if( $eprint->exists_and_set( "type" ) ) { push @dcdata, [ "type", EPrints::Utils::tree_to_utf8( $eprint->render_value( "type" ) ) ]; } my $ref = "NonPeerReviewed"; if( $eprint->exists_and_set( "refereed" ) && $eprint->get_value( "refereed" ) eq "TRUE" ) { $ref = "PeerReviewed"; } push @dcdata, [ "type", $ref ]; my @documents = $eprint->get_all_documents(); my $mimetypes = $plugin->{session}->get_repository->get_conf( "oai", "mime_types" ); foreach( @documents ) { my $format = $mimetypes->{$_->get_value("format")}; $format = $_->get_value("format") unless defined $format; #$format = "application/octet-stream" unless defined $format; push @dcdata, [ "format", $format ]; push @dcdata, [ "identifier", $_->get_url() ]; } # Most commonly a DOI or journal link push @dcdata, $plugin->simple_value( $eprint, official_url => "relation" ); # The citation for this eprint push @dcdata, [ "identifier", EPrints::Utils::tree_to_utf8( $eprint->render_citation() ) ]; # The URL of the abstract page if( $eprint->is_set( "eprintid" ) ) { push @dcdata, [ "relation", $eprint->get_url() ]; } # dc.language not handled yet. # dc.source not handled yet. # dc.coverage not handled yet. # dc.rights not handled yet. return \@dcdata; } 1; </source>
Summary:
Please note that all contributions to EPrints Documentation may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
EPrints Documentation:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)