TobiasNx

Results 77 comments of TobiasNx

@dr0i as we talked about with I.W. transformation marc21 -> marcxml is needed.

Found two workarounds for: `decode-marc21(emitLeaderAsWhole="true")` -> `encode-marc21`: [See here.](https://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%28emitLeaderAsWhole%3D%22true%22%29%0A%7C+fix%28transformationFile%29%0A%7C+encode-marc21%0A%7C+print%0A%3B&transformation=copy_field%28%22leader.leader%22%2C%[email protected]%22%29%0Acopy_field%28%22leader.leader%22%2C%[email protected]%22%29%0Acopy_field%28%22leader.leader%22%2C%[email protected]%22%29%0Acopy_field%28%22leader.leader%22%2C%[email protected]%22%29%0Acopy_field%28%22leader.leader%22%2C%[email protected]%22%29%0Acopy_field%28%22leader.leader%22%2C%[email protected]%22%29%0Acopy_field%28%22leader.leader%22%2C%[email protected]%22%29%0Acopy_field%28%22leader.leader%22%2C%[email protected]%22%29%0A%0Asubstring%28%[email protected]%22%2C%225%22%2C%221%22%29%0Asubstring%28%[email protected]%22%2C%226%22%2C%221%22%29%0Asubstring%28%[email protected]%22%2C%227%22%2C%221%22%29%0Asubstring%28%[email protected]%22%2C%228%22%2C%221%22%29%0Asubstring%28%[email protected]%22%2C%229%22%2C%221%22%29%0Asubstring%28%[email protected]%22%2C%2217%22%2C%221%22%29%0Asubstring%28%[email protected]%22%2C%2218%22%2C%221%22%29%0Asubstring%28%[email protected]%22%2C%2219%22%2C%221%22%29%0A%0Amove_field%28%22@leader%22%2C%22leader%22%29) `handle-marcXml` -> `encode-marc21`: [See here.](https://metafacture.org/playground/?flux=%22https%3A//d-nb.info/1106253078/about/marcxml%22%0A%7C+open-http%28accept%3D%22application/xml%22%29%0A%7C+decode-xml%0A%7C+handle-marcxml%0A%7C+fix%28transformationFile%29%0A%7C+encode-marc21%0A%7C+print%0A%3B&transformation=copy_field%28%22leader%22%2C%[email protected]%22%29%0Acopy_field%28%22leader%22%2C%[email protected]%22%29%0Acopy_field%28%22leader%22%2C%[email protected]%22%29%0Acopy_field%28%22leader%22%2C%[email protected]%22%29%0Acopy_field%28%22leader%22%2C%[email protected]%22%29%0Acopy_field%28%22leader%22%2C%[email protected]%22%29%0Acopy_field%28%22leader%22%2C%[email protected]%22%29%0Acopy_field%28%22leader%22%2C%[email protected]%22%29%0A%0Asubstring%28%[email protected]%22%2C%225%22%2C%221%22%29%0Asubstring%28%[email protected]%22%2C%226%22%2C%221%22%29%0Asubstring%28%[email protected]%22%2C%227%22%2C%221%22%29%0Asubstring%28%[email protected]%22%2C%228%22%2C%221%22%29%0Asubstring%28%[email protected]%22%2C%229%22%2C%221%22%29%0Asubstring%28%[email protected]%22%2C%2217%22%2C%221%22%29%0Asubstring%28%[email protected]%22%2C%2218%22%2C%221%22%29%0Asubstring%28%[email protected]%22%2C%2219%22%2C%221%22%29%0A%0Amove_field%28%22@leader%22%2C%22leader%22%29)

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...

@dr0i and @blackwinter the[ suggested workaround seems to work](https://metafacture.org/playground/?flux=%22https%3A//github.com/LibreCat/Catmandu/wiki/files/camel.usmarc%22%0A%7C+open-http%28encoding%3D%22ascii%22%29%0A%7C+as-lines%0A%7C+match%28pattern%3D%22\\A%28.%7B9%7D%29+%22%2C+replacement%3D%22%241a%22%29%0A%7C+decode-marc21%0A%7C+encode-yaml%0A%7C+print%0A%3B%0A). Thanks.

I tested it. Seems to run smoothly now! Great :)

@dr0i What kind of test do you need? Because in the playground we have an example.

I am not sure. We are transforming the OERSI JSON Data to Marc, but @maipet told me about invalid results created by the transformation due to the missing leader elements...

While inspecting some workaround for #454, I saw that the marc21-encoder seems to have a mechanism for that: https://metafacture.org/playground/?flux=%22https%3A//d-nb.info/1106253078/about/marcxml%22%0A%7C+open-http%28accept%3D%22application/xml%22%29%0A%7C+decode-xml%0A%7C+handle-marcxml%0A%7C+fix%28transformationFile%29%0A%7C+encode-marc21%0A%7C+decode-marc21%28emitLeaderAsWhole%3D%22true%22%29%0A%7C+encode-yaml%0A%7C+print%0A%3B&transformation=copy_field%28%22leader%22%2C%[email protected]%22%29%0Acopy_field%28%22leader%22%2C%[email protected]%22%29%0Acopy_field%28%22leader%22%2C%[email protected]%22%29%0Acopy_field%28%22leader%22%2C%[email protected]%22%29%0Acopy_field%28%22leader%22%2C%[email protected]%22%29%0Acopy_field%28%22leader%22%2C%[email protected]%22%29%0Acopy_field%28%22leader%22%2C%[email protected]%22%29%0Acopy_field%28%22leader%22%2C%[email protected]%22%29%0A%0Asubstring%28%[email protected]%22%2C%225%22%2C%221%22%29%0Asubstring%28%[email protected]%22%2C%226%22%2C%221%22%29%0Asubstring%28%[email protected]%22%2C%227%22%2C%221%22%29%0Asubstring%28%[email protected]%22%2C%228%22%2C%221%22%29%0Asubstring%28%[email protected]%22%2C%229%22%2C%221%22%29%0Asubstring%28%[email protected]%22%2C%2217%22%2C%221%22%29%0Asubstring%28%[email protected]%22%2C%2218%22%2C%221%22%29%0Asubstring%28%[email protected]%22%2C%2219%22%2C%221%22%29%0A%0Amove_field%28%22@leader%22%2C%22leader%22%29 Someone more advanced should have a look to confirm. Probably we...

> Code can be reused for `encode-marc21` @dr0i: Isn't `encode-marc21` already doing this? See: https://github.com/metafacture/metafacture-core/issues/524#issuecomment-2056344931