Skip to content
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

Fix order of logical and physical divisions #5694

Merged
merged 1 commit into from
Jul 18, 2023

Conversation

oliver-stoehr
Copy link
Collaborator

Fixes two bugs:

  • When assigning a physical division to two (or more) logical divisions the order value did not consider the multiple assignments.
  • When assigning a physical division to two (or more) logical divisions and adding another logical division with assigned physical divisions behind the multiple assignments the last element could be sorted in the wrong place between the multiple assignments.

Resolves #5464.

@solth solth requested a review from BartChris June 13, 2023 08:41
@solth solth added the bug label Jul 8, 2023
@solth
Copy link
Member

solth commented Jul 10, 2023

@BartChris would you mind reviewing this pull request since you already analysed the linked issue and thus are familiar with it?

@BartChris
Copy link
Collaborator

Yes, i will check it!

@BartChris
Copy link
Collaborator

BartChris commented Jul 11, 2023

@oliver-stoehr the bugged behaviour seems to be fixed, good work. I have some questions:

  • it is still not possible to assign one page to multiple logical divisions or am i missing something? The comment "When assigning a physical division to two (or more) ..." seems to imply that this is already possible.
  • if the two consecutive structural elements only contain one linked page, they both get the same order number

grafik
grafik

So in this example both chapters get order number 3. I am not sure if that could lead to problems in the long run? Is the order
used in a place where that can lead to problems (export etc.)? Maybe you can also clarify the comment:
"PhysicalDivisions assigned to multiple LogicalDivisions may lead to wrong order value. The order will be incremented for each occurrence and not just the last one"

I would have thought after reading that comment that two different structures which both contain the same linked page would have different order numbers.

@oliver-stoehr
Copy link
Collaborator Author

It is possible to assign one page to any number of logical divisions under the following conditions:

  • The physical division is the last child of the first logical division involved.
  • All following "middle" logical divisions must not contain any (other) physical divisions.
  • The last involved logical division may have any number of physical divisions assigned.
  • All logical divisions involved must be consecutive children of the same element.

Simply assign the page via context menu to the second logical division and the select the new, second entry of the page and assign it – again – to the next logical division.
Bildschirmfoto 2023-07-17 um 17 50 01

Regarding your second question:
Logical divisions may have the the same order value by design. The METS-standard does not use the order-attribute on logical divisions. I added the order-attribute here to be able to bring physical and logical divisions into one defined order. But this is just kitodo-internal and should not be exported.
The order-value of logical division is based on the existing order-values of the physical divisions and only defines the position of the logical divisions in relation to the physical divisions. It does not define any order between the logical divisions itself.
One important rule to understand the order-values of logical divisions is: A logical division with the same order-value is inserted before the physical division in the structure tree.
See this example (order-value in parentheses):

  • logical div (1)
    • page (1)
    • logical div (2)
    • logical div (2)
    • logical div (2)
    • page (2)
    • logical div (3)
      • page (3)
      • page (4)

(Just a technical example, having empty logical divisions might be not useful in terms of content.)

@BartChris
Copy link
Collaborator

BartChris commented Jul 18, 2023

Thanks a lot for the detailed explanation. Assigning a page to multiple divisions is indeed possible. I can even combine it with the method described in another issue: moving an already created link element to sub levels and thereby circumventing the described restrictions.
#5457 (comment)
Using this method the following structures are produced.

image

    <mets:structMap TYPE="LOGICAL">
        <mets:div ID="uuid-dc07c70e-d4f2-4f8b-ad37-ff813f527644" DMDID="uuid-3be7123f-0d5b-3783-856d-fc4f03637ce6" ADMID="uuid-7170eb92-a27b-32ef-9af4-dfd846acbe56" TYPE="monograph" ORDER="4">
            <mets:div ID="uuid-76355e4b-780e-4734-9107-19e78cf14435" TYPE="chapter" ORDER="1"/>
            <mets:div ID="uuid-c04faf6e-daaa-4dbc-8a52-0fb7630ce317" TYPE="chapter" ORDER="3">
                <mets:div ID="uuid-0d05fd8e-664b-4fc6-9c08-d9a3c6eaafde" TYPE="section" ORDER="2"/>
            </mets:div>
            <mets:div ID="uuid-96bf5737-dfef-45de-87dd-9fba2ac419e0" TYPE="chapter" ORDER="3">
                <mets:div ID="uuid-4a2ae84e-0623-4b40-b302-1ee3b2ce238e" TYPE="section" ORDER="2"/>
            </mets:div>
        </mets:div>
    </mets:structMap>

Although this looks a little bit strange in the gallery, the sorting behavior seems correct. I still have to inspect whether moving a linked element around after the link has been created leads to very subtle bugs, but this is may be a different topic. I approve the Pull request,

@solth solth merged commit 56587ea into kitodo:master Jul 18, 2023
@oliver-stoehr oliver-stoehr deleted the fix-order branch August 7, 2024 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Metadataeditor: Connecting a page to more than 2 structure elements in the gallery
3 participants