Closed TobiasNx closed 2 months ago
I would suggest the following changes:
leader
in decode-marc21(emitleaderaswhole="true")
, so that leader
is not an entity
with a subfield
but there is only one element leader
emitleaderasentity="true"
to handle-marc-xml
so that it outputs marc as the decode-marc21
does by defaultemitleaderaswhole (with default true)
this is more consistent and if false
leader would output like decode-marc21
encode-marcxml
and encode-marc
so that they can handle the leader
as entity with subfields and as simple fieldJust a minor observation:
add the option
emitleaderasentity="true"
Wouldn't it make more sense to use the same option emitleaderaswhole
(with default true
)?
Just a minor observation:
add the option
emitleaderasentity="true"
Wouldn't it make more sense to use the same option
emitleaderaswhole
(with defaulttrue
)?
Or like that.
@dr0i would be nice if the handle-marc-xml
-module would support the emitleaderaswhole=
option soon.
it would help to make the almaFix especially the handling of leader
-fields for the facets more readable and one would have less fuzz with variabes: https://github.com/hbz/lobid-resources/blob/4172bfef38c45e422cff14cfac56c6d81e7b8b67/src/main/resources/alma/alma.fix#L1-L11
I found this again. We cannot just transform marc21 -> marcxml or the other way around marcxml -> marc21 due to the inconsistent leader handling. We additionally need to transform the data with a fix. But even this does not work:
@dr0i as we talked about with I.W. transformation marc21 -> marcxml is needed.
I try to condense the issues. I will give the scenarios references ([a,b,c ...] so we can easily refer to them :
a) marc21 -> marc21 works ( just do | decode-marc21(emitLeaderAsWhole="false")
)
b) marc21-> marcxml works (just do | decode-marc21(emitleaderaswhole="true")
)
c) handle-marcxml -> encode-marc21 doesn't work
For c) we have to think about a solution: The Marc21Encoder
expects (in method processLiteralInLeader
) that a leader
consists of single literals which consists as a Byte
(a leader entity with many values). I.e. a leader
cannot be one String
. See https://github.com/metafacture/metafacture-core/commit/6d04d6976c98eb7173c773b2f4ddca3b7e0037d3 for introducing this and also the motivation to do so (which I don't understand - I mean we see there are problems coming with the removing of parsing/producing the leader
as one String.)).
We could solve c) by:
ca) "would be nice if the handle-marc-xml -module would support the emitleaderaswhole= option soon". We would allow emitleaderaswhole=false
which would set them as a single Byte
array or
cb) encode-marc21
would be able (again) to cope with a single leader
String.
I think cb) would be the best , because as a sideeffect we wouldn't need to tell in a) emitleaderaswhole=false
as it would also cope emitleaderaswhole=true
.
I think we touch reasons for the change of handling of the leader here #524. Changes in the records when transforming marc21->marc21 (XML and binary) also need changes in the leader since part of the leader are generated based on the number of signs, indicators, elements, subfields. Otherwise the leader and the record are not valid.
Note: went with cb) as fix.
While the documentation of encode-marc21 states that it is compatible with the output of
handle-marc-xml
anddecode-marc21
, this is not factual due to inconsistent leader handling bydecode-marc21
,handle-marc-xml
,encode-marc21
andencode-marcxml
.e.g.: We cannot transform marc21-> marcxml or the other way around. even marc21 -> marc21 is not so easy. See here This creates the same error as if it would process marc-xml.
Functional review: @TobiasNx Code review: @blackwinter
Behaviour of Flux-Modules:
decode-marc21
changes the leader to their specific function of the position: See herewith option
emitleaderaswhow="true"
the leader-element is an toplevel and sublevel field See herehandle-marc-xml
keeps the leader as an own field: See here:encode-marcxml
can handle the result ofdecode-marc21(emitleaderaswhole="true")
but cannot if the leader is ommited in multiple fields results in leader with multiple fields.Then re result looks like this:
It seems that there is no control if there is only one leader.
encode-marc21
cannot handle data fromhandle-marcxml
: seeError is:
Also not from
decode-marc21(emitleaderaswhole="true")
seeThe error is:
So besides inconsistencies it is difficult to transform marc21-> marcxml or the other way around. even marc21 -> marc21 is not so easy. See here This creates the same error as if it would process marc-xml.