example search for Koha database
[webpac2] / conf / normalize / ff-peri.pl
index 3965814..3769bbf 100644 (file)
 if ( rec('200','a') ) {
 
+### LEADER
 
-# LEADER
-# raspraviti 17,18
-
+## LDR 05 - n - new
 marc_leader('05','n');
+
+## LDR 06 - a - language material 
 marc_leader('06','a');
 
+## LDR 07 - Bibliographic level 
+#  izvuci podatke iz tablice (za po i sf)
+
 if ( rec('225','a') ) {
-       marc_leader('07','b');
+       marc_leader('07','d');  
 } else {
-       marc_leader('07','s');
+       marc_leader('07','s');  
 }
 
+## LDR 17 - Encoding level ; 7 - minimal level, u - unknown
+marc_leader('17','u');
+
+## LDR 18 - i - isbd 
 marc_leader('18','i');
 
+
+## LDR 19 - Multipart resource record level ; # - Not specified or not applicable, a - Set, b - Part with independent title, c - Part with dependent title 
+# tematski brojevi imaju vezu u 
+
 if ( rec('225','a') ) {
-       marc_leader('19','r');
+       marc_leader('19','a');
 }
 
-# 001 polje - Voyager
+### 008 - All materials
 
-# 007
-marc_fixed('007',00,'ta');
+marc_fixed('008','00', '010101');      # 00-05 - Date entered on file
 
+## za 008 06 treba i lookup u tablicu gdje postoji podatak o tome jel tekuci casopis ili nije?
+## c - Continuing resource currently published
+## d - Continuing resource ceased publication
 
-## 008 - All materials
-marc_fixed('008','00', '070707');      # Date entered on file
-marc_fixed('008','06', 't');           # Type of date/Publication status
-if ( rec('11') ) {
-       if ( my $lookup = lookup(
-                       sub { rec('210','d') },
-                       'nsk','bbaza',
-                       sub { first( rec('011','a') ) },
-                       sub { rec('11') },
-               )
-       ) {
-               marc_fixed('008','07', $lookup);
+my $year = rec('210','c');
+
+#if ( rec('210','c') ) {
+#      marc_fixed('008','06','s');             # 06 - Type of date/Publication status, s = single know date
+#      
+##     warn "## year = $year";
+#
+#      if ( $year =~ m/^(\d{4})/ ) {
+##     warn "## $1 ##\n";
+#              marc_fixed('008','07',$1);              # 07-10 - Date 1
+#      }
+#
+#      if ( $year =~ m/^\d{4}-(\d{4})/ ) {
+##     warn "## $1 ##";
+#              marc_fixed('008','11',$1);              # 11-14 - Date 2 
+#              marc_fixed('008','06','d');
+#      }
+#      
+#} else {
+#      marc_fixed('008','06','n');             # 06 - n = unknown date
+#}
+
+if ( rec('210','c') ) {
+       my $d1 = '';
+       my $d2 = '';
+       if ( rec('210','c') =~ m/(\d{4})-/ ) {
+               marc_fixed('008','06','m');
+               if ( rec('210','c') =~ m/(\d{4})-/ ) {
+                       $d1 = $1;
+                       $d2 = '9999';
+               }
+               if ( rec('210','c') =~ m/-(\d{4})/ ) {
+                       $d2 = $1;
+               }
        } else {
-               marc_fixed('008','07',
-                       rec('210','d')
-               );
+               marc_fixed('008','06','s');
+               if ( rec('210','c') =~ m/(\d{4})/ ) {
+                       $d1 = $1;
+               }
+               if ( rec('210','c') =~ m/(\d{2})(--|__)/ ) {
+                       $d1 = $1.'uu';
+               } 
+               if ( rec('210','c') =~ m/(\d{3})(-|_)/ ) {
+                       $d1 = $1.'u';
+               }
        }
-}                                      # Date 1
+       marc_fixed('008','07',$d1);             # 07-10 - Date 1
+       marc_fixed('008','11',$d2);             # 07-10 - Date 1
+} else {
+       marc_fixed('008','06','n');             # 06 - n = unknown date
+       marc_fixed('008','07','uuuu');
+}
 
-# marc_fixed('008','11', ' ');         # Date 2
-marc_fixed('008','15', 
+marc_fixed('008','15',                 # 15-17 - Place of publication, production, or execution
        lc ( rec('102') ) 
-);                             # Place of publication, production, or execution
-#marc_fixed('008','35',        
-#      rec('101') 
-#);                            # Language
-marc_fixed('008','38', '|');   # Modified record
-marc_fixed('008','39','d');    # Cataloging source
+);
+
 
 
-## 008 - Continuing resources
-marc_fixed('008','18', '|');   # Frequency - ovo treba popuniti iz polja 326
-marc_fixed('008','19', '|');   # Regularity
-marc_fixed('008','21', 'p');   # Type of continuing resource
-marc_fixed('008','29', '|');   # Conference publication
-marc_fixed('008','33', '|');   # Original alphabet or script of title
-marc_fixed('008','34', '|');   # Entry convention
+marc_fixed('008','35',
+       first( lc(rec('101')) )         # 35-37 - Language
+);
+                                       # 38 - Modified record
+                                       # 39 - Cataloging source
+
+### 008 - Continuing resources
+
+if ( ! rec('225','a') ) {
 
+marc_fixed('008','18', 'u');   # 18 - Frequency - ovo treba popuniti iz polja 326
+marc_fixed('008','19', 'u');   # 19 - Regularity
+                               # 20 - Undefined, ontains a blank (#) or fill character (|)
+
+# za polje 008 21 treba lookup u tablicu:
+marc_fixed('008','21', 'p');   # 21 - Type of continuing resource
+
+                               # 22 - Form of original item - blank
+                               # 23 - Form of item
+                               # 24 - Nature of entire work
+                               # 25-27 - Nature of contents
+                               # 28 - Government publication
+                               # 29 - Conference publication
+                               # 30-32 - Undefined
+                               # 33 - Original alphabet or script of title
+                               # 34 - Entry convention
+} 
 
 ## 022
 # if ( ! rec('225','a') ) {
@@ -72,15 +134,20 @@ marc_fixed('008','34', '|');       # Entry convention
 # }
 #
 
-## 022
-marc('022','a',
-       rec('11')
-);
+### 022
 
+#if ( ! rec('225','a') ) {
+       marc('022','a',
+               rec('11')
+       );
+#}
 
+### 035$6
 # privemeno koristimo 0356 umjesto 0359, zato ¹to marclint 9 prijavljuje kao gre¹ku
 
-marc('035','6',
+my $id;
+
+$id = ( 
        join_with('',
                uc( config() ),
                ' P',
@@ -88,6 +155,11 @@ marc('035','6',
        )
 );
 
+marc('035','6', $id);
+
+### 040
+# za sve je isti
+# treba utvrditi toènu oznaku za ustanovu
 
 marc('040','a',
        'HR FFZG'
@@ -101,8 +173,12 @@ marc('040','e',
        'HR PPIAK'
 );
 
+### 041 - indikatori
+
 marc_indicators('041', 0, ' ');
 
+### 041
+
 marc_repeatable_subfield('041','a',
        rec('101')
 );
@@ -110,101 +186,130 @@ marc_repeatable_subfield('041','a',
 
 #_debug(3);
 
-## 044 - zemlja izdavanja
+### 044 - zemlja izdavanja
 
-if ( rec('11') ) {
-       if ( my $lookup = lookup(
-                       sub { rec('102','a') },
-                       'nsk','bbaza',
-                       sub { first( rec('011','a') ) },
-                       sub { rec('11') },
-               )
-       ) {
-               marc('044','a', $lookup );
-       } else {
-               marc('044','a',
-                       rec('102')
-               );
-       }
-} 
+marc('044','a',
+       rec('102')
+);
+
+### 080
 
 marc('080','a',
        rec('675','a')
 );
 
-marc_indicators('210', '1',' ');
+### 210 indikatori
+# marc_indicators('210', '1',' ');
 
-if ( rec('11') ) {
-marc('210','a',
-       lookup(
-               sub { rec('531','a') },
-               'nsk','bbaza',
-               sub { rec('011','a') },
-               sub { rec('11') },
-       ) 
-);
-}
+### 210 - ABBREVIATED TITLE 
+# 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') },
+#      ) 
+#);
+#}
+
+### 222 indikatori
+# drugi indikator prema èlanu
+
+marc_indicators('222',' ','0');
+
+### 222 - Key title
+# pronaæi prikadan izvor podataka - nsk baza, issn baze
 
-marc_indicators('222',' ','0');                # drugi indikator prema èlanu
-if ( rec('11') ) {
 marc('222','a',
-       lookup(
-               sub { rec('530','a') },
-               'nsk','bbaza',
-               sub { rec('011','a') },
-               sub { rec('11') },
-       ) 
+       rec('530')
 );
-}
+
+# iz nsk:
+#if ( rec('11') ) {
+#marc('222','a',
+#      lookup(
+#              sub { rec('530','a') },
+#              'nsk','bbaza',
+#              sub { rec('011','a') },
+#              sub { rec('11') },
+#      ) 
+#);
+#}
+
 ### 245 indikatori
+# generiraju se prema èlanu, trebalo bi mo¾da i prema jeziku (jezika nema uvijek). 
+# potrebna naknadna kontrola
+
+marc_indicators('245', 0, 0);
 
 if (   ( rec('200','a') =~ m/^Die /) || 
        ( rec('200','a') =~ m/^Das /) || 
+       ( rec('200','a') =~ m/^Der /) || 
+       ( rec('200','a') =~ m/^Les /) || 
        ( rec('200','a') =~ m/^The /) ) {
                marc_indicators('245', 0, 4);
-} else {
-       marc_indicators('245', 0, 0);
-}
 
+} 
+
+if (   ( rec('200','a') =~ m/^Un /) || 
+       ( rec('200','a') =~ m/^An /) ||
+       ( rec('200','a') =~ m/^La /) ||
+       ( rec('200','a') =~ m/^Le /) ||
+       ( rec('200','a') =~ m/^Il /) ) {
+               marc_indicators('245', 0, 3);
+} 
+
+if (   ( rec('200','a') =~ m/^A /) || 
+       ( rec('200','a') =~ m/^L'/) ) {
+               marc_indicators('245', 0, 2);
+} 
+
+### 245
 
-## 245
 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','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') && 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') && 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') && rec('200','f') ) ? ' /' : 
+               ( rec('200','k') && rec('200','c') ) ? '.'  : 
                        '',
                        rec('200','k'),
        ),
        'c', suffix(
-               ( rec('200','f') && rec('200','c') ) ? '. ' :
+               ( rec('200','f') && rec('200','c') ) ? '.' :
                        '',
                        rec('200','f'),
        ),
-       '+', rec('200','c'),
+       '+', suffix('.',
+               rec('200','c'),
+       )
 );
 
-## 246
+### 246 inikatori
+# prema jeziku - provjera
+
 if (   ( rec('200','a') =~ m/^Die /) || 
        ( rec('200','a') =~ m/^Das /) || 
        ( rec('200','a') =~ m/^The /) ) {
@@ -213,14 +318,14 @@ if (      ( rec('200','a') =~ m/^Die /) ||
        marc_indicators('246', 0, 0);
 }
 
+### 246
+# povuæi podatke iz prikladnog izvora (nsk, issn)
 
-if ( rec('532') ) {
-       marc('246','a',
-               rec('532')
-       );
-} 
+marc('246','a',
+       rec('532')
+);
 
-#else {
+## iz nsk:
 #      marc('246','a',
 #              lookup(
 #                      sub { rec('532','a') },
@@ -229,13 +334,16 @@ if ( rec('532') ) {
 #                      sub { rec('11') },
 #              )
 #      );
-#}
 
 #_debug(0);
 
 
 ## 260 - izdavanje
+# provjeriti interpunkcije !!, u NSK nesto ne stima
 
+marc_original_order('260','210');
+
+## lookup u NSK:
 # if ( rec('11') ) {
 #      marc_repeatable_subfield('260','a',
 #              lookup(
@@ -265,10 +373,8 @@ if ( rec('532') ) {
 #      marc_original_order('260', '210');
 # }
 
-marc_original_order('260','210');
 
-# provjeriti interpunkcije !!
-# u NSK nesto ne stima
+### 300
 
 marc('300','a',
        suffix(
@@ -301,87 +407,157 @@ marc('300','e',
        rec('215','e')
 );
 
-## 310 - current stated publication frequency
+### 310 - current stated publication frequency
+# potrebno ujednaèiti, koristi se i u polju 008
+
 marc('310','a',
        rec('326')
 );
 
-## 321 - former frequency of either an item or an update to an item when a current frequency is contained in field 310
+### 321 - former frequency of either an item or an update to an item when a current frequency is contained in field 310
+
 # marc('321','a',
 #      ovo bi trebalo procitati iz NSK konvertiranih podataka
 #);
 
 marc_indicators('362', 0, ' ');
 
-
-## 362
+### 362
+#
 if ( rec('207','a') ) {
        marc('362','a',
                rec('207','a'),
        );
-} else {
-       if ( rec('11') ) {
-               marc('362','a',
-                       lookup(
-                               sub { rec('207','a') },
-                               'nsk','bbaza',
-                               sub { first( rec('011','a') ) },
-                               sub { rec('11') },
-                       ) 
-               );
-       }
-}
+} 
 
-## 5xx
-marc('500','a',
-       rec('300','a'),
-);
-marc('534','a',
-       rec('324')
+## lookup iz nsk
+#else {
+#      if ( rec('11') ) {
+#              marc('362','a',
+#                      lookup(
+#                              sub { rec('207','a') },
+#                              'nsk','bbaza',
+#                              sub { first( rec('011','a') ) },
+#                              sub { rec('11') },
+#                      ) 
+#              );
+#      }
+#}
+
+### 490 ind.
+
+marc_indicators('490', '0', ' ');
+
+### 490
+
+marc('490','a',
+       join_with('. ',
+               join_with(' / ',
+                       join_with(' : ',
+                               join_with(' = ',
+                                       rec('225','a'),
+                                       rec('225','d')
+                               ),
+                               rec('225','e')
+                       ),
+                       join_with(' ; ',
+                               rec('225','f'),
+                               rec('225','g')
+                       ),
+               ),
+               rec('225','h')
+       )
 );
 
-if ( rec('11') ) {
-marc('546','a',
-       lookup(
-               sub { rec('302','a') },
-               'nsk','bbaza',
-               sub { rec('011','a') },
-               sub { rec('11') },
-       ) 
+marc('490','v',
+       rec('225','v')
 );
 
-marc('550','a',
-       lookup(
-               sub { rec('314','a') },
-               'nsk','bbaza',
-               sub { rec('011','a') },
-               sub { rec('11') },
-       ) 
+marc('490','x',
+       rec('225','x')
 );
 
-marc('555','a',
-       lookup(
-               sub { rec('320','a') },
-               'nsk','bbaza',
-               sub { rec('011','a') },
-               sub { rec('11') },
-       ) 
+if ( rec('11') ) {
+       marc('999','a',
+               lookup(
+                       sub { rec('110','a'), },
+                       'nsk','bbaza',
+                       sub { rec('011','a') }, 
+                       sub { rec('11') } 
+               )
+       );
+}
+
+
+#marc('998','a',
+#      lookup(
+#              sub { rec('H') },
+#              'ffsf','xls',
+#              sub { rec('A') },
+#              sub { $id },
+#      ),
+#);
+
+
+### 5xx
+# koje podatke povuæi iz drugih baza?
+
+marc('500','a',
+       rec('300','a'),
 );
+
+### 534 - napomena o pretisku
 
+marc('534','a',
+       rec('324')
+);
 
-# marc('562','a',
+## potencijalno za izvuæi iz NSK
+#if ( rec('11') ) {
+#marc('546','a',
 #      lookup(
-#              sub { rec('316','a') },
-#              'nsk','bbaza',
+#              sub { rec('302','a') },
+#              'nsk','bbaza',
 #              sub { rec('011','a') },
 #              sub { rec('11') },
 #      ) 
-# );
-}
+#);
+#
+#marc('550','a',
+#      lookup(
+#              sub { rec('314','a') },
+#              'nsk','bbaza',
+#              sub { rec('011','a') },
+#              sub { rec('11') },
+#      ) 
+#);
+#
+#marc('555','a',
+#      lookup(
+#              sub { rec('320','a') },
+#              'nsk','bbaza',
+#              sub { rec('011','a') },
+#              sub { rec('11') },
+#      ) 
+#);
+#
+#
+## marc('562','a',
+##     lookup(
+##             sub { rec('316','a') },
+##             'nsk','bbaza',
+##             sub { rec('011','a') },
+##             sub { rec('11') },
+##     ) 
+## );
+#}
+
+### 653 indikatori
 marc_indicators('653', 0, ' ');
+
+### 653
+
 marc('653','a',
        rec('610')
 );
@@ -399,8 +575,12 @@ marc('653','a',
 
 #_debug(2);
 
+### 700 indikatori
+
 marc_indicators('700', 1, ' ');
 
+### 700
+
 marc('700','a',
        rec('702','a'),
 );
@@ -415,53 +595,120 @@ marc('700','a',
  
 #_debug(0);
 
+### 710 indikatori
+
 marc_indicators('710', '2', ' ');
+
+### 710
 marc('710','a',
        rec('710','a')
 );
 
+### 770 indikatori
 
 marc_indicators('770', 0, ' ');
+
+### 770
 marc('770','t',
        rec('421','a'),
 );
 
+### 772 indikatori
 marc_indicators('772', 0, ' ');
+
+### 772
 marc('772','t',
        rec('422','a'),
 );
 
+### 773 indikatori
+
+if ( rec('225','a') ) {
+
+marc_indicators('773', 0, ' ');
+
+### 773
+## da li je bitan redoslijed potpolja?
+
+marc('773','w',
+       lookup(
+               sub { rec('000') },
+               'ffsf','peri',
+               sub { rec('200','a') },
+               sub { 
+                       regex('s/ ; //g',
+                               rec('225','a')
+                       )
+               },
+       )
+);
+
+}
+
+
+### 777 indikatori
+
 marc_indicators('777', 0, ' ');
+
+### 777
+
 marc('777','t',
        rec('423','a'),
 );
 
+### 780 indikatori
+
 marc_indicators('780', 0, 0);
+
+### 780
 marc('780','t',
        rec('430','a'),
 );
 
+### 785 indikatori
+
 marc_indicators('785', 0, 0);
+
+### 785
 marc('785','t',
        rec('440','a'),
 );
 
+### 852
+
 marc('852','j',
        join_with(' ',
                rec('990')
        )
 );
 
+### 876
+
 marc('876','a',
        rec('991','a')
 );
 
+### 992
+
 marc('992','a',
        join_with(' ; ', 
                rec('992')
        )
 );
 
+
+### polja za probu
+
+
+#marc('998','a',
+#      lookup(
+#              sub { rec('200','a') },
+#              'ffiz','peri',
+#              sub { rec('200','a'), },
+#              sub { rec('225','a'), }
+#      )
+#);
+
  
 # marc('997','a',
 #      sort(
@@ -496,4 +743,4 @@ marc('992','a',
 #      )
 # );
 
-}
+}# 200a