Skip to content

Problem with reimport into metadata groups with empty fields #6473

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
BartChris opened this issue Mar 24, 2025 · 3 comments · May be fixed by #6495
Open

Problem with reimport into metadata groups with empty fields #6473

BartChris opened this issue Mar 24, 2025 · 3 comments · May be fixed by #6495
Labels
bug import Import mappings and configurations metadata editor

Comments

@BartChris
Copy link
Collaborator

BartChris commented Mar 24, 2025

Describe the bug
As outlined in
#6436 (comment) :

The reimport of metadata does currently not work correctly if metadata groups in the editor contain empty fields. In that case the same group from the catalogue is duplicated.

To Reproduce
Steps to reproduce the behavior:

  1. Have metadata groups with empty fields (e.g. a person's role) in the metadata of the current document
  2. Reimport the metadata from the catalogue
  3. Metadata Groups with empty fields are duplicated

Expected behavior

The reimport should also work for metadata groups with empty fields.

Possible fix
see: #6436 (comment)

Release
Kitodo 3.8.x, master

@BartChris BartChris added bug metadata editor import Import mappings and configurations labels Mar 24, 2025
@BartChris BartChris added this to the Kitodo.Production 3.8.2 milestone Mar 24, 2025
@solth solth removed this from the Kitodo.Production 3.8.2 milestone Apr 3, 2025
@solth
Copy link
Member

solth commented Apr 3, 2025

@BartChris unless you have a fix for this problem available, I do not think it's feasible to include its solution in 3.8.2, which I do not want to postpone anymore than necessary and which is already long overdue. But since I don't see a final version of 3.9.x being released anytime soon, I think there is a real possibility of a release 3.8.3 happening, which should then include the fix for this problem.

@BartChris BartChris linked a pull request Apr 3, 2025 that will close this issue
@BartChris
Copy link
Collaborator Author

BartChris commented Apr 3, 2025

@solth As far as i can see the fix is to skip empty metadata fields which result in the comparison of the HashSets failing. (A empty field is hashed different than a non-existent field).

PR: #6495

Was there a specific reason why you included the empty fields when constructing the update dialog and do you see any problem with skipping the empty fields?

@solth
Copy link
Member

solth commented Apr 7, 2025

@BartChris IIRC I included empty fields in order to maintain a comparable field table in the comparison view, so that it becomes more obvious which fields are empty at one side (for example in the local record) vs filled with a value remotely (in the OPAC record). For that reason the fields in a group would also normally be sorted by metadata key, so that corresponding fields are lined up:

.sorted(Comparator.comparing(Metadata::getKey)).collect(Collectors.toList())) {

Why the fields of the metadata groups in the screenshots you provided seem to be sorted differently I cannot say, that confuses me a little bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug import Import mappings and configurations metadata editor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants