Ignore:
Timestamp:
2008-02-27T17:07:17+13:00 (16 years ago)
Author:
davidb
Message:

Marc mapping upgraded to support richer set of operations, including subfields, multiple fields in one line (separated by comma), and the removal of rules, e.g. -245 at the start of a line. A Marc to Qualified Dublin Core crosswalk from the Library of congress has been added as "etc/marc2qdc.txt". A collection can then choose to, for example, top up the mapping with its own version of the file stored in its local "etc" folder, specifying only the rules that are different. This is where a rule like "-245" might be used to override a more general rule from the main file that has all subfields in 245 mapping to one metadata item (Title). If the user specifies a different different filename -- through a plugin option -- then they are free to divise a mapping from scratch and store it in the collections local "etc" folder.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/plugins/MARCPlug.pm

    r14964 r15018  
    4545    'type' => "string",
    4646    'deft' => "marctodc.txt",
     47    'hiddengli' = "yes", # deprecated in favour or 'metadata_mapping_file'
     48    'reqd' => "no" },
     49      { 'name' => "metadata_mapping_file",
     50    'desc' => "{MARCXMLPlug.metadata_mapping_file}",
     51    'type' => "string",
     52    'deft' => "",
    4753    'reqd' => "no" },
    4854      { 'name' => "process_exp",
     
    8086    my $self = new SplitPlug($pluginlist, $inputargs, $hashArgOptLists);
    8187
     88    # 'metadata_mapping' was used in two ways in the plugin: as a plugin
     89    # option (filename) and as a datastructure to represent the mapping.
     90    # In MARXXMLPlug (written later) the two are separated: filename is
     91    # represented through 'metadata_mapping_file' and the data-structure
     92    # mapping left as 'metadata_mapping'
     93    # 'metadata_mapping' still present (but hidden in GLI) for
     94    # backwards compatibility, but 'metadata_mapping_file' is used by
     95    # preference
     96
     97    if ($self->{'metadata_mapping_file'} eq "") {
     98    # If nothing set in the new version, use the old version
     99    # that defaults to 'marctodc.txt'
     100    $self->{'metadata_mapping_file'} = $self->{'metadata_mapping'};
     101    }
     102
    82103    $self->{'type'} = "";
    83104   
     
    92113
    93114    # read in the metadata mapping file
    94     my $mm_file =
    95     &util::filename_cat( $ENV{'GSDLHOME'}, "etc", $self->{'metadata_mapping'} );
    96 
    97     if (!-e $mm_file)
     115
     116    my $mm_file = &util::locate_config_file($self->{'metadata_mapping_file'});
     117
     118    if (!defined $mm_file)
    98119    {
    99120
    100121    my $msg = "MARCPlug ERROR: Can't locate mapping file \"" .
    101         $self->{'metadata_mapping'} . "\".\n    This file should be at $mm_file\n" .
     122        $self->{'metadata_mapping_file'} . "\".\n" .
    102123        "    No marc files can be processed.\n";
    103124
     
    131152    }
    132153    close(MMIN);
     154
     155    $self->{'metadata_mapping'} = \@metadata_mapping;
    133156    }
    134157    else
     
    137160    }
    138161
    139     $self->{'metadata_mapping'} = \@metadata_mapping;
     162
    140163
    141164    $self->SUPER::init(@_);
Note: See TracChangeset for help on using the changeset viewer.