comparison makemeta-vlp.pl @ 44:af4323868086

added production-comment, derived-from and access handling
author casties
date Mon, 11 Dec 2006 19:08:24 +0100
parents 7bf843ac256b
children 173e9823761e
comparison
equal deleted inserted replaced
43:27f273329930 44:af4323868086
8 8
9 # make output unbuffered 9 # make output unbuffered
10 $|=1; 10 $|=1;
11 11
12 # program version 12 # program version
13 my $version = "0.2.3 (27.6.2006 ROC)"; 13 my $version = "0.2.4 (5.12.2006 ROC)";
14 my $help = 14 my $help =
15 "use: makemeta-vlp [options] file.xml 15 "use: makemeta-vlp [options] file.xml
16 options: 16 options:
17 -debug show debugging info 17 -debug show debugging info
18 -dry-run simulate, dont'do anything 18 -dry-run simulate, dont'do anything
19 -replace replace existing index files 19 -replace replace existing index files
20 -online-mode mode for creating online/permanent files 20 -online-mode mode for creating online/permanent files
21 -archive-mode mode for creating archive/data files 21 -archive-mode mode for creating archive/data files
22 -access=free adds free access tag for online-mode
22 "; 23 ";
23 logger("INFO", "makemeta-vlp $version"); 24 logger("INFO", "makemeta-vlp $version");
24 25
25 ########################################### 26 ###########################################
26 # mappings 27 # mappings
27 28
28 # generic mappings at top level 29 # generic mappings at top level
29 my %gen_map = ( 30 my %gen_map = (
30 'Custom2_Language' => 'meta/lang' 31 'Custom2_Language' => 'meta/lang',
32 'ProductionComment' => 'meta/image-acquisition/production-comment',
33 'derivedFrom' => 'derived-from/archive-path'
31 ); 34 );
32 # sub type switch tag 35 # sub type switch tag
33 my %type_map = ( 36 my %type_map = (
34 'ReferenceType' => 'meta/bib@type' 37 'ReferenceType' => 'meta/bib@type'
35 ); 38 );
217 220
218 # use archive mode 221 # use archive mode
219 my $archive_mode = (exists $$args{'archive-mode'}) ? $$args{'archive-mode'} : 0; 222 my $archive_mode = (exists $$args{'archive-mode'}) ? $$args{'archive-mode'} : 0;
220 logger('DEBUG', "archive_mode: $archive_mode"); 223 logger('DEBUG', "archive_mode: $archive_mode");
221 224
225 # access type
226 my $access_type = (exists $$args{'access'}) ? $$args{'access'} : "";
227
222 # index.meta namespace (not really implemented!) 228 # index.meta namespace (not really implemented!)
223 my $namespace = ""; 229 my $namespace = "";
224 230
225 231
226 my $xml_changed = 0; 232 my $xml_changed = 0;
264 return; 270 return;
265 } 271 }
266 272
267 sub find_permanent_dir { 273 sub find_permanent_dir {
268 my ($input_node) = @_; 274 my ($input_node) = @_;
269 my $online_base = '/mpiwg/online/permanent'; 275 my $online_base = $lib_online_dir;
270 my $dest_id = sstrip($input_node->findvalue("fm:$arch_id_field")); 276 my $dest_id = sstrip($input_node->findvalue("fm:$arch_id_field"));
271 if (! $dest_id) { 277 if (! $dest_id) {
272 logger('ERROR', "no ID field for online permanent entry"); 278 logger('ERROR', "no ID field for online permanent entry");
273 $errcnt++; 279 $errcnt++;
274 return; 280 return;
405 if ($archive_mode) { 411 if ($archive_mode) {
406 # acquisition 412 # acquisition
407 create_text_path('meta/acquisition/date', stime(time), $index_root, $namespace); 413 create_text_path('meta/acquisition/date', stime(time), $index_root, $namespace);
408 create_text_path('meta/acquisition/provider/provider-id', 'vlp', $index_root, $namespace); 414 create_text_path('meta/acquisition/provider/provider-id', 'vlp', $index_root, $namespace);
409 create_text_path('meta/acquisition/provider/address', 'Max Planck Institute for the History of Science', $index_root, $namespace); 415 create_text_path('meta/acquisition/provider/address', 'Max Planck Institute for the History of Science', $index_root, $namespace);
410 # image acquisition
411 create_text_path('meta/image-acquisition/device', 'Flatbed Scanner' , $index_root, $namespace);
412 create_text_path('meta/image-acquisition/image-type', 'Greyscale' , $index_root, $namespace);
413 create_text_path('meta/image-acquisition/production-comment', 'Raw scans in \'raw\' folder, cleaned pages in \'pages\' folder.' , $index_root, $namespace);
414 } 416 }
415 # media 417 # media
416 create_text_path('media-type', 'image', $index_root, $namespace); 418 create_text_path('media-type', 'image', $index_root, $namespace);
417 create_text_path('meta/content-type', 'scanned document', $index_root, $namespace); 419 create_text_path('meta/content-type', 'scanned document', $index_root, $namespace);
420 # access
421 if ($access_type) {
422 if ($access_type eq "free") {
423 create_element_path('meta/access-conditions/access@type=free', $index_root, $namespace);
424 } else {
425 my $acc_tag = create_element_path('meta/access-conditions/access@type=institution', $index_root, $namespace);
426 create_text_path('name', $access_type, $acc_tag, $namespace);
427 }
428 }
418 429
419 # convert bib entries 430 # convert bib entries
420 my $cnt = convert_bib($input_node, $index_root, $index_doc); 431 my $cnt = convert_bib($input_node, $index_root, $index_doc);
421 if ($cnt == 0) { 432 if ($cnt == 0) {
422 # error or nothing to convert 433 # error or nothing to convert