/[webpac2]/trunk/conf/ffcasopisi/perilooksig2marc.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 /trunk/conf/ffcasopisi/perilooksig2marc.pl

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

revision 1268 by mglavica, Tue Aug 11 12:23:14 2009 UTC revision 1273 by mglavica, Wed Aug 19 14:05:30 2009 UTC
# Line 1  Line 1 
1  my $pair =  my $pair =
2          lookup(          lookup(
3                  sub { rec('B') },                  sub { rec('C') },
4                  'casopisi','sig',                  'casopisi','sig',
5                  sub { rec('A') . rec('B') },                  sub { rec('A') . rec('B') },
6                  sub { config ('input collection') . rec('000') }                  sub { config ('input collection') . rec('000') }
7          );          );
8    
9  #if ( $pair ) {  if ( $pair ) {
10    
 marc('888','a',  
         $pair  
 );  
   
 marc('888','b',  
         config('input collection')  
 );  
   
 if ( rec('200','a') ) {  
11    
12  ### LEADER  ### LEADER
13    
# Line 29  marc_leader('06','a'); Line 20  marc_leader('06','a');
20  ## LDR 07 - Bibliographic level  ## LDR 07 - Bibliographic level
21  #  izvuci podatke iz tablie (za po i sf)  #  izvuci podatke iz tablie (za po i sf)
22    
23    my $ldr7 =
24            lookup(
25                    sub { rec('D') },
26                    'casopisi','kod',
27                    sub { rec('B') . rec('A') },
28                    sub { config ('input collection') . rec('000') }
29            );
30    
31  #if ( rec('225','a') ) {  #if ( rec('225','a') ) {
32  #       marc_leader('07','d');    #       marc_leader('07','d');  
33  #} else {  #} else {
34  #       marc_leader('07','s');    #       marc_leader('07','s');  
35  #}  #}
36  marc_leader('07','s');  
37    if ( $ldr7 ) {
38            marc_leader('07', $ldr7 );
39    }
40    
41    
42  ## LDR 17 - Encoding level ; 7 - minimal level, u - unknown  ## LDR 17 - Encoding level ; 7 - minimal level, u - unknown
43  marc_leader('17','u');  marc_leader('17','u');
# Line 55  marc_fixed('008','00', '010101');      # 00-0 Line 58  marc_fixed('008','00', '010101');      # 00-0
58  ## d - Continuing resource ceased publication  ## d - Continuing resource ceased publication
59  ## u - Continuing resource status unknown  ## u - Continuing resource status unknown
60    
61  marc_fixed('008','06','u');  marc_fixed('008','06','|');
62    
63  my $d1 = '    ';  my $d1 = '    ';
64  my $d2 = '    ';  my $d2 = '    ';
65    
66  if ( rec('210','d') ) {  if ( rec('210','d') ) {
67          if ( rec('210','d') =~ m/(\d{4}).*(\d{4})/ ) {          if ( rec ('210','d') =~ m#(\d{4}).*?-.*?(\d{4})# ) {
                 marc_fixed('008','06','d');  
68                  $d1 = $1;                  $d1 = $1;
69                  $d2 = $2;                  $d2 = $2;
70                  marc_fixed('008','07', $d1);                  marc_fixed('008','06','d');
71          } else {          }
72                  marc_fixed('008','06','c');          if ( rec ('210','d') =~ m{(\d{4}).*?-\s*$} ) {
73                  marc_fixed('008','07',                  # 07-10 - Date 1                  $d1 = $1;
                         regex ( 's/.*(\d{4}).*/$1/',  
                                 rec('210','d')  
                         )  
                 );  
74                  $d2 = '9999';                  $d2 = '9999';
75                    marc_fixed('008','06','c');
76          }          }
77          marc_fixed('008','11',$d2);                     # 07-10 - Date 1          
78            marc_fixed('008','07', $d1);
79            marc_fixed('008','11', $d2);
80                    
81  }  }
82    
83  marc_fixed('008','15',                  # 15-17 - Place of publication, production, or execution  marc_fixed('008','15',                  # 15-17 - Place of publication, production, or execution
# Line 93  marc_fixed('008','39','d');            # 39 - Cata Line 95  marc_fixed('008','39','d');            # 39 - Cata
95    
96  my $fre;  my $fre;
97    
98  $fre =  ( rec('326') eq '10' )  ? 'm' :  $fre =  ( rec('326') eq '2g' )  ? 'g' :
99          ( rec('326') eq 'g1' )  ? 'a' :          ( rec('326') eq 'g1' )  ? 'a' :
100          ( rec('326') eq 'g2' )  ? 'f' :          ( rec('326') eq 'g2' )  ? 'f' :
101          ( rec('326') eq 'g3' )  ? 't' :          ( rec('326') eq 'g3' )  ? 't' :
# Line 101  $fre =         ( rec('326') eq '10' )  ? 'm' : Line 103  $fre =         ( rec('326') eq '10' )  ? 'm' :
103          ( rec('326') eq 'g5' )  ? 'z' :          ( rec('326') eq 'g5' )  ? 'z' :
104          ( rec('326') eq 'g6' )  ? 'b' :          ( rec('326') eq 'g6' )  ? 'b' :
105          ( rec('326') eq 'g8' )  ? 'b' :          ( rec('326') eq 'g8' )  ? 'b' :
106          ( rec('326') eq 'g19' ) ? 's' :          ( rec('326') eq 'g9' )  ? 'm' :
107          ( rec('326') eq 'm1' )  ? 'm' :          ( rec('326') eq 'm1' )  ? 'm' :
108            ( rec('326') eq '10' )  ? 'm' :
109            ( rec('326') eq '11' )  ? 'm' :
110          ( rec('326') eq 'm2' )  ? 's' :          ( rec('326') eq 'm2' )  ? 's' :
111            ( rec('326') eq '19' )  ? 's' :
112            ( rec('326') eq '20' )  ? 's' :
113            ( rec('326') eq '24' )  ? 's' :
114            ( rec('326') eq '26' )  ? 's' :
115          ( rec('326') eq 'm3' )  ? 'j' :          ( rec('326') eq 'm3' )  ? 'j' :
116          ( rec('326') eq 't1' )  ? 'w' :          ( rec('326') eq 't1' )  ? 'w' :
117          ( rec('326') eq 't2' )  ? 'c' :          ( rec('326') eq 't2' )  ? 'c' :
# Line 111  $fre =         ( rec('326') eq '10' )  ? 'm' : Line 119  $fre =         ( rec('326') eq '10' )  ? 'm' :
119          ( rec('326') eq 'nr' )  ? ' ' :          ( rec('326') eq 'nr' )  ? ' ' :
120          ( rec('326') eq 'np' )  ? 'u' :          ( rec('326') eq 'np' )  ? 'u' :
121                                  '|';                                  '|';
           
   
122    
123  marc_fixed('008','18', $fre);   # 18 - Frequency - ovo treba popuniti iz polja 326  marc_fixed('008','18', $fre);   # 18 - Frequency - ovo treba popuniti iz polja 326
124  marc_fixed('008','19', '|');    # 19 - Regularity  marc_fixed('008','19', '|');    # 19 - Regularity
125                                  # 20 - Undefined, ontains a blank (#) or fill character (|)                                  # 20 - Undefined, ontains a blank (#) or fill character (|)
126  # za polje 008 21 treba lookup u tablicu s kodovima za sf i po, za ostale nadopuniti naknadno  # za polje 008 21 treba lookup u tablicu s kodovima za sf i po, za ostale nadopuniti naknadno
127  marc_fixed('008','21', 'p');    # 21 - Type of continuing resource  
128    my $stype =
129            lookup(
130                    sub { rec('E') },
131                    'casopisi','kod',
132                    sub { rec('B') . rec('A') },
133                    sub { config ('input collection') . rec('000') }
134            );
135    
136    if ( $stype ) {
137            marc_fixed('008','21', $stype); # 21 - Type of continuing resource
138    }
139                                  # 22 - Form of original item - blank                                  # 22 - Form of original item - blank
140                                  # 23 - Form of item                                  # 23 - Form of item
141  marc_fixed('008','24','|');     # 24 - Nature of entire work  marc_fixed('008','24','|');     # 24 - Nature of entire work
# Line 137  marc_fixed('008','34','0');    # 34 - Entry Line 154  marc_fixed('008','34','0');    # 34 - Entry
154          );          );
155  #}  #}
156    
157  ### 035$6  ### 035
 # privemeno koristimo 0356 umjesto 0359, zato što marclint 9 prijavljuje kao grešku  
