Skip to content

Double trim with path with asterisk adds subfields that does not exist #715

@TobiasNx

Description

@TobiasNx
"https://www.orca.nrw/moochub"
| open-http
| as-records
| decode-json(recordPath="$.data")
| fix(transformationFile)
| encode-json
| print
;
copy_field("attributes.creator[]","creator[]")
do list(path:"creator[]","var":"$i")
  move_field("$i.url","$i.id")
end

# Weird behaviour adds a non existing subfield
trim("creator[].*.name")
trim("creator[].*.affiliation.name")


uniq("creator[]")
retain("creator[]")
{"creator":[{"name":"Johanna Heitzer","type":"Person","honorificPrefix":"Prof."},{"name":"Fani Lauermann","type":"Person","honorificPrefix":"Prof.","id":"https://orcid.org/0000-0002-2051-1006"}]}
{"creator":[{"name":"Lukas Jötten","type":"Person"},{"name":"Frank Wistuba","type":"Person"}]}
{"creator":[{"name":"Fani Lauermann","type":"Person","honorificPrefix":"Prof.","id":"https://orcid.org/0000-0002-2051-1006"},{"name":"Daria Benden","type":"Person","honorificPrefix":"Dr.","id":"https://orcid.org/0000-0003-4572-3037"}]}
{"creator":[{"name":"OMB+-Konsortium","type":"Organization","1":{"name":"OMB+-Konsortium"}}]}
{"creator":[{"name":"Rolf Biehler","type":"Person","honorificPrefix":"Prof.","id":"https://orcid.org/0000-0002-9815-1282","1":{"name":"Rolf Biehler"}}]}
{"creator":[{"name":"HM4MINT-Konsortium","type":"Organization","1":{"name":"HM4MINT-Konsortium"}}]}
{"creator":[{"name":"Albert Bremerich-Vos","type":"Person","honorificPrefix":"Prof.","id":"https://orcid.org/0000-0002-5131-3256","1":{"name":"Albert Bremerich-Vos"}}]}
{"creator":[{"name":"Albert Bremerich-Vos","type":"Person","honorificPrefix":"Prof.","id":"https://orcid.org/0000-0002-5131-3256"},{"name":"Ulrike Haß","type":"Person","honorificPrefix":"Prof."},{"name":"Cornelia Czapla","type":"Person","honorificPrefix":"Dr."},{"name":"Lena Kreppel","type":"Person"}]}
{"creator":[{"name":"Konsortium unter der Leitung des KIT","type":"Organization","1":{"name":"Konsortium unter der Leitung des KIT"}}]}
{"creator":[{"name":"Ferdinand Stebner","type":"Person","honorificPrefix":"Prof.","id":"https://orcid.org/0000-0001-9187-1722","1":{"name":"Ferdinand Stebner"}}]}

It seems that when only one creator is given, then it adds the "1" subfield.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions