kitodo / kitodo-production

Kitodo.Production is a workflow management tool for mass digitization and is part of the Kitodo Digital Library Suite.
http://www.kitodo.org/software/kitodoproduction/
GNU General Public License v3.0
62 stars 64 forks source link

Metadata editor is loosing images #5880

Open matthias-ronge opened 7 months ago

matthias-ronge commented 7 months ago

To Reproduce

  1. Do some structuring …

Screenshot 2024-01-15 134049

  1. Click ‘save & close’,
  2. then re-open the metadata editor.

Screenshot 2024-01-15 134159

<mets:structLink>
    <mets:smLink xlink:to="uuid-381771ec-93a6-42a7-8a7b-73e6f62a7a92" xlink:from="uuid-35445edf-a40f-4076-9efc-492a4a7719d8"/>
    <mets:smLink xlink:to="uuid-a4cdb667-40c1-4057-b167-574b4ac04e9b" xlink:from="uuid-35445edf-a40f-4076-9efc-492a4a7719d8"/>
    <mets:smLink xlink:to="uuid-88cab91a-e57c-49eb-8933-41470030030f" xlink:from="uuid-35445edf-a40f-4076-9efc-492a4a7719d8"/>
    <mets:smLink xlink:from="uuid-c62eb5e8-e143-4649-ba30-5b393172002e"/>
    <mets:smLink xlink:to="uuid-ada36bc0-c6b4-4522-a32d-74946cd6ab19" xlink:from="uuid-c62eb5e8-e143-4649-ba30-5b393172002e"/>
    <mets:smLink xlink:from="uuid-c62eb5e8-e143-4649-ba30-5b393172002e"/>
    <mets:smLink xlink:from="uuid-c62eb5e8-e143-4649-ba30-5b393172002e"/>
    <mets:smLink xlink:from="uuid-f39cdc97-0789-4a66-b56b-8ab4fcc8838a"/>
    <mets:smLink xlink:to="uuid-dbbc8a2a-3521-4693-9007-7dd0c7e4eb82" xlink:from="uuid-f39cdc97-0789-4a66-b56b-8ab4fcc8838a"/>
    <mets:smLink xlink:from="uuid-f39cdc97-0789-4a66-b56b-8ab4fcc8838a"/>
    <mets:smLink xlink:from="uuid-970b6f11-543b-4c0c-8c19-2f6b5c8ea7ae"/>
</mets:structLink>

Expected behavior All <mets:smLink> entries must have an xlink:to attribute. Images must not disappear from the metadata editor.

Release: 3.6.0 Server: Ubuntu 20.04.6, Tomcat 9, OpenJDK 11.0.21 Desktop: Windows 10, Firefox 121.0.1

matthias-ronge commented 7 months ago

The error is caused in class DivXmlElementAccess, line 252: The expression .map(physicalDivisionIDs::get) doesn’t work as expected and returns null, even though the physical division is contained in the map Map<PhysicalDivision, String> physicalDivisionIDs. Seems to be some sort of look-up problem …

matthias-ronge commented 7 months ago

The problem occurs because our ruleset uses <key id="LABEL" domain="mets:div">, <setting key="LABEL" alwaysShowing="true"/>. This causes the label field of the physical division to show in the metadata editor, when you click on a thumbnail. That sets the LABEL attribute from null to "", making it impossible to look up its permanent UUID on save, because the LABEL is included in the comparison.

matthias-ronge commented 7 months ago

The behaviour can be fixed by preventing the LABEL to be entered on the page division in the ruleset, like:

<correlation>
    <restriction division="page" unspecified="forbidden"/>
</correlation>