158    
159  my $id;  my $id;
160    
# Line 151  $id = ( Line 167  $id = (
167          )          )
168  );  );
169    
170  marc('035','6', $id);  marc('035','a', $id);
171    
172  ### 040  ### 040
173  # za sve je isti  # za sve je isti
174  # treba utvrditi točnu oznaku za ustanovu  # treba utvrditi točnu oznaku za ustanovu
175    
176  marc('040','a',  marc('040','a',
177          'HR-ZaFF'          'HR-ZaFF'
# Line 165  marc('040','b', Line 181  marc('040','b',
181          'hrv'          'hrv'
182  );  );
183    
184    marc('040','c',
185            'HR-ZaFF'
186    );
187    
188  marc('040','e',  marc('040','e',
189          'ppiak'          'ppiak'
190  );  );
191    
192  ### 041 - indikatori  #### 041 - indikatori
193    #
194  marc_indicators('041', 0, ' ');  #
195    #marc_indicators('041', 0, ' ');
196  ### 041  #
197    #### 041
198  marc_repeatable_subfield('041','a',  #
199          rec('101')  #marc_repeatable_subfield('041','a',
200  );  #       rec('101')
201    #);
202    
203    
204  #_debug(3);  #_debug(3);
205    
 ### 044 - zemlja izdavanja  
   
 marc('044','a',  
         rec('102')  
 );  
   
