Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

Commit

Permalink
general case for config
Browse files Browse the repository at this point in the history
  • Loading branch information
Borys Feldman committed Sep 19, 2017
1 parent 2b68f3d commit 93d93ff
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 99 deletions.
75 changes: 59 additions & 16 deletions cfg/cfg.d/z_datacitedoi.pl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use Data::Dumper;

#Enable the plugin
$c->{plugins}{"Export::DataCiteXML"}{params}{disable} = 0;
$c->{plugins}{"Event::DataCiteEvent"}{params}{disable} = 0;
Expand All @@ -15,27 +13,24 @@

#set these (you will get the from data site)
# doi = {prefix}/{repoid}/{eprintid}
#$c->{datacitedoi}{prefix} = "10.5072";
$c->{datacitedoi}{prefix} = "10.17864";
$c->{datacitedoi}{repoid} = "1947";
$c->{datacitedoi}{apiurl} = "https://mds.datacite.org/";
#$c->{datacitedoi}{apiurl} = "https://mds.test.datacite.org/";
$c->{datacitedoi}{user} = "BL.READING";
$c->{datacitedoi}{pass} = "rdawk201";
$c->{datacitedoi}{prefix} = "10.5072";
$c->{datacitedoi}{repoid} = $c->{host};
$c->{datacitedoi}{apiurl} = "https://test.datacite.org/mds/";
$c->{datacitedoi}{user} = "USER";
$c->{datacitedoi}{pass} = "PASS";

# datacite requires a Publisher
# The name of the entity that holds, archives, publishes,
# prints, distributes, releases, issues, or produces the
# resource. This property will be used to formulate the
# citation, so consider the prominence of the role.
# eg World Data Center for Climate (WDCC);
$c->{datacitedoi}{publisher} = "University of Reading";
$c->{datacitedoi}{publisher} = "Eprints Repo";

# Namespace and location for datacite XML schema
# feel free to update, though no guarantees it'll be accepted if you do
#$c->{datacitedoi}{xmlns} = "http://datacite.org/schema/kernel-2.2";
$c->{datacitedoi}{xmlns} = "http://datacite.org/schema/kernel-4";
$c->{datacitedoi}{schemaLocation} = $c->{datacitedoi}{xmlns}." http://schema.datacite.org/meta/kernel-4/metadata.xsd";
$c->{datacitedoi}{xmlns} = "http://datacite.org/schema/kernel-4.0";
$c->{datacitedoi}{schemaLocation} = $c->{datacitedoi}{xmlns}." http://schema.datacite.org/meta/kernel-4.0/metadata.xsd";

# need to map eprint type (article, dataset etc) to ResourceType
# Controled list http://schema.datacite.org/meta/kernel-2.2/doc/DataCite-MetadataKernel_v2.2.pdf
Expand Down Expand Up @@ -71,7 +66,7 @@
$c->{datacitedoi}{allow_custom_doi} = 0;

#Datacite recommend digits of length 8-10 set this param to pad the id to required length
$c->{datacitedoi}{zero_padding} = 0;
$c->{datacitedoi}{zero_padding} = 8;

##########################################
### Override which URL gets registered ###
Expand Down Expand Up @@ -104,7 +99,7 @@

return undef if (!defined $repository);

if (defined %params->{dataobj}) {
if (defined $params{dataobj}) {
my $dataobj = $params{dataobj};
my $eprint_id = $dataobj->id;
$repository->dataset( "event_queue" )->create_dataobj({
Expand All @@ -124,4 +119,52 @@
}


#With this we effectively turn off the repo_link => relatedIdentifier mapping for this repository



#BF sub method for can call for funder
$c->{datacite_custom_funder} = sub
{

my ( $xml, $entry, $dataobj ) = @_;

if ($dataobj->exists_and_set( "funders" )) {
my $funders = $dataobj->get_value( "funders" );
my $thefunders = $xml->create_element( "funders" );
foreach my $funder ( @$funders )
{
my $fund = $funder->{funders};
my $grant = $funder->{grant};
my $others = $dataobj->get_value( "funders_other_funder" );
if($fund eq "other"){
foreach my $other ( @$others )
{

$thefunders->appendChild( $xml->create_data_element( "funderName", $other) );
}} else {
$thefunders->appendChild( $xml->create_data_element( "funderName", $fund) );
}

$thefunders->appendChild( $xml->create_data_element( "awardNumber", $grant) );


}
$entry->appendChild( $thefunders );
}
};


#BF sub method for can call for language
$c->{datacite_custom_language} = sub
{
my ( $xml, $entry, $dataobj ) = @_;

my $lan = $dataobj->get_value( "language" );
if ($dataobj->exists_and_set( "language" )) {
foreach my $la ( @$lan )
{
my $thelanguage = $la->{l};
$entry->appendChild( $xml->create_data_element( "language", $thelanguage) );
}
}
}
83 changes: 0 additions & 83 deletions lib/cfg.d/zzz_datacite_mapping.pl

This file was deleted.

0 comments on commit 93d93ff

Please sign in to comment.