Changeset 8220


Ignore:
Timestamp:
2004-10-06T05:36:52+13:00 (20 years ago)
Author:
cs025
Message:

Extensions to underpin OAI - e.g. creation of the OAI classifier, adding
modified file dates and ensuring that documents know the parent classifiers
to which they belong.

Location:
trunk/gsdl/perllib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/classify.pm

    r7346 r8220  
    2929
    3030require util;
     31require AllList;
    3132use gsprintf;
    3233
     
    6768    my ($classify_list, $build_dir, $outhandle) = @_;
    6869    my @classify_objects = ();
     70    my $classify_number  = 1;
    6971   
    7072    foreach $classifyoption (@$classify_list) {
     
    113115    die "$@" if $@;
    114116
     117    $classobj->set_number($classify_number);
     118    $classify_number ++;
     119
    115120        # add this object to the list
    116121    push (@classify_objects, $classobj);
    117122    }
     123
     124    my ($classobj);
     125    eval ("\$classobj = new AllList()");
     126    die "$@" if $@;
     127    push (@classify_objects, $classobj);
    118128
    119129    return \@classify_objects;
     
    135145   
    136146    foreach $classobj (@$classifiers) {
     147    my $title = $classobj->{'title'};
    137148    $classobj->classify($doc_obj);
    138149    }
     
    152163
    153164    # get each of the classifications
    154     foreach $classobj (@$classifiers) {
     165    CLASSIFIER: foreach $classobj (@$classifiers) {
    155166    my $tempinfo = $classobj->get_classify_info($gli);
    156     $tempinfo->{'classifyOID'} = "CL$next_classify_num";
     167    my $classID = $tempinfo->{'classifyOID'};
     168
     169    if ((defined $classID) && ($classID eq "oai")) {
     170        next CLASSIFIER;
     171    }
     172    $tempinfo->{'classifyOID'} = "CL$next_classify_num" unless defined($tempinfo->{'classifyOID'});
    157173    $next_classify_num++;
    158174    push (@{$classifyinfo->{'contains'}}, $tempinfo);
     
    188204    $outputtext .= "<parameters>$classifyinfo->{'parameters'}\n"
    189205        if defined $classifyinfo->{'parameters'};
     206    $outputtext .= "<supportsmemberof>$classifyinfo->{'supportsmemberof'}\n"
     207        if defined $classifyinfo->{'supportsmemberof'};
    190208   
    191209    my $contains_text = "<contains>";
  • trunk/gsdl/perllib/doc.pm

    r7929 r8220  
    3737use util;
    3838use ghtml;
     39use File::stat;
    3940##use hashdoc;
    4041
     
    5556              'text'=>"",
    5657              'OIDtype'=>"hash"}, $class;
     58
     59    #GRB: Added code to set lastmodified for OAI purposes
     60    if ((defined $doc_type) && (defined $source_filename) && (-e $source_filename)) {
     61    my $file_stat = stat($source_filename);
     62    my $mtime = $file_stat->mtime;
     63    $self->add_utf8_metadata($self->get_top_section(), "lastmodified", $file_stat->mtime);
     64    }
     65    #GRB: end inserted code
    5766
    5867    if (defined $source_filename) {
     
    10511060
    10521061# add_metadata assumes the text is in (extended) ascii form. For
    1053 # text which hash been already converted to the UTF-8 format use
     1062# text which has already been converted to the UTF-8 format use
    10541063# add_utf8_metadata.
    10551064sub add_metadata {
  • trunk/gsdl/perllib/mgbuildproc.pm

    r6767 r8220  
    281281    $archivedir =~ s/\/+$//;
    282282
     283    # resolve the final filenames of the files associated with this document
    283284    $self->assoc_files ($doc_obj, $archivedir);
     285
     286    #GRB: moved 1/06/2004 from GRB01062004
     287    #add this document to the browse structure
     288    push(@{$self->{'doclist'}},$doc_obj->get_OID())
     289    unless ($doctype eq "classification");
     290
     291    # classify this document
     292    &classify::classify_doc ($self->{'classifiers'}, $doc_obj);
     293    #GRB: end of moved block
    284294
    285295    # this is another document
     
    401411    }
    402412
    403     #add this document to the browse structure
    404     push(@{$self->{'doclist'}},$doc_obj->get_OID())
    405     unless ($doctype eq "classification");
    406 
    407     # classify this document
    408     &classify::classify_doc ($self->{'classifiers'}, $doc_obj);
    409 
     413    #GRB01062004: see code above moved from here
    410414}
    411415
  • trunk/gsdl/perllib/mgppbuildproc.pm

    r7090 r8220  
    324324    $archivedir =~ s/\/+$//;
    325325
     326    # resolve the final filenames of the files associated with this document
    326327    $self->assoc_files ($doc_obj, $archivedir);
     328
     329    #GRB: moved 1/06/2004 from GRB01062004
     330    #add this document to the browse structure
     331    push(@{$self->{'doclist'}},$doc_obj->get_OID())
     332    unless ($doctype eq "classification");
     333
     334    # classify this document
     335    &classify::classify_doc ($self->{'classifiers'}, $doc_obj);
     336    #GRB: end of moved block
    327337
    328338    # this is another document
     
    451461    }
    452462
    453     #add this document to the browse structure
    454     push(@{$self->{'doclist'}},$doc_obj->get_OID())
    455     unless ($doctype eq "classification");
    456 
    457     # classify this document
    458     &classify::classify_doc ($self->{'classifiers'}, $doc_obj);
    459 
     463    #GRB01062004: see code above moved from here
    460464}
    461465
Note: See TracChangeset for help on using the changeset viewer.