206  ### 080  ### 080
207    
208  marc('080','a',  marc('080','a',
# Line 198  marc('080','a', Line 213  marc('080','a',
213  # marc_indicators('210', '1',' ');  # marc_indicators('210', '1',' ');
214    
215  ### 210 - ABBREVIATED TITLE  ### 210 - ABBREVIATED TITLE
216  # pronaći prikladan izvor podataka (nsk baza, issn baza)  # pronaći prikladan izvor podataka (nsk baza, issn baza)
   
 ## iz nsk  
 #if ( rec('11') ) {  
 #marc('210','a',  
 #       lookup(  
 #               sub { rec('531','a') },  
 #               'nsk','bbaza',  
 #               sub { rec('011','a') },  
 #               sub { rec('11') },  
 #       )  
 #);  
 #}  
217    
218  ### 222 indikatori  ### 222 indikatori
219  # drugi indikator prema članu  # drugi indikator prema clanu
220    
221  marc_indicators('222',' ','0');  marc_indicators('222',' ','0');
222    
223  ### 222 - Key title  ### 222 - Key title
224  # pronaći prikadan izvor podataka - nsk baza, issn baze  # pronaci prikadan izvor podataka - nsk baza, issn baze
225    
226  marc('222','a',  marc('222','a',
227          rec('530')          rec('530')
# Line 237  marc('222','a', Line 240  marc('222','a',
240  #}  #}
241    
242  ### 245 indikatori  ### 245 indikatori
243  # generiraju se prema članu, trebalo bi možda i prema jeziku (jezika nema uvijek).  # generiraju se prema clanu, trebalo bi moĹźda i prema jeziku (jezika nema uvijek).
244  # potrebna naknadna kontrola  # potrebna naknadna kontrola
245    
246    my $naslov =
247            lookup(
248                    sub { rec('E') },
249                    'casopisi','sig',
250                    sub { rec('A') . rec('B') },
251                    sub { config ('input collection') . rec('000') }
252            );
253    
254  marc_indicators('245', 0, 0);  marc_indicators('245', 0, 0);
255    
256  if (    ( rec('200','a') =~ m/^Die /) ||  if (    ( $naslov =~ m/^Die /) ||
257          ( rec('200','a') =~ m/^Das /) ||          ( $naslov =~ m/^Das /) ||
258          ( rec('200','a') =~ m/^Der /) ||          ( $naslov =~ m/^Der /) ||
259          ( rec('200','a') =~ m/^Les /) ||          ( $naslov =~ m/^Les /) ||
260          ( rec('200','a') =~ m/^The /) ) {          ( $naslov =~ m/^The /) ) {
261                  marc_indicators('245', 0, 4);                  marc_indicators('245', 0, 4);
262    
263  }  }
264    
265  if (    ( rec('200','a') =~ m/^Un /) ||  if (    ( $naslov =~ m/^Un /) ||
266          ( rec('200','a') =~ m/^An /) ||          ( $naslov =~ m/^An /) ||
267          ( rec('200','a') =~ m/^La /) ||          ( $naslov =~ m/^La /) ||
268          ( rec('200','a') =~ m/^Le /) ||          ( $naslov =~ m/^Le /) ||
269          ( rec('200','a') =~ m/^Il /) ) {          ( $naslov =~ m/^Il /) ) {
270                  marc_indicators('245', 0, 3);                  marc_indicators('245', 0, 3);
271  }  }
272    
273  if (    ( rec('200','a') =~ m/^A /) ||  if (    ( $naslov =~ m/^A /) ||
274          ( rec('200','a') =~ m/^L'/) ) {          ( $naslov =~ m/^L'/) ) {
275                  marc_indicators('245', 0, 2);                  marc_indicators('245', 0, 2);
276  }  }
277    
278  ### 245  ### 245
279    
 marc_compose('245',  
         'a', suffix(  
                 ( ! ( rec('200','d') || rec('200','e') || rec('200','k') ) ) && ( rec('200','f') ) ? ' /' :    
                 ( rec('200','d') ) ? ' =' :  
                 ( rec('200','e') ) ? ' :' :  
                 ( rec('200','k') ) ? ' ;' :  
                         '',  
                         rec('200','a'),  
         ),  
         'b', suffix(  
                 ( rec('200','d') && rec('200','f') ) ? ' /' :  
                 ( rec('200','d') && rec('200','c') ) ? '.'  :  
                         '',  
                         rec('200','d'),  
         ),  
         'b', suffix(  
                 ( rec('200','e') && rec('200','f') ) ? ' /' :  
                 ( rec('200','e') && rec('200','c') ) ? '.'  :  
                         '',  
                         rec('200','e'),  
         ),  
         'b', suffix(  
                 ( rec('200','k') && rec('200','f') ) ? ' /' :  
                 ( rec('200','k') && rec('200','c') ) ? '.'  :  
                         '',  
                         rec('200','k'),  
         ),  
         'c', suffix(  
                 ( rec('200','f') && rec('200','c') ) ? '.' :  
                         '',  
                         rec('200','f'),  
         ),  
         '+', suffix('.',  
                 rec('200','c'),  
         )  
 );  
280    
281  ### 246 inikatori  #warn $naslov;
 # prema jeziku - provjera  
282    
283  if (    ( rec('200','a') =~ m/^Die /) ||  my ($a,$b,$c);
284          ( rec('200','a') =~ m/^Das /) ||  $c = $2 if $naslov =~ s{(\s+/)\s+(.+)$}{$1};
285          ( rec('200','a') =~ m/^The /) ) {  if ( $naslov =~ s{^(.+?[:=])\s+}{} ) {
286                  marc_indicators('246', 0, 4);          $a = $1;
287            $b = $naslov ;
288  } else {  } else {
289          marc_indicators('246', 0, 0);          $a = $naslov ;
290  }  }
291    
292  ### 246  #warn "a: $a\nb: $b\nc: $c\n";
 # povući podatke iz prikladnog izvora (nsk, issn)  
293    
294  marc('246','a',  $a = $a . '.' if ( ! ( $b || $c) );
295          rec('532')  $b = $b . '.' if ( ! $c && $b ) ;
296  );  
297    marc('245','a', $a);
298    marc('245','b', $b) if $b;
299    if ( $c ) {
300            marc('245','c', $c);
301    } else {
302            marc('245','c',
303                    rec('200','f')
304            );
305    }
306    
307    ### 246 inikatori
308    # prema jeziku - provjera
309    #
310    #if (   ( rec('200','a') =~ m/^Die /) ||
311    #       ( rec('200','a') =~ m/^Das /) ||
312    #       ( rec('200','a') =~ m/^The /) ) {
313    #               marc_indicators('246', 0, 4);
314    #} else {
315    #       marc_indicators('246', 0, 0);
316    #}
317    
318    ### 246
319    # povuci podatke iz prikladnog izvora (nsk, issn)
320    # 532 iz ISIS-a nije konvertirano
321    #marc('246','a',
322    #       rec('532')
323    #);
324    
325  ## iz nsk:  ## iz nsk:
326  #       marc('246','a',  #       marc('246','a',
# Line 404  marc('300','e', Line 405  marc('300','e',
405  );  );
406    
407  ### 310 - current stated publication frequency  ### 310 - current stated publication frequency
408  # potrebno ujednačiti, koristi se i u polju 008  # potrebno ujednaciti, koristi se i u polju 008
409    
410  marc('310','a',  marc('310','a',
411          rec('326')          rec('326')
# Line 419  marc('310','a', Line 420  marc('310','a',
420  marc_indicators('362', 0, ' ');  marc_indicators('362', 0, ' ');
421    
422  ### 362  ### 362
423  #  marc('362','a',
424  if ( rec('207','a') ) {          rec('207','a'),
425          marc('362','a',  );
                 rec('207','a'),  
         );  
 }  
426    
427  ## lookup iz nsk  ## lookup iz nsk
428  #else {  #else {
# Line 496  marc('490','x', Line 494  marc('490','x',
494    
495    
496  ### 5xx  ### 5xx
497  # koje podatke povući iz drugih baza?  # koje podatke povuci iz drugih baza?
498    
499  marc('500','a',  marc('500','a',
500          rec('300','a'),          rec('300','a'),
# Line 509  marc('534','a', Line 507  marc('534','a',
507          rec('324')          rec('324')
508  );  );
509    
510  ## potencijalno za izvući iz NSK  ## potencijalno za izvuci iz NSK
511  #if ( rec('11') ) {  #if ( rec('11') ) {
512  #marc('546','a',  #marc('546','a',
513  #       lookup(  #       lookup(
# Line 670  marc('785','t', Line 668  marc('785','t',
668          rec('440','a'),          rec('440','a'),
669  );  );
670    
671  ### 852  ### 856
672    marc('856','u',
673  marc('852','j',          rec('856','u')
         join_with(' ',  
                 rec('990')  
         )  
674  );  );
675    
 ### 876  
676    
677  marc('876','a',  ### 942
678          rec('991','a')  #
679  );  #marc('942','d',
680    #       $pair
681    #);
682    
683    
684  ### 992  ### 992
685    
686  marc('992','a',  marc('992','a',
687          join_with(' ; ',          rec('992')
                 rec('992')  
         )  
688  );  );
689    
690    
# Line 739  marc('992','a', Line 734  marc('992','a',
734  #       )  #       )
735  # );  # );
736    
737  } # 200a  } # pair
 #} # pair  

Legend:
Removed from v.1268  
changed lines
  Added in v.1273

  ViewVC Help
Powered by ViewVC 1.1.26