/[webpac]/trunk2/all2all.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk2/all2all.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 363 by dpavlin, Wed Jun 16 20:05:19 2004 UTC revision 398 by dpavlin, Sat Jul 24 13:48:08 2004 UTC
# Line 12  use Carp; Line 12  use Carp;
12    
13  use lib './lib';  use lib './lib';
14  use WebPAC;  use WebPAC;
15    use WebPAC::jsFind;
16    
17  my $webpac = new WebPAC(  my $webpac = new WebPAC(
18          code_page => 'ISO-8859-2',          code_page => 'ISO-8859-2',
19          limit_mfn => 500,          limit_mfn => 100,
20          debug => 1,  #       debug => 1,
21    ) || die;
22    
23    my $log = $webpac->_get_logger();
24    
25    my $index = new WebPAC::jsFind(
26            index_path => './out/index',
27  ) || die;  ) || die;
28    
29  $|=1;  $|=1;
# Line 29  my $maxmfn = $webpac->open_isis( Line 36  my $maxmfn = $webpac->open_isis(
36  #       { 'eval '=> '"v901^a" eq "Mikrotezaurus"', 'key' => 'a:v561^4:v562^4:v461^1', 'val' => 'v900' },  #       { 'eval '=> '"v901^a" eq "Mikrotezaurus"', 'key' => 'a:v561^4:v562^4:v461^1', 'val' => 'v900' },
37  #       { 'eval' => '"v901^a" eq "Deskriptor"', 'key' => 'a:v561^4:v562^4:v461^1', 'val' => 'v900' },  #       { 'eval' => '"v901^a" eq "Deskriptor"', 'key' => 'a:v561^4:v562^4:v461^1', 'val' => 'v900' },
38          { 'key' => 'a:v561^4:v562^4:v461^1', 'val' => 'v900' },          { 'key' => 'a:v561^4:v562^4:v461^1', 'val' => 'v900' },
39            { 'key' => '900_mfn:v900', 'val' => 'v000' },
40          ],          ],
41  );  );
42    
43  print "rows: $maxmfn\n\n";  $log->info("rows: $maxmfn");
44    
45  $webpac->open_import_xml(type => 'isis_hidra_ths');  $webpac->open_import_xml(type => 'isis_hidra_ths');
46    
47  while (my $rec = $webpac->fetch_rec) {  while (my $rec = $webpac->fetch_rec) {
48    
49          print "-- ",$webpac->parse($rec,'v250^a / [v562^4] v562^a'),"\n";          my @ds = $webpac->data_structure($rec);
50    
51          print " ",          if ($log->is_debug) {
52                  $webpac->parse($rec,'eval{v901^a eq "Deskriptor"}v250^a / [v562^4] v562^a'),                  $log->debug("rec = ",Dumper($rec));
53                  $webpac->parse($rec,'eval{v901^a ne "Deskriptor"}250a [251]'),                  $log->debug("ds = ",Dumper(\@ds));
54                  "\n";          }
55    
56            next if (! @ds);
57    
58            my $filename = $webpac->{'current_filename'};
59    
60            if ($filename) {
61                    open(OUT,"> $filename") || $log->logdie("can't open output '$filename': $!");
62                    print OUT $webpac->output(
63                            template => 'html.tt',
64                            data => \@ds,
65                            headline => $webpac->{'headline'},
66                    );
67                    close(OUT);
68            } else {
69                    print $webpac->output(
70                            template => 'text.tt',
71                            data => \@ds,
72                            headline => $webpac->{'headline'},
73                    );
74            }
75    
76            my $headline = $webpac->{'headline'};
77    
78            my $f = $filename;
79            $f =~ s!out/!!;
80    
81            # save into index
82            foreach my $ds (@ds) {
83                    next if (! $ds->{'swish'});
84    
85                    $index->insert(
86                            index_name => $ds->{'tag'},
87                            path => $f,
88                            headline => $headline,
89                            words => join(" ",@{$ds->{'swish'}})
90                    );
91            }
92    
93          my @t = $webpac->fill_in($rec,'v553^1;;v553^a');  #       print Dumper(\@ds);
         print " Uži pojam: ",join("\t\n",@t),"\n" if (@t);  
94    
95          @t = $webpac->fill_in($rec,'eval{v901^a eq "Područje"}[a:v251::];;[d:[a:v251::]]');  }
         print " Područje: ",join("\t\n",@t),"\n" if (@t);  
   
         @t = $webpac->fill_in($rec,'eval{v901^a eq "Mikrotezaurus"}[a:v561^4:v251:];;[d:[a:v561^4:v251:]]');  
         print " Mikrotezaurus: ",join("\t\n",@t),"\n" if (@t);  
96    
97          @t = $webpac->fill_in($rec,'eval{v901^a eq "Deskriptor"}[a:v561^4:v562^4:v900];;[d:[a:v561^4:v562^4:v900]]');  if ($log->is_debug) {
98          print " Deskriptor: ",join("\t\n",@t),"\n" if (@t);          $log->debug("lookup hash: ",Dumper($webpac->{'lookup'}));
99            $log->debug("data hash: ",Dumper($webpac->{'data'}));
100  }  }
101    
102  print "## lookup ",Dumper($webpac->{'lookup'});  $index->close;
103  print "## data ",Dumper($webpac->{'data'});  

Legend:
Removed from v.363  
changed lines
  Added in v.398

  ViewVC Help
Powered by ViewVC 1.1.26