diff --git a/bin/slubsipbuilder.pl b/bin/slubsipbuilder.pl index fddf6c8eda406a28975e79360f7a28807e45b2df..a3ff39663c47de22ca260b107b04d330e66145da 100755 --- a/bin/slubsipbuilder.pl +++ b/bin/slubsipbuilder.pl @@ -46,7 +46,6 @@ my $directory; my $ppn; my $noppn; my $output; -my $url; my $as_zip; my $external_id; my $external_workflow; @@ -64,7 +63,6 @@ GetOptions( "noppn=s" => \$noppn, # semi-optional (choice 2 of 2) "SIP_output_path=s" => \$output, # required "as_zip" => \$as_zip, # optional, default: do not zip - "url=s" => \$url, # optional, default: SWB Online-Katalog "external_id=s" => \$external_id, # required "external_workflow=s" => \$external_workflow, # required "external_ISIL=s" => \$external_isil, # optional, default: no ISIL @@ -81,13 +79,14 @@ if (!defined $directory) { confess("you need to specify an IE if ((defined $ppn) && (defined $noppn)) { confess("you can only specify either -ppn or -noppn"); } if ((!defined $ppn) && (!defined $noppn)) { confess("you need to specify a PPN with -ppn or use --noppn"); } if (!defined $output) { confess("you need to specify an output path, where the SIP will be stored"); } -if (!defined $url) { $url = "http://swb.bsz-bw.de/sru/DB=2.1/username=/password=/";} if (!defined $external_conservation_flag) { $external_conservation_flag="false"; } else { $external_conservation_flag="true"; } if (! -d $directory) { confess("you need to specify an IE directory, which needs to be archived, $!"); } if ($directory !~ m#^/#) { $directory = abs_path($directory); } if ($external_id !~ m#^[a-z0-9]+$#) { confess("you need to specify a valid external ID (^[a-z0-9]+\$)"); } if ($external_workflow !~ m#^[a-z0-9]+$#) { confess("you need to specify a valid external workflow (^[a-z0-9]+\$)"); } if (!$external_value_descr) { confess("you need to specify an external value description (reason for archiving)"); } +my ($url, $searchkey, $recordschema); +if (defined $ppn) { $url="https://sru.bsz-bw.de/swb"; $searchkey="pica.swn"; $recordschema="marcxmlvbos"; }; #=============================================================================== @@ -168,9 +167,11 @@ PATCH2 return $result; } -sub get_mods_from ($$) { # $mods = ($url, $ppn) +sub get_mods_from ($$$$) { # $mods = ($url, $ppn, $searchkey, $recordschema) my $url = shift; my $ppn = shift; # example: "457035137" for "Der Fichtelberg" + my $key = shift; + my $schema = shift; # check xsl directory my $xsl_dir = dirname(__FILE__) . '/../xsl/'; @@ -220,11 +221,13 @@ sub get_mods_from ($$) { # $mods = ($url, $ppn) } my $srubase=$url; # host - my $srusearchkey="pica.ppn"; + my $srusearchkey=$key; # SRU search key my $sruvalue=$ppn; my $srumaxrecords=1; - my $sruschema="marc21"; - my $sru = "${srubase}?query=${srusearchkey}+%3D+%22${sruvalue}%22&startRecord=1&maximumRecords=${srumaxrecords}&recordSchema=${sruschema}&recordPacking=xml&version=1.1&stylesheet=http%3A%2F%2Fswb2.bsz-bw.de%2Fsru%2FDB%3D2.1%2F%3Fxsl%3DsearchRetrieveResponse"; + my $srustartrecord=1; + my $sruschema=$schema; + my $sru = "${srubase}?version=1.1&query=${srusearchkey}%3D${sruvalue}&operation=searchRetrieve&maximumRecords=${srumaxrecords}&startRecord=${srustartrecord}&recordSchema=${sruschema}"; + if ($with_debug) { say "catalog-URL='$sru'"; }; my $record = $ua->get($sru); # ask SWB for given PPN if ($record->is_success) { # parse ZiNG repsonse, extract MARC-data @@ -286,7 +289,7 @@ sub main { # prepare dmd-sec my $mods; if (defined $ppn) { - $mods = get_mods_from($url, $ppn); + $mods = get_mods_from($url, $ppn, $searchkey, $recordschema); if ($with_debug) { write_file("DEBUG_${ppn}_mods.xml", $mods); } @@ -476,10 +479,9 @@ slubsipbuilder.pl [options] -man full documentation -IE_directory=<IE dir> existing IE directory (absolute path!) - -ppn=<ppn>|-noppn=<noppn> PPN (swb catalogue) or any identifier (uses minimalistic MODS) + -ppn=<ppn>|-noppn=<noppn> SWB-PPN or any identifier (uses minimalistic MODS) -SIP_output_path=<target dir> where to put the SIP dir (absolute path!) -as_zip optional, if set a ZIP will be created - -url=<SRU url> optional, URL of the SRU for PICA catalogues -external_id=<id> mandatory, should be uniqe ID -external_workflow=<workflow> mandatory, should be uniqe workflow name -external_ISIL=<isil> optional, ISIL number of library