LibreCat / Catmandu-MARC

Catmandu modules for working with MARC data
https://metacpan.org/release/Catmandu-MARC
Other
8 stars 10 forks source link

Catmandu::Fix::marc_map $append and split #31

Closed cKlee closed 8 years ago

cKlee commented 8 years ago

From the documentation (cheat sheet) it's not really clear what is the difference between $append and split and what happens if one combines both. Maybe an example with repeated fields can help:

marc_map('084', 'my.classification.$append')
# my:
#   classification:
#    - 54.53Programmiersprachenbcl
#    - 54.65Webentwicklungbcl
#    - ST 250rvk

marc_map('084', 'my.classification', split:1)
# my:
# classification:
#  - - '54.53'
#    - Programmiersprachen
#    - bcl
#  - - '54.65'
#    - Webentwicklung
#    - bcl
#  - - ST 250
#    - rvk

marc_map('084', 'my.classification.$append', split:1)
# my:
#   classification:
#   - - - '54.53'
#       - Programmiersprachen
#       - bcl
#   - - - '54.65'
#       - Webentwicklung
#       - bcl
#   - - - ST 250
#       - rvk
phochste commented 8 years ago

Well.. is between a bug and a feature. And I don't think I want to support these kinds of array of array of arrays anymore. This has to be been proven quite unhandy in processing MARC.

E.g. isbn numbers 020 can be in a repeated field with repeated subfields. I would like to get a simple array of all ISBNs with:

 marc_map(020a,my,split:1)

In the current version you get:

 my:
    - - isbn 1.1
      - isbn 1.2
    - isbn 2.1

My preference is to get:

 my:
    - isbn 1.1
    - isbn 1.2
    - isbn 2.1
cKlee commented 8 years ago

With version 0.217 Catmandu::Fix::marc_map gets me now

my:
  - isbn 1.1
  - isbn 1.2
  - isbn 2.1

But Catmandu::Fix::Inline::marc_map still gets me something like

my:
  - - isbn 1.1
    - isbn 1.2
  - isbn 2.1