Skip to content

Counted leader elements in marc when encoding to marc #524

Closed

Description

@TobiasNx

@maipet hinted that encode-marc21 or encode-marcxml cannot create the leader correctly since the elements are not counted.
Could you elaborate the problem

Activity

  1. blackwinter commented on Apr 10, 2024

    @blackwinter
    Member

    Is this related to #454?

  2. TobiasNx commented on Apr 10, 2024

    @TobiasNx
    ContributorAuthor

    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 that state e.g. the length of a record.

    But @maipet could clarify.

  3. maipet commented on Apr 10, 2024

    @maipet

    you can set the leader field, but leader "Character Positions 00-04 - Record length" & "Pos. 12-16 - Base address of data" should actually be generated automatically? It was discussed with @dr0i that we should first check whether the marc records from OERSI are 'valid' even without the correct information in the leader (the positions are currently filled with zeros).

  4. assigned and unassigned on Apr 11, 2024
  5. TobiasNx commented on Apr 15, 2024

    @TobiasNx
    ContributorAuthor

    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%22@leader.status%22%29%0Acopy_field%28%22leader%22%2C%22@leader.type%22%29%0Acopy_field%28%22leader%22%2C%22@leader.bibliographicLevel%22%29%0Acopy_field%28%22leader%22%2C%22@leader.typeOfControl%22%29%0Acopy_field%28%22leader%22%2C%22@leader.characterCodingScheme%22%29%0Acopy_field%28%22leader%22%2C%22@leader.encodingLevel%22%29%0Acopy_field%28%22leader%22%2C%22@leader.catalogingForm%22%29%0Acopy_field%28%22leader%22%2C%22@leader.multipartLevel%22%29%0A%0Asubstring%28%22@leader.status%22%2C%225%22%2C%221%22%29%0Asubstring%28%22@leader.type%22%2C%226%22%2C%221%22%29%0Asubstring%28%22@leader.bibliographicLevel%22%2C%227%22%2C%221%22%29%0Asubstring%28%22@leader.typeOfControl%22%2C%228%22%2C%221%22%29%0Asubstring%28%22@leader.characterCodingScheme%22%2C%229%22%2C%221%22%29%0Asubstring%28%22@leader.encodingLevel%22%2C%2217%22%2C%221%22%29%0Asubstring%28%22@leader.catalogingForm%22%2C%2218%22%2C%221%22%29%0Asubstring%28%22@leader.multipartLevel%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 could reuse the parts of the encode-marc21 for encode-marcxml

  6. dr0i commented on Apr 18, 2024

    @dr0i
    Member

    The construction of the leader (counting bytes including indicators etc magic) is done through invoking Marc21Decoder.java (which calls the Record.java) . Code can be reused for encode-marc21 - although it's ugly from a performance point of view (the whole record has to be made into tpye Record at the end of the parsing of a record).
    This will be done in my PR treating #454.

  7. assigned and unassigned on Apr 18, 2024
  8. moved this to Working in Metafactureon Apr 18, 2024
  9. TobiasNx commented on Apr 19, 2024

    @TobiasNx
    ContributorAuthor

    Code can be reused for encode-marc21

    @dr0i: Isn't encode-marc21 already doing this? See: #524 (comment)

  10. dr0i commented on Apr 19, 2024

    @dr0i
    Member

    Functional review @TobiasNx and @maipet .
    Deployed to test-Plaground metafacture-framework feature-454-allowMarc21EncoderToGetLeaderAsOneString-SNAPSHOT.

    Note that the generated leader is 02934naa a2200649uc 4500 while the original input was
    <leader>00000naa a2200000uc 4500</leader>. So the leader seems to be correct (record size and also other parts, while the type etc. is preserved...)

  11. moved this from Working to Review in Metafactureon Apr 19, 2024
  12. 6 remaining items

  13. added a commit that references this issue on Apr 22, 2024
  14. moved this from Review to Done in Metafactureon Apr 22, 2024
  15. TobiasNx commented on Apr 24, 2024

    @TobiasNx
    ContributorAuthor

    It seems that this is not solved for encode-marcxml. The leader position at the beginning and in the middle are still 00000

  16. TobiasNx commented on Apr 24, 2024

    @TobiasNx
    ContributorAuthor

    Ahhh I now see what the problem here is, encode-marcxml still lacks the ability to generate the counted leader info. I did not review this properly, sorry.

  17. TobiasNx commented on Apr 25, 2024

    @TobiasNx
    ContributorAuthor

    We decided with @maipet and @dr0i that marcXML does not need to count but either use the provided leader info if the leader is provided as whole (even if the record itself changed) or set the Leader Pos 00-04 and 12-16 to zero if the leader is only provided in separated elements as it is done by decode-marc21.

    For further info see:
    #527 (comment)

  18. assigned and unassigned on Apr 25, 2024
  19. moved this from Done to Review in Metafactureon Jun 19, 2024
  20. moved this from Review to Done in Metafactureon Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions