Skip to content

Conversation

@dr0i
Copy link
Member

@dr0i dr0i commented Apr 19, 2024

Resolves #454 and resolves #524.

"leader" can be given as top-level literal or as literal in an entity.
This makes the claim "The stream expected by the encoder is compatible to the
streams emitted by the { Marc21Decoder} and the {MarcXmlHandler}."
true again.

@dr0i dr0i requested a review from blackwinter April 19, 2024 13:23
@dr0i dr0i self-assigned this Apr 19, 2024
@dr0i dr0i removed the request for review from blackwinter April 19, 2024 13:49
@dr0i dr0i force-pushed the 454-allowMarc21EncoderToGetLeaderAsOneString branch from 4570572 to 83432a1 Compare April 19, 2024 14:03
"leader" can be given aa top-level literal or as literal in an entity.
This makes the claim "The stream expected by the encoder is compatible to the
streams emitted by the {@link Marc21Decoder} and the {@link MarcXmlHandler}."
true again.
@dr0i dr0i force-pushed the 454-allowMarc21EncoderToGetLeaderAsOneString branch from 83432a1 to e2c4c0d Compare April 19, 2024 14:04
@dr0i dr0i requested review from TobiasNx and blackwinter April 19, 2024 14:11
@dr0i
Copy link
Member Author

dr0i commented Apr 19, 2024

functional review: @TobiasNx . Deployed to test-playground. Test from #454 (comment) :
c) handle-marcxml -> encode-marc21
(which should work now).

Also note that we don't need to set the emitleaderaswhole explicitly for these cases:
a) marc21 -> marc21 works ( just do | decode-marc21)
b) marc21-> marcxml works (just do | decode-marc21)

@TobiasNx
Copy link
Contributor

TobiasNx commented Apr 22, 2024

functional review: @TobiasNx . Deployed to test-playground. Test from #454 (comment) : c) handle-marcxml -> encode-marc21 (which should work now).

Also note that we don't need to set the emitleaderaswhole explicitly for these cases: a) marc21 -> marc21 works ( just do | decode-marc21) b) marc21-> marcxml works (just do | decode-marc21)

This does not seem to work yet: https://test.metafacture.org/playground/?flux=%22https%3A//raw.githubusercontent.com/metafacture/metafacture-core/master/metafacture-runner/src/main/dist/examples/read/marc21/10.marc21%22%0A%7C+open-http%0A%7C+as-lines%0A%7C+decode-marc21%0A%7C+encode-marcxml%0A%7C+print%0A%3B

decode-marc21(emitLeaderAsWhole="false")` -> encode-marcxml => the separated elements are kept:

		<marc:leader>p</marc:leader>
		<marc:leader>a</marc:leader>
		<marc:leader>m</marc:leader>
		<marc:leader> </marc:leader>
		<marc:leader>a</marc:leader>
		<marc:leader> </marc:leader>
		<marc:leader>c</marc:leader>
		<marc:leader> </marc:leader>

leader should be combined.

Copy link
Contributor

@TobiasNx TobiasNx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This usecase is not resolved: #526 (comment)

Otherwise very cool.

@dr0i
Copy link
Member Author

dr0i commented Apr 22, 2024

decode-marc21(emitLeaderAsWhole="false")` -> encode-marcxml => the separated elements are kept:

They are kept as separated elements because you told it to do so by using (emitLeaderAsWhole="false"). If you want to have one leader string, set it to true.

@TobiasNx
Copy link
Contributor

TobiasNx commented Apr 22, 2024

decode-marc21(emitLeaderAsWhole="false")` -> encode-marcxml => the separated elements are kept:

They are kept as separated elements because you told it to do so by using (emitLeaderAsWhole="false"). If you want to have one leader string, set it to true.

But this creates invalid marc xml data. I am confused. I thought encode-marcxml should behave in the same way as encode-marc21, if the data is seperated the encoder should combine them.

It creates invalid marc xml data. See the leader spec here in the schema: https://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd

@TobiasNx
Copy link
Contributor

decode-marc21(emitLeaderAsWhole="false")` -> encode-marcxml => the separated elements are kept:

They are kept as separated elements because you told it to do so by using (emitLeaderAsWhole="false"). If you want to have one leader string, set it to true.

But this creates invalid marc xml data. I am confused. I thought encode-marcxml should behave in the same way as encode-marc21, if the data is seperated the encoder should combine them.

It creates invalid marc xml data. See the leader spec here in the schema: loc.gov/standards/marcxml/schema/MARC21slim.xsd

Discussed with @dr0i of board that I will open a new issue for this scenario. To be fixed after this PR.

So +1 from me.

Copy link
Contributor

@TobiasNx TobiasNx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 fix invalid handling of marc leader by encode-marcxml in next issue.

- fix typo
- remove superflous endEntity
- add method to avoid unnecessary char-string conversion
@dr0i dr0i merged commit bd719d2 into master Apr 22, 2024
@dr0i dr0i deleted the 454-allowMarc21EncoderToGetLeaderAsOneString branch April 22, 2024 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Counted leader elements in marc when encoding to marc Incompatible StreamReceiver output by marc modules due to inconsistent leader handling

4 participants