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/BasPlug.pm

    r15006 r15018  
    109109    'type' => "string",
    110110    'reqd' => "no" },
     111      { 'name' => "use_as_doc_identifier",
     112    'desc' => "{BasPlug.use_as_doc_identifier}",
     113    'type' => "string",
     114    'reqd' => "no" ,
     115    'deft' => "" } ,
    111116      { 'name' => "input_encoding",
    112117    'desc' => "{BasPlug.input_encoding}",
     
    867872}
    868873
     874
     875sub add_OID
     876{
     877    my $self = shift (@_); 
     878    my ($doc_obj) = @_;
     879
     880    # See if a metadata field is specified as the field
     881    if ((defined $self->{'use_as_doc_identifier'}) && ($self->{'use_as_doc_identifier'} ne "")) {
     882    my $metadata_doc_id = $self->{'use_as_doc_identifier'};
     883
     884    # Consider "tidying" up metadata_doc_id to be something
     885    # suitable in a URL
     886    # Could even support a user specified plugin RE for this.
     887
     888    my $top_section = $doc_obj->get_top_section();
     889    my $oid = $doc_obj->get_metadata_element($top_section,$metadata_doc_id);
     890##  print STDERR "**** oid = $oid\n";
     891        $doc_obj->set_OID($oid);
     892    }
     893    # See if there is a plugin-specific set_OID function...
     894    elsif (defined ($self->can('set_OID'))) {
     895    # it will need $doc_obj to set the Identifier metadata...
     896    $self->set_OID(@_); # pass through any extra arguments supplied
     897    } else {
     898    # use the default set_OID() in doc.pm
     899    $doc_obj->set_OID();
     900    }
     901}
    869902
    870903# The BasPlug read_into_doc_obj() function. This function does all the
     
    957990    # do any automatic metadata extraction
    958991    $self->auto_extract_metadata ($doc_obj);
    959    
    960     # add an OID
    961     # see if there is a plugin-specific set_OID function...
    962     if (defined ($self->can('set_OID'))) {
    963     # it will need $doc_obj to set the Identifier metadata...
    964     $self->set_OID($doc_obj);
    965     } else {
    966     # use the default set_OID() in doc.pm
    967     $doc_obj->set_OID();
    968     }
     992
     993    $self->add_OID($doc_obj);
    969994   
    970995    return (1,$doc_obj);
Note: See TracChangeset for help on using the changeset viewer.