various updates to make lookups work (but they don't still)
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 15 Dec 2005 14:12:00 +0000 (14:12 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 15 Dec 2005 14:12:00 +0000 (14:12 +0000)
git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@251 07558da8-63fa-0310-ba24-9fe276d99e06

conf/log.conf
conf/lookup/jzav.yml
conf/normalize/isis_ffzg.xml
conf/output/tt/html_ffzg_results_nonstd.tt
lib/WebPAC/Input/ISIS.pm
lib/WebPAC/Lookup.pm
run.pl

index 9d15e55..6f8da85 100644 (file)
@@ -16,13 +16,14 @@ log4perl.logger.main=INFO
 #log4perl.logger.WebPAC.Store.load_ds=DEBUG
 
 #log4perl.logger.WebPAC.Lookup=DEBUG
+log4perl.logger.WebPAC.Lookup.lookup=DEBUG
 
 #log4perl.logger.WebPAC.Input=DEBUG
 #log4perl.logger.WebPAC.Input.ISIS=DEBUG
 #log4perl.logger.WebPAC.Input.ISIS.fetch=DEBUG
 #log4perl.logger.WebPAC.Input.ISIS.open=DEBUG
 
-#log4perl.logger.WebPAC.Normalize=DEBUG
+log4perl.logger.WebPAC.Normalize=DEBUG
 #log4perl.logger.WebPAC.Normalize.XML=DEBUG
 #log4perl.logger.WebPAC.Normalize.data_structure=DEBUG
 #log4perl.logger.WebPAC.Normalize.fill_in_to_arr=DEBUG
index d293ebb..11925df 100644 (file)
@@ -3,7 +3,7 @@ lookup:
   - key: 'tip:v900'
     val: 'v200^a'
     eval: '"v909" eq "1"'
-  - kay: 'naslov:v900'
+  - key: 'naslov:v900'
     val: 'v200^a : v200^e'
     eval: '"v909" eq "2"'
   - key: 'tip-naslovi:v946^1'
index 52b0993..8cf2e9f 100644 (file)
                <isis>v856^u</isis>
        </URL>
 
+       <Set_2>
+               <isis>[naslov:v946^1]</isis>
+       </Set_2>
+
+       <Parts>
+               <isis>lookup{[tip-naslovi:v946^1]}</isis>
+       </Parts>
+       
        <CallNo>
                <isis>v990</isis>
        </CallNo>
                <!-- added via xml tag in .conf -->
                <config type="display">materialtype</config>
                <config type="swish">material_code</config>
-               <isis type="swish">200e</isis>
+               <isis type="swish">v200^e</isis>
        </type>
        
        <form name="Format: " order="101">
index 241b5e6..99b2f92 100644 (file)
                        <b>Tema: </b>
                        [% search('UncontrolledTerms','UncontrolledTerms',' * ') %] 
        [% END %]
-     
+
+       [% d('Parts') %]        
+
        <!--
-    [% IF d('UDC') %]
-       [% d('UDC') %] (UDK)
-    [% END %]
+       [% IF d('UDC') %]
+               [% d('UDC') %] (UDK)
+       [% END %]
        -->
        
        [% IF d('APA') %]
index 5ab2a76..061c48f 100644 (file)
@@ -76,7 +76,7 @@ sub open {
        $log->logcroak("need filename") if (! $arg->{'filename'});
        my $code_page = $arg->{'code_page'} || '852';
 
-       $log->logdie("can't find database ",$arg->{'filename'}) unless (glob($arg->{'filename'}.'.*'));
+       #$log->logdie("can't find database ",$arg->{'filename'}) unless (glob($arg->{'filename'}.'.*'));
 
        # store data in object
        $self->{'isis_code_page'} = $code_page;
@@ -194,7 +194,7 @@ sub open {
                }
 
                # create lookup
-               $self->{'lookup'}->add( $rec ) if ($self->{'lookup'} && can($self->{'lookup'}->add));
+               $self->{'lookup'}->add( $rec ) if ($rec && $self->{'lookup'});
 
                $self->progress_bar($mfn,$maxmfn);
 
index 798cec5..fc1001d 100644 (file)
@@ -79,17 +79,18 @@ sub new {
        } else {
                $log->logide("unsupported lookup file $lookup_file");
        }
+       $log->debug("lookup_def: " . Dumper( $self->{lookup_def} ));
 
        $log->logconfess("lookup config file isn't ARRAY but ", sub { Dumper( $self->{'lookup_def'} ) }) if ($self->{'lookup_def'} !~ /ARRAY/o);
 
-       $self->{'is_lookup_regex'} ||= 'lookup{[^\{\}]+}';
+       $self->{'is_lookup_regex'} ||= 'lookup{\[[^\{\}]+\]}';
         $self->{'save_lookup_regex'} ||= 'lookup{([^\{\}]+)}';
 
 
        $self->{'LOOKUP_REGEX'} = qr/$self->{'is_lookup_regex'}/;
        $self->{'LOOKUP_REGEX_SAVE'} = qr/$self->{'save_lookup_regex'}/;
 
-       $log->debug("regexps: ", $self->{'LOOKUP_REGEX'}, " ", $self->{'LOOKUP_REGEX_SAVE'});
+       $log->debug("regexps lookup:", $self->{'LOOKUP_REGEX'}, " save:", $self->{'LOOKUP_REGEX_SAVE'});
 
        $self ? return $self : return undef;
 }
@@ -104,7 +105,7 @@ Returns true if this record produced lookup.
 
 =cut
 
-sub add($) {
+sub add {
        my $self = shift;
 
        my $log = $self->_get_logger();
@@ -116,8 +117,8 @@ sub add($) {
        my $n = 0;
 
        foreach my $i (@{ $self->{'lookup_def'} }) {
-               $log->logconfess("need key") unless defined($i->{'key'});
-               $log->logconfess("need val") unless defined($i->{'val'});
+               $log->logconfess("need key in ", Dumper($i) ) unless defined($i->{'key'});
+               $log->logconfess("need val in ", Dumper($i) ) unless defined($i->{'val'});
 
                $n++;
 
diff --git a/run.pl b/run.pl
index e4241c1..77c29a2 100755 (executable)
--- a/run.pl
+++ b/run.pl
@@ -77,6 +77,7 @@ while (my ($database, $db_config) = each %{ $config->{databases} }) {
                my $isis = new WebPAC::Input::ISIS(
                        code_page => $config->{webpac}->{webpac_encoding},
                        limit_mfn => $input->{limit},
+                       lookup => $lookup,
                );
 
                my $maxmfn = $isis->open(
@@ -84,6 +85,8 @@ while (my ($database, $db_config) = each %{ $config->{databases} }) {
                        code_page => $input->{encoding},        # database encoding
                );
 
+$log->info( Dumper($lookup->{_lookup_data}) );
+
                my $n = new WebPAC::Normalize::XML(
                #       filter => { 'foo' => sub { shift } },
                        db => $db,