Changeset 24402

Show
Ignore:
Timestamp:
12.08.2011 18:00:18 (8 years ago)
Author:
ak19
Message:

DSpacePlugout modified to make use of embedded dc (ex.dc) metadata for those metadata fields for which dc.meta was not assigned. Tested with DSpace example re-exported as DSpace.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugouts/DSpacePlugout.pm

    r23824 r24402  
    6161    my $self = new BasePlugout($plugoutlist,$inputargs,$hashArgOptLists);     
    6262 
    63     print STDERR "***** metadata prefix = \"", $self->{'metadata_prefix'}, "\"\n"; 
     63#    print STDERR "***** metadata prefix = \"", $self->{'metadata_prefix'}, "\"\n"; 
    6464 
    6565    return bless $self, $class; 
     
    8989    my $metadata_hashmap = $doc_obj->get_metadata_hashmap($doc_obj->get_top_section(), 
    9090                                                          $metadata_prefix); 
     91 
     92    if(defined $metadata_prefix && $metadata_prefix ne "") { 
     93    # merge dc with any ex.dc 
     94 
     95    my $ex_dc_metadata_hashmap = $doc_obj->get_metadata_hashmap($doc_obj->get_top_section(), 
     96                                                          "ex.dc"); 
     97 
     98    foreach my $metaname (keys %$ex_dc_metadata_hashmap) { 
     99        my $metaname_without_ex_prefix = $metaname; 
     100        $metaname_without_ex_prefix =~ s/^ex\.(.*)/$1/; # remove any ex from the ex.dc prefix 
     101 
     102        # if there's an ex.dc value for a metaname for which no dc 
     103        # value was assigned, put the ex.dc value into the hashmap 
     104        if(!defined $metadata_hashmap->{$metaname_without_ex_prefix}) {  
     105        $metadata_hashmap->{$metaname_without_ex_prefix} = []; 
     106        push(@{$metadata_hashmap->{$metaname_without_ex_prefix}},@{$ex_dc_metadata_hashmap->{$metaname}});  
     107        } 
     108    } 
     109 
     110    } 
    91111 
    92112    foreach my $metaname (keys %$metadata_hashmap) { 
     
    217237 
    218238    my $metadata_prefix_list = $self->{'metadata_prefix'}; 
    219     print STDERR "***!! md prefix = $metadata_prefix_list\n"; 
     239#    print STDERR "***!! md prefix = $metadata_prefix_list\n"; 
    220240 
    221241    my @metadata_prefixes = split(/,\s*/,$metadata_prefix_list);