changeset 44:af4323868086

added production-comment, derived-from and access handling
author casties
date Mon, 11 Dec 2006 19:08:24 +0100
parents 27f273329930
children b1f1d1fbf6e5
files makemeta-vlp.pl
diffstat 1 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/makemeta-vlp.pl	Mon Dec 11 19:07:43 2006 +0100
+++ b/makemeta-vlp.pl	Mon Dec 11 19:08:24 2006 +0100
@@ -10,7 +10,7 @@
 $|=1;
 
 # program version
-my $version = "0.2.3 (27.6.2006 ROC)";
+my $version = "0.2.4 (5.12.2006 ROC)";
 my $help = 
 "use: makemeta-vlp [options] file.xml
 options:
@@ -19,6 +19,7 @@
   -replace  replace existing index files
   -online-mode  mode for creating online/permanent files
   -archive-mode  mode for creating archive/data files
+  -access=free  adds free access tag for online-mode
 ";
 logger("INFO", "makemeta-vlp $version");
 
@@ -27,7 +28,9 @@
 
 # generic mappings at top level
 my %gen_map = (
-    'Custom2_Language' => 'meta/lang'
+    'Custom2_Language' => 'meta/lang',
+    'ProductionComment' => 'meta/image-acquisition/production-comment',
+    'derivedFrom' => 'derived-from/archive-path'
     );
 # sub type switch tag
 my %type_map = (
@@ -219,6 +222,9 @@
 my $archive_mode = (exists $$args{'archive-mode'}) ? $$args{'archive-mode'} : 0;
 logger('DEBUG', "archive_mode: $archive_mode");
 
+# access type
+my $access_type = (exists $$args{'access'}) ? $$args{'access'} : "";
+
 # index.meta namespace (not really implemented!)
 my $namespace = "";
 
@@ -266,7 +272,7 @@
 
 sub find_permanent_dir {
     my ($input_node) = @_;
-    my $online_base = '/mpiwg/online/permanent';
+    my $online_base = $lib_online_dir;
     my $dest_id = sstrip($input_node->findvalue("fm:$arch_id_field"));
     if (! $dest_id) {
 	logger('ERROR', "no ID field for online permanent entry");
@@ -407,14 +413,19 @@
       create_text_path('meta/acquisition/date', stime(time), $index_root, $namespace);
       create_text_path('meta/acquisition/provider/provider-id', 'vlp', $index_root, $namespace);
       create_text_path('meta/acquisition/provider/address', 'Max Planck Institute for the History of Science', $index_root, $namespace);
-      # image acquisition
-      create_text_path('meta/image-acquisition/device', 'Flatbed Scanner' , $index_root, $namespace);
-      create_text_path('meta/image-acquisition/image-type', 'Greyscale' , $index_root, $namespace);
-      create_text_path('meta/image-acquisition/production-comment', 'Raw scans in \'raw\' folder, cleaned pages in \'pages\' folder.' , $index_root, $namespace);
     }
     # media
     create_text_path('media-type', 'image', $index_root, $namespace);
     create_text_path('meta/content-type', 'scanned document', $index_root, $namespace);
+    # access
+    if ($access_type) {
+	if ($access_type eq "free") {
+	    create_element_path('meta/access-conditions/access@type=free', $index_root, $namespace);
+	} else {
+	    my $acc_tag = create_element_path('meta/access-conditions/access@type=institution', $index_root, $namespace);
+	    create_text_path('name', $access_type, $acc_tag, $namespace);
+	}
+    }
 
     # convert bib entries
     my $cnt = convert_bib($input_node, $index_root, $index_doc);