Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SLUB_SIP_Builder
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Digital Preservation
SLUB_SIP_Builder
Commits
3df8377c
Commit
3df8377c
authored
4 years ago
by
Jens Steidl
Browse files
Options
Downloads
Patches
Plain Diff
- refactor: get only marc21 from catalogue, removed transformation to mods
parent
8ea49d23
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/slubsipbuilderbagit.pl
+7
-25
7 additions, 25 deletions
bin/slubsipbuilderbagit.pl
with
7 additions
and
25 deletions
bin/slubsipbuilderbagit.pl
+
7
−
25
View file @
3df8377c
...
...
@@ -84,19 +84,19 @@ package SLUB::LZA::SIPBuilderBagIt;
my
$recordschema_k10p
=
'
marcxmlk10os
';
our
$with_debug
=
0
;
sub
prepare_mods_section_with_ppn
($){
sub
get_marc21_from_catalogue
($){
if
(
!
defined
$_
[
0
]){
croak
"
ppn not defined!
";
}
my
$ppn
=
shift
;
my
$m
ods
;
my
$m
arc21
;
eval
{
$m
ods
=
SLUB::LZA::SIPBuilderBagIt::
get_m
ods
_from
(
$swb_url
,
$ppn
,
$searchkey_swb
,
$recordschema_swb
);
$m
arc21
=
SLUB::LZA::SIPBuilderBagIt::
get_m
arc21
_from
(
$swb_url
,
$ppn
,
$searchkey_swb
,
$recordschema_swb
);
};
if
(
$@
)
{
# Fallback to K10plus PPN
if
(
$@
=~
m#ERROR: Did not get any <recordData/> for PPN#
)
{
print_scalar_data
("",
"
WARNING: '
$ppn
' not a SWB PPN, fallback to K10plus
",
"",
"
yellow
");
$m
ods
=
SLUB::LZA::SIPBuilderBagIt::
get_m
ods
_from
(
$swb_url
,
$ppn
,
$searchkey_k10p
,
$recordschema_k10p
);
$m
arc21
=
SLUB::LZA::SIPBuilderBagIt::
get_m
arc21
_from
(
$swb_url
,
$ppn
,
$searchkey_k10p
,
$recordschema_k10p
);
}
else
{
die
"
$@
";
# throw exception again
...
...
@@ -104,15 +104,10 @@ package SLUB::LZA::SIPBuilderBagIt;
}
print_scalar_data
("",
"
INFO: Found metadata for PPN '
$ppn
'
",
"",
"
white
");
if
(
$with_debug
){
SLUB::LZA::SIPBuilderBagIt::
write_file
("
DEBUG_
${ppn}
_mods.xml
",
$mods
);
}
return
$mods
;
return
$marc21
;
}
sub
get_m
ods
_from
($$$$){
sub
get_m
arc21
_from
($$$$){
# specification SRU/SRW BSZ: https://wiki.k10plus.de/pages/viewpage.action?pageId=132874251
if
(
!
defined
$_
[
0
])
{
croak
"
url not defined!
";
}
if
(
!
defined
$_
[
1
])
{
croak
"
ppn not defined!
";
}
...
...
@@ -134,7 +129,6 @@ package SLUB::LZA::SIPBuilderBagIt;
my
$xsl_dir
=
SLUB::LZA::SIPBuilderBagIt::
check_xsl_directory
();
SLUB::LZA::SIPBuilderBagIt::
check_marc21_utility
(
$xsl_dir
,
$ua
);
SLUB::LZA::SIPBuilderBagIt::
check_marc21_mods_xsl
(
$xsl_dir
,
$ua
);
my
$srubase
=
$url
;
# host
my
$srusearchkey
=
$key
;
# SRU search key
...
...
@@ -167,19 +161,7 @@ package SLUB::LZA::SIPBuilderBagIt;
SLUB::LZA::SIPBuilderBagIt::
write_file
("
DEBUG_
${ppn}
_marc.xml
",
$marcblob_patched
);
}
my
$marc_mods_patched_path
=
SLUB::LZA::SIPBuilderBagIt::
check_marc21_mods_xsl
(
$xsl_dir
,
$ua
);
my
$xslt
=
XML::
LibXSLT
->
new
();
my
$marcmods
=
XML::
LibXML
->
load_xml
(
location
=>
$marc_mods_patched_path
,
no_cdata
=>
1
);
my
$stylesheet
=
$xslt
->
parse_stylesheet
(
$marcmods
);
my
$marc
=
$parser
->
parse_string
(
$marcblob_patched
);
my
$result
=
$stylesheet
->
transform
(
$marc
);
if
(
$with_debug
)
{
say
"
write DEBUG_
${ppn}
_unpatched_mods.xml
";
SLUB::LZA::SIPBuilderBagIt::
write_file
("
DEBUG_
${ppn}
_unpatched_mods.xml
",
$stylesheet
->
output_string
(
$result
));
}
$result
=
patch_mods
(
$result
);
my
$result_string
=
$stylesheet
->
output_string
(
$result
);
return
$result_string
;
return
$marcblob_patched
;
}
else
{
carp
("
Problem asking catalogue at
$url
using
$ppn
");
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment