/[webpac-proto]/isis2stream.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

Annotation of /isis2stream.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (hide annotations)
Sun Jun 16 18:11:14 2002 UTC (17 years, 5 months ago) by dpavlin
Branch: MAIN
Changes since 1.6: +81 -14 lines
File MIME type: text/plain
support for all LIBRI, separate configuraiton files, script for
test of config files

1 dpavlin 1.1 #!/usr/bin/perl -w
2    
3     use strict;
4     use OpenIsis;
5     use Getopt::Std;
6 dpavlin 1.7 use Data::Dumper;
7 dpavlin 1.4 use common;
8 dpavlin 1.1
9     my %opts;
10    
11 dpavlin 1.4 getopt('dm', \%opts);
12 dpavlin 1.1
13 dpavlin 1.4 die "usage: $0 -d [database_dir] -m [database1,database2] " if (! %opts);
14 dpavlin 1.1
15     my $db_dir = $opts{d};
16    
17 dpavlin 1.4 mkdir "$common::install_dir/$db_dir" if (!-e "$common::install_dir/$db_dir");
18     mkdir "$common::install_dir/$db_dir/data" if (!-e "$common::install_dir/$db_dir/data");
19 dpavlin 1.1
20 dpavlin 1.4 my $dir="$common::install_dir/$db_dir/data";
21 dpavlin 1.1
22    
23 dpavlin 1.4 open(S,"> $dir/stream") || die "can't open output $dir/stream: $!";
24 dpavlin 1.1 open(R,"> $dir/bib") || die "can't open output $dir/bib: $!";
25 dpavlin 1.4 open(MPS,"| $common::mpsindex -d $common::install_dir/$db_dir -autokey") || die "can't start MPS indexer $common::mpsindex: $!";
26 dpavlin 1.1 #open(MPS,"> /tmp/mpsindex") || die "mps: $!";
27    
28 dpavlin 1.4 print S $common::mps_header;
29     print MPS $common::mps_header;
30 dpavlin 1.1
31     #
32     # expand(nr,"space separated string");
33     #
34    
35     sub expand {
36     my $nr = shift @_;
37     my $out = "";
38     while (my $fld = c_852_iso(shift @_)) {
39     my @words=split(/\s+/,$fld);
40     foreach my $w (@words) {
41     # FIX: this should be replaced by stemmer!
42     #$w =~ tr/¹©ðÐèÈæƾ®/sSdDcCcCzZ/;
43     $w =~ tr/Çüéâäùæç³ëÕõî¬ÄÆÉÅåôö¥µ¦¶ÖÜ«»£èáíóú¡±®¾Êê¼ÈºÁÂ̪¯¿ÃãðÐÏËïÒÍÎìÞÙÓÔÑñò©¹ÀÚàÛýÝþ´­½²·¢¸¨ÿØø/CueaauccleOoiZACELlooLlSsOUTtLcaiouAaZzEezCsAAESZzAadDDEdNIIeTUOoNnnSsRUrUyYt'-".'',"'Rr/;
44     $w =~ s/ß/ss/g;
45     $out .= "W $w $nr\n";
46     }
47     }
48     return $out;
49     }
50    
51     #--------------------------------------------------------------------
52    
53     ################### ERASE###############3
54    
55     # expand sub-fileds from ISIS field
56     # (^a.....^b....)
57     my %data; # FIX
58     sub ex_sf {
59     %data = ();
60     my $in = $_[0];
61     if (my $tmp = $in) {
62     # $tmp =~ tr/çæÐџ¬†§¦/¹©ðÐèÈæƾ®/; # ISIS -> iso-8859-2
63     $tmp =~ tr/€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúüýþÿ/Çüéâäùæç³ëÕõî¬ÄÆÉÅåôö¥µ¦¶ÖÜ«»£×èáíóú¡±®¾ÊꔼȺ—„•’ˆƒÁÂ̪‡€œ›¯¿‹Ÿ–˜Ž‘Ã㍐…†“™ž¤ðÐÏËïÒÍÎ슂‰šÞٝÓßÔÑñò©¹ÀÚàÛýÝþ´­½²·¢§÷¸°¨ÿØøŒ /;
64     if ($in =~ m/^\^/) {
65     my @sub = split(/\^/,$in);
66     foreach my $fld (@sub) {
67     $data{$1} = $2 if ($fld =~ m/^(\w+)(.+)$/)
68     }
69     } else {
70     $data{all} = $in."<-- iz polja bez podpolja";
71     }
72     }
73     }
74    
75     # dump all sub-fields
76     sub all_sf {
77     my $nr = shift @_;
78     my $out="";
79     foreach my $k (sort keys %data) {
80     $out.=expand($nr,$data{$k});
81     }
82     return $out;
83     }
84    
85     sub all_sf_r {
86     my $nr = shift @_;
87     my $out="";
88     foreach my $k (sort {$b cmp $a} keys %data) {
89     $out.=expand($nr,$data{$k});
90     }
91     return $out;
92     }
93    
94     sub all_sf2bib {
95     my $nr = shift @_;
96     my $max_in_line=shift @_ || 0;
97     my $sep = shift @_ || ' ';
98     my $out;
99     my $i=0;
100     my $bib = "";
101     foreach my $k (sort keys %data) {
102     if ($out) {
103     $out.= $sep.$data{$k};
104     } else {
105     $out = $data{$k};
106     }
107     $i++;
108     if ($i == $max_in_line) {
109     $bib .= $nr." ".$out."\n" if ($out);
110     $i=0;
111     $out="";
112     }
113     }
114     $bib .= $nr." ".$out."\n" if ($out);
115     return $bib;
116     }
117    
118     sub all_sf2bib_r {
119     my $nr = shift @_;
120     my $max_in_line=shift @_ || 0;
121     my $sep = shift @_ || ' ';
122     my $out;
123     my $i=0;
124     my $bib = "";
125     foreach my $k (sort {$b cmp $a} keys %data) {
126     if ($out) {
127     $out.= $sep.$data{$k};
128     } else {
129     $out = $data{$k};
130     }
131     $i++;
132     if ($i == $max_in_line) {
133     $bib .= $nr." ".$out."\n" if ($out);
134     $i=0;
135     $out="";
136     }
137     }
138     $bib .= $nr." ".$out."\n" if ($out);
139     return $bib;
140     }
141    
142     #--------------------------------------------------------------------
143    
144     sub c_852_iso {
145     my $tmp = $_[0];
146     $tmp =~ tr/€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúüýþÿ/Çüéâäùæç³ëÕõî¬ÄÆÉÅåôö¥µ¦¶ÖÜ«»£×èáíóú¡±®¾ÊꔼȺ—„•’ˆƒÁÂ̪‡€œ›¯¿‹Ÿ–˜Ž‘Ã㍐…†“™ž¤ðÐÏËïÒÍÎ슂‰šÞٝÓßÔÑñò©¹ÀÚàÛýÝþ´­½²·¢§÷¸°¨ÿØøŒ / if ($tmp);
147     return $tmp;
148     }
149    
150     sub c_852_czs {
151     my $tmp = $_[0];
152     $tmp =~ tr/€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúüýþÿ/Çüéâäùæç³ëÕõî¬ÄÆÉÅåôö¥µ¦¶ÖÜ«»£×èáíóú¡±®¾ÊꔼȺ—„•’ˆƒÁÂ̪‡€œ›¯¿‹Ÿ–˜Ž‘Ã㍐…†“™ž¤ðÐÏËïÒÍÎ슂‰šÞٝÓßÔÑñò©¹ÀÚàÛýÝþ´­½²·¢§÷¸°¨ÿØøŒ /;
153     $tmp =~ tr/Çüéâäùæç³ëÕõî¬ÄÆÉÅåôö¥µ¦¶ÖÜ«»£èáíóú¡±®¾Êê¼ÈºÁÂ̪¯¿ÃãðÐÏËïÒÍÎìÞÙÓÔÑñò©¹ÀÚàÛýÝþ´­½²·¢¸¨ÿØø/CueaauccleOoiZACELlooLlSsOUTtLcaiouAaZzEezCsAAESZzAadDDEdNIIeTUOoNnnSsRUrUyYt'-".'',"'Rr/;
154     $tmp =~ s/ß/ss/g;
155     return $tmp;
156     }
157    
158     #--------------------------------------------------------------------
159    
160     # $mps .= sf_to_mps($subfiled_hash,"subfields",mps_id);
161     #
162     # subfields options:
163     # * - all (no sort)
164     # > - all, sort ascending
165     # < - all, sort descending
166    
167     sub subfields_str_2_arr {
168     my $subfields = shift @_ || return;
169     my $sf_hash = shift @_;
170     my @sf_arr;
171    
172     if ($subfields eq "*") {
173     @sf_arr = keys %{$sf_hash};
174     } elsif ($subfields eq ">") {
175     @sf_arr = sort keys %{$sf_hash};
176     } elsif ($subfields eq "<") {
177     @sf_arr = sort {$b cmp $a} keys %{$sf_hash};
178     } elsif ($subfields =~ s/>//) {
179     @sf_arr = sort split(//,$subfields);
180     } elsif ($subfields =~ s/<//) {
181     @sf_arr = sort {$b cmp $a} split(//,$subfields);
182     } else {
183     @sf_arr = split(//,$subfields);
184     }
185     return @sf_arr;
186     }
187    
188    
189     sub sf_to_mps {
190     my ($sf_hash,$subfields,$mps_id) = @_;
191     my $out="";
192     my @sf_arr = subfields_str_2_arr($subfields,$sf_hash);
193    
194     foreach (@sf_arr) {
195     $out.=mps_expand($mps_id,$sf_hash->{$_});
196     }
197     return $out;
198     }
199    
200     #--------------------------------------------------------------------
201    
202     # $mps .= isis_to_mps ($row,isis_id,mps_id[,"subfields"])
203    
204     sub isis_to_mps {
205     my $row = shift @_ || die;
206     my $isis_id = shift @_ || die;
207     my $mps_id = shift @_ || die;
208     my $subfields = shift @_;
209    
210     my $i=0;
211     my $out = "";
212    
213     while ($row->{$isis_id}->[$i]) {
214     my $sf_hash = OpenIsis::subfields($row->{$isis_id}->[$i]);
215    
216     if (scalar keys %{$sf_hash} > 0) {
217     if ($subfields) {
218     foreach (split(//,$subfields)) {
219     $out.=mps_expand($mps_id,$sf_hash->{$_});
220     }
221     } else {
222     foreach (keys %{$sf_hash}) {
223     $out.=mps_expand($mps_id,$sf_hash->{$_});
224     }
225     }
226     } else {
227     $out.=mps_expand($mps_id,$row->{$isis_id}->[$i]);
228     }
229     $i++;
230     }
231     return $out;
232     }
233    
234     #--------------------------------------------------------------------
235    
236     # $bib .= isis_to_bib ($row,isis_id,bib_id,"subfields",[,group size][,"group sort"][,"separator"])
237     #
238     # fields:
239     # * - all (no sort)
240     # > - all, sort ascending
241     # < - all, sort descending
242     #
243    
244     sub isis_to_bib {
245     my $row = shift @_ || die;
246     my $isis_id = shift @_ || die;
247     my $bib_id = shift @_ || die;
248     my $subfields = shift @_ || '*';
249     my $group_size = shift @_ || 0;
250     my $group_sort = shift @_ || '';
251     my $sep = shift @_ || ' ';
252    
253     my $i=0;
254    
255     my $bib="";
256    
257     my $sf_hash;
258    
259     # bib_grp(('a','b','c'))
260     sub bib_grp {
261     my $bib_grp;
262     my $sf_hash = shift @_ || return "";
263     my $bib_id = shift @_;
264     my $sep = shift @_;
265     foreach (@_) {
266     next if (! defined $sf_hash->{$_});
267     if ($bib_grp) {
268     $bib_grp.= $sep . $sf_hash->{$_};
269     } else {
270     $bib_grp = $sf_hash->{$_};
271     }
272     }
273     if ($bib_grp) {
274     return "$bib_id $bib_grp\n"
275     } else {
276     return "";
277     }
278     }
279    
280     while ($row->{$isis_id}->[$i]) {
281     my $sf_hash = OpenIsis::subfields($row->{$isis_id}->[$i]);
282    
283     if (scalar keys %{$sf_hash} > 0) {
284     if ($group_size) {
285     my $tmp_flds = join("",subfields_str_2_arr($subfields,$sf_hash));
286     while ($tmp_flds) {
287     my $tmp_fld_grp = substr($tmp_flds,0,$group_size);
288     $bib .= bib_grp( $sf_hash, $bib_id, $sep, subfields_str_2_arr($tmp_fld_grp.$group_sort) );
289     last if (length($tmp_flds) <= $group_size);
290     $tmp_flds=substr($tmp_flds,$group_size,length($tmp_flds)-$group_size);
291     }
292    
293     } else {
294     $bib .= bib_grp( $sf_hash, $bib_id, $sep, subfields_str_2_arr($subfields,$sf_hash) );
295     }
296     } else {
297     # no subfields, use just value!
298     $bib .= "$bib_id ".$row->{$isis_id}->[$i]."\n";
299     }
300     $i++;
301     }
302     return $bib;
303     }
304    
305     #--------------------------------------------------------------------
306    
307     sub isis_sf {
308     my $row = shift @_;
309     my $isis_id = shift @_;
310 dpavlin 1.7 my $subfield = shift @_;
311 dpavlin 1.1 my $prefix = shift @_ || '';
312     my $postfix = shift @_ || '';
313    
314     my @sep = @_; # rest are separators
315    
316     if ($row->{$isis_id}->[0]) {
317     my $sf = OpenIsis::subfields($row->{$isis_id}->[0]);
318 dpavlin 1.7 if (! defined $subfield || length($subfield) == 0) {
319     # subfield list undef, empty or no defined subfields for this record
320     return $prefix . $row->{$isis_id}->[0] . $postfix;
321     } elsif (length($subfield) == 1) {
322 dpavlin 1.1 if ($sf->{$subfield}) {
323     return $prefix . $sf->{$subfield} . $postfix;
324     } else {
325     return '';
326     }
327     } elsif (length($subfield) > 1) {
328     my @s = split(//,$subfield);
329     my $out;
330     foreach (@s) {
331     my $sep = shift @sep || ' ';
332     if ($out) {
333     $out .= $sep . $sf->{$_} if ($sf->{$_});
334     } else {
335     $out = $sf->{$_} if ($sf->{$_});
336     }
337     }
338     return $prefix . $out . $postfix if ($out);
339     }
340     }
341     return '';
342     }
343    
344     #--------------------------------------------------------------------
345     #--------------------------------------------------------------------
346    
347    
348     my $last_tell=0;
349    
350 dpavlin 1.6 my @isis_dirs = ( '.' ); # use dirname as database name
351 dpavlin 1.1
352 dpavlin 1.5 if ($opts{m}) {
353 dpavlin 1.6 @isis_dirs = split(/,/,$opts{m});
354 dpavlin 1.5 }
355 dpavlin 1.1
356 dpavlin 1.6 my @isis_dbs;
357 dpavlin 1.1
358 dpavlin 1.6 foreach (@isis_dirs) {
359     if (-e "$common::isis_data/$db_dir/$_/LIBRI") {
360     push @isis_dbs,"$common::isis_data/$db_dir/$_/LIBRI/LIBRI";
361     }
362     if (-e "$common::isis_data/$db_dir/$_/PERI") {
363     push @isis_dbs,"$common::isis_data/$db_dir/$_/PERI/PERI";
364     }
365     }
366    
367     foreach my $isis_db (@isis_dbs) {
368    
369     print MPS "M reading ISIS from '$isis_db'...\n";
370 dpavlin 1.5
371 dpavlin 1.6 my $db = OpenIsis::open( "$isis_db" );
372 dpavlin 1.5
373     my $max_rowid = OpenIsis::maxRowid( $db );
374    
375     my $last_pcnt = 0;
376    
377     for (my $row_id = 1; $row_id <= $max_rowid; $row_id++ ) {
378 dpavlin 1.1 my $row = OpenIsis::read( $db, $row_id );
379     if (my $tmp = $row->{'200'}->[0]) {
380    
381     my $bib = "%MFN $row->{mfn}\n";
382 dpavlin 1.7 my $mps = "W $row->{mfn} 14\n";
383 dpavlin 1.1
384     my $pcnt = int($row->{mfn} * 100 / $max_rowid);
385     if ($pcnt != $last_pcnt) {
386     printf MPS ("M %5d / %5d -- %-2d %%\n",$row->{mfn},$max_rowid,$pcnt);
387     $last_pcnt = $pcnt;
388     }
389    
390     my $headline;
391     $headline .= isis_sf($row,'200','a',"'");
392     $headline .= isis_sf($row,'200','e'," : ","'");
393    
394     # author
395     $bib .= isis_to_bib($row,'700','%700+','*',2,'<');
396     $bib .= isis_to_bib($row,'701','%700+','*',2,'<');
397     $bib .= isis_to_bib($row,'710','%700+','*',2,'<');
398     $bib .= isis_to_bib($row,'711','%700+','*',2,'<');
399     $bib .= isis_to_bib($row,'503','%700+','*',2,'<');
400    
401     $mps .= isis_to_mps($row,'700',1);
402     $mps .= isis_to_mps($row,'701',1);
403     $mps .= isis_to_mps($row,'710',1);
404     $mps .= isis_to_mps($row,'711',1);
405     $mps .= isis_to_mps($row,'503',1);
406     $mps .= isis_to_mps($row,'702',1);
407 dpavlin 1.7 $mps .= isis_to_mps($row,'200',1,"fg");
408 dpavlin 1.1
409     $bib .= isis_to_bib($row,'205','%205');
410    
411     # naslov
412     my $sf = OpenIsis::subfields($row->{'200'}->[0]);
413     my $book;
414     $book .= $sf->{a} if ($sf->{a});
415     $book .= " ; ".$sf->{k} if ($sf->{k});
416     $book .= " = ".$sf->{d} if ($sf->{d});
417     $book .= " : ".$sf->{e} if ($sf->{e});
418     $book .= " / ".$sf->{f} if ($sf->{f});
419     $book .= " ; ".$sf->{g} if ($sf->{g});
420     $book .= ". ".$sf->{c} if ($sf->{c});
421     $book .= " / ".$sf->{x} if ($sf->{x});
422     $book .= " ; ".$sf->{y} if ($sf->{y});
423     $bib .= "%200 $book\n" if ($book);
424    
425     $mps .= isis_to_mps($row,'200',2,"akcde");
426     $mps .= isis_to_mps($row,'532',2);
427     $mps .= isis_to_mps($row,'424',2);
428    
429 dpavlin 1.7 $mps .= isis_to_mps($row,'230',2,"ae");
430     $mps .= isis_to_mps($row,'231',2,"ae");
431     $mps .= isis_to_mps($row,'232',2,"ae");
432     $mps .= isis_to_mps($row,'233',2,"ae");
433    
434    
435     $bib .= "%sv ".isis_sf($row,'230','v').
436     isis_sf($row,'230','a',' : ').
437     isis_sf($row,'250',undef,'. - ').
438     isis_sf($row,'260',undef,'. - ').
439     isis_sf($row,'290',undef,'<br>ISBN ').
440     "\n";
441     $bib .= "%sv ".isis_sf($row,'231','v','<br>').
442     isis_sf($row,'231','a',' : ').
443     isis_sf($row,'251',undef,'. - ').
444     isis_sf($row,'261',undef,'. - ').
445     isis_sf($row,'291',undef,'<br>ISBN ').
446     "\n";
447     $bib .= "%sv ".isis_sf($row,'232','v','<br>').
448     isis_sf($row,'232','a',' : ').
449     isis_sf($row,'252',undef,'. - ').
450     isis_sf($row,'262',undef,'. - ').
451     isis_sf($row,'292',undef,'<br>ISBN ').
452     "\n";
453     $bib .= "%sv ".isis_sf($row,'233','v','<br>').
454     isis_sf($row,'233','a',' : ').
455     isis_sf($row,'253',undef,'. - ').
456     isis_sf($row,'263',undef,'. - ').
457     isis_sf($row,'293',undef,'<br>ISBN ').
458     "\n";
459    
460     $mps .= isis_to_mps($row,'270',2);
461     $mps .= isis_to_mps($row,'271',2);
462     $mps .= isis_to_mps($row,'272',2);
463     $mps .= isis_to_mps($row,'273',2);
464    
465 dpavlin 1.1 $headline .= isis_sf($row,'700','b'," ");
466     $headline .= isis_sf($row,'700','a'," ");
467    
468     # izdavac
469     $mps .= isis_to_mps($row,'210',3);
470 dpavlin 1.7 $mps .= isis_to_mps($row,'250',3);
471     $mps .= isis_to_mps($row,'251',3);
472     $mps .= isis_to_mps($row,'252',3);
473     $mps .= isis_to_mps($row,'253',3);
474 dpavlin 1.1 # if (my $sf = OpenIsis::subfields($row->{'210'}->[0])) {
475     # my $tmp;
476     # $tmp .= $sf->{a} if ($sf->{a});
477     # $tmp .= " : ".$sf->{c} if ($sf->{c});
478     # $tmp .= ", ".$sf->{d} if ($sf->{d});
479     # $bib .= "%210 $tmp\n" if ($tmp);
480     # }
481 dpavlin 1.7 $bib .= "%210+ ".isis_sf($row,'210','acd', '','', ('',' : ',', ') )."\n";
482 dpavlin 1.1
483     if (my $year = isis_sf($row,'210','d')) {
484     $year =~ s/^\s*cop\.*\s*//i;
485     $year =~ s/[\[\]]*//g;
486     $mps .= "D ${year}\n" if ($year !~ m/\?/ && $year =~ /\d{4}/);
487     $headline .= " ($year)";
488     }
489    
490 dpavlin 1.7 $mps .= isis_to_mps($row,'215',15);
491     $mps .= isis_to_mps($row,'260',15);
492     $mps .= isis_to_mps($row,'261',15);
493     $mps .= isis_to_mps($row,'262',15);
494     $mps .= isis_to_mps($row,'263',15);
495     $bib .= isis_to_bib($row,'215','%215+', '*', undef, undef, ', ');
496 dpavlin 1.1
497     # $bib .= isis_to_bib($row,'225','%225', 'aehivw');
498     $bib .= "%225 ".isis_sf($row,'225','aevhiw', '(',')', ('',' : ',' ; ','. ',', ',' ; '))."\n";
499     $mps .= isis_to_mps($row,'225',4);
500    
501     $bib .= isis_to_bib($row,'300','%300+');
502     $bib .= isis_to_bib($row,'320','%300+');
503     $bib .= isis_to_bib($row,'327','%300+');
504     $mps .= isis_to_mps($row,'300',5);
505     $mps .= isis_to_mps($row,'320',5);
506     $mps .= isis_to_mps($row,'327',5);
507 dpavlin 1.7 $mps .= isis_to_mps($row,'280',5);
508     $mps .= isis_to_mps($row,'281',5);
509     $mps .= isis_to_mps($row,'282',5);
510     $mps .= isis_to_mps($row,'283',5);
511 dpavlin 1.1
512     $bib .= isis_to_bib($row,'330','%330');
513     $mps .= isis_to_mps($row,'330',6);
514    
515     $bib .= isis_to_bib($row,'423','%423');
516     $bib .= isis_to_bib($row,'464','%464');
517     $mps .= isis_to_mps($row,'464',7);
518     $bib .= isis_to_bib($row,'610','%610');
519     $mps .= isis_to_mps($row,'610',8);
520    
521     $bib .= isis_to_bib($row,'675','%675+');
522     $mps .= isis_to_mps($row,'675',9);
523     $bib .= isis_to_bib($row,'686','%675+');
524     $mps .= isis_to_mps($row,'686',10);
525    
526     $bib .= isis_to_bib($row,'990','%990');
527     $mps .= isis_to_mps($row,'990',11);
528    
529     $bib .= isis_to_bib($row,'991','%991');
530     $mps .= isis_to_mps($row,'991',12);
531    
532 dpavlin 1.7 sub store_isn {
533     if (my $isn = shift @_) {
534     my $nr = shift @_;
535     my $tag = shift @_;
536     $isn =~ s/ +//g; # remove spaces
537     $mps .= "W $isn $nr\n";
538     $bib .= "$tag $isn\n";
539     if ($isn =~ s/-//g) {
540     $mps .= "W $isn $nr\n";
541     }
542     }
543     }
544    
545 dpavlin 1.1 # ISBN
546 dpavlin 1.7 store_isn($row->{10}->[0],13,'%ISBN');
547     $mps .= isis_to_mps($row,'290',13);
548     $mps .= isis_to_mps($row,'291',13);
549     $mps .= isis_to_mps($row,'292',13);
550     $mps .= isis_to_mps($row,'293',13);
551    
552     # ISSN
553     #store_isn($row->{11}->[0],14,'%ISSN');
554 dpavlin 1.1
555     $mps .= isis_to_mps($row,'532',1);
556    
557     $bib .= isis_to_bib($row,'994','%994a','a');
558    
559     # headline
560     if ($headline) {
561     $headline .= " [".$row->{mfn}."]"; ## debug MFN!
562     $mps .= "H ".c_852_iso($headline)."\n";
563     } else {
564     $mps .= "H nepoznato\n";
565     }
566    
567    
568     #if ($db_dir eq "sf") {
569     # print "MFN: $row->{mfn} ROW ID: $row_id\n";
570     # if ($row->{mfn} >= 146) {
571     # print Dumper($row);
572     # }
573     #}
574    
575     print R c_852_iso($bib);
576 dpavlin 1.7 print R "%perl ".Dumper($row)."\n";
577 dpavlin 1.1
578     $mps .= "T document text/plain ".(tell(R) - $last_tell)." $dir/bib $last_tell ".tell(R)."\n";
579     $last_tell=tell(R);
580    
581     print R "\n";
582    
583     $mps .= "E\n";
584    
585    
586     print S $mps;
587     print MPS $mps;
588     }
589 dpavlin 1.5 }
590 dpavlin 1.1 }
591     print S "M over and out\nX\n";
592     print MPS "M over and out\nX\n";
593     close(MPS);

  ViewVC Help
Powered by ViewVC 1.1.26