Ignore:
Timestamp:
2006-09-25T14:17:10+12:00 (18 years ago)
Author:
mdewsnip
Message:

Incremental building and dynamic GDBM updating code, many thanks to John Rowe and John Thompson at DL Consulting Ltd.

File:
1 edited

Legend:

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

    r12559 r12844  
    4343
    4444$next_classify_num = 1;
     45$oid_to_clids = {};
     46
    4547sub load_classifier_for_info {
    4648    my ($classifier) = shift @_;
     
    302304    $tempinfo->{'classifyOID'} = "CL$next_classify_num" unless defined($tempinfo->{'classifyOID'});
    303305    $next_classify_num++;
     306
     307        print STDERR "*** outputting information for classifier: $tempinfo->{'classifyOID'}\n";
     308
    304309    push (@{$classifyinfo->{'contains'}}, $tempinfo);
    305310    }
     
    357362        $contains_text .= $tempinfo->{'classifyOID'};
    358363        }
     364
     365            # Extra code for incremental building.
     366            # We need to store a listing of the classifiers each DOI is in
     367            my $clids = [];
     368            #rint STDERR "==1. Recording reverse lookup for " . $tempinfo->{'classifyOID'} . "==\n";
     369            if(defined($oid_to_clids->{$tempinfo->{'classifyOID'}})) {
     370              #rint STDERR "Found existing array!\n";
     371              $clids = $oid_to_clids->{$tempinfo->{'classifyOID'}};
     372            }
     373            #rint STDERR "Appended $OID to \"" . join(";", @{$clids}) . "\"\n";
     374            push(@{$clids}, $OID);
     375            $oid_to_clids->{$tempinfo->{'classifyOID'}} = $clids;
     376            #rint STDERR "Result: \"" . join(";", @{$clids}) . "\"\n";
     377           
    359378        &print_classify_info ($handle, $tempinfo, $tempinfo->{'classifyOID'},
    360379                  $remove_empty_classifications);
    361380    } elsif (defined ($tempinfo->{'OID'})) {
    362381        $contains_text .= $tempinfo->{'OID'};
    363         $mdoffset_text .= $tempinfo->{'offset'}
    364         if (defined ($tempinfo->{'offset'}))
    365         # note: we don't want to print the contents of the books
     382        $mdoffset_text .= $tempinfo->{'offset'} if (defined ($tempinfo->{'offset'}));
     383
     384           
     385              # note: we don't want to print the contents of the books
     386              # Extra code for incremental building.
     387              # We need to store a listing of the classifiers each DOI is in
     388              my $clids = [];
     389              #rint STDERR "==2. Recording reverse lookup for " . $tempinfo->{'OID'} . "==\n";
     390              if(defined($oid_to_clids->{$tempinfo->{'OID'}})) {
     391                #rint STDERR "Found existing array!\n";
     392                $clids = $oid_to_clids->{$tempinfo->{'OID'}};
     393              }
     394              #rint STDERR "Appended $OID to \"" . join(";", @{$clids}) . "\"\n";
     395              push(@{$clids}, $OID);
     396              $oid_to_clids->{$tempinfo->{'OID'}} = $clids;
     397              #rint STDERR "Result: \"" . join(";", @{$clids}) . "\"\n";
     398
     399
    366400        } else {
    367401       
     
    373407            $contains_text .= "\".$next_subOID";
    374408        }
     409
     410                # Extra code for incremental building.
     411                # We need to store a listing of the classifiers each DOI is in
     412                my $clids = [];
     413                #rint STDERR "==3. Recording reverse lookup for $OID.$next_subOID==\n";
     414                if(defined($oid_to_clids->{$OID . "." . $next_subOID})) {
     415                  #rint STDERR "Found existing array!\n";
     416                  $clids = $oid_to_clids->{$OID . "." . $next_subOID};
     417                }
     418                #rint STDERR "Appended $OID to \"" . join(";", @{$clids}) . "\"\n";
     419                push(@{$clids}, $OID);
     420                $oid_to_clids->{$OID . "." . $next_subOID} = $clids;
     421                #rint STDERR "Result: \"" . join(";", @{$clids}) . "\"\n";
    375422       
    376423        &print_classify_info ($handle, $tempinfo, "$OID.$next_subOID",
Note: See TracChangeset for help on using the changeset viewer.