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

Add new functional metadata structureTreeTitle for labels in metadata editor structure tree #5882

Open
solth opened this issue Jan 16, 2024 Discussed in #4925 · 10 comments · May be fixed by #6264
Open

Add new functional metadata structureTreeTitle for labels in metadata editor structure tree #5882

solth opened this issue Jan 16, 2024 Discussed in #4925 · 10 comments · May be fixed by #6264

Comments

@solth
Copy link
Member

solth commented Jan 16, 2024

Discussed in #4925

Originally posted by solth December 27, 2021
#4757 added a switch that allows the user to change the label of the tree nodes in the structure tree from type to specific metadata values configured as metsEditor.titleMetadata in the central config file kitodo_config.properties.

However, the menu currently displays the id of metadata defined in the ruleset (or rather just the values separated by comma after metsEditor.titleMetadata from the config file), which is not optimal, since normally the label of a metadata is used in the Kitodo metadata editor UI and the user is probably not familiar with the internal IDs of the metadata as defined in the ruleset.
Bildschirmfoto 2021-12-27 um 10 02 54
...

A new functional metadata structureTreeTitle should be added which replaces the old kitodo_config.properties property key metsEditor.titleMetadata.

Currently, only one of the metadata keys defined in metsEditor.titleMetadata can be applied at a time. So if a book and its chapters each have individual titles (like "main title" and "chapter title") these titles cannot be displayed at the same time. (an awkward work-around would be to assign the same title metadata to the top level element as well as the structure element, but this is probably not correct content wise, since a chapter should contain a "chapter title" instead of a "main title")

The new menu in the structure tree should then not contain the names of individual metadata keys anymore, but rather just general options like:

  • Type
  • Title
  • Type - Title

When selecting the second (Title) or third option (Type - Title), all functional metadata of type structureTreeTitle will be retrieved from all elements in the structure tree (except pages/media) so that different metadata with the same use can be displayed at the same time. If one structure element contains multiple functional metadata of type structureTreeTitle, the first is applied.

Optionally, the count of structure elements can be offered as an additional option (thanks to @matthias-ronge for this suggestions):

  • Type - Count
  • Count
@solth solth added feature development fund 2024 A candidate for the Kitodo e.V. development fund. labels Jan 16, 2024
@solth solth removed the development fund 2024 A candidate for the Kitodo e.V. development fund. label Feb 22, 2024
@thomaslow
Copy link
Collaborator

thomaslow commented Oct 10, 2024

Optionally, the count of structure elements can be offered as an additional option (thanks to @matthias-ronge for this suggestions):

* `Type - Count`

* `Count`

May I ask, what exactly do you mean by count? The number of ancestor children / descendant nodes in the tree? Does this include both folders and pages, or pages only? How does this relate to the setting Show assigned pages which already adds similar information to each folder (listing both first and last page), see below:

Screenshot from 2024-10-10 18-09-47

@thomaslow
Copy link
Collaborator

If one structure element contains multiple functional metadata of type structureTreeTitle, the first is applied.

My concern is, that this implicit priority is going to become a problem in some special scenarios. For example, let's assume there is a TitleDocMain metadata key, which is the de-facto default for all available divisions (maybe for legacy reasons). And then, there are division-specific metadata keys aaaTitle and zzzTitle. The ruleset may look like this:

<ruleset xmlns="http://names.kitodo.org/ruleset/v2" lang="en">
    <declaration>
        <key id="aaaTtitle" use="structureTreeTitle">
            <label>aaa title</label>
            <label lang="de">aaa Titel</label>
        </key>
        ...
        <key id="TitleDocMain" use="structureTreeTitle">
            <label>main title</label>
            <label lang="de">Haupttitel</label>
        </key>
        ...
        <key id="zzzTitle" use="structureTreeTitle">
            <label>zzz title</label>
            <label lang="de">ZZZ Titel</label>
        </key>
    </declaration>
</ruleset>

Because of the implicit priority based on the declaration order, if a structure node has a aaaTitle it is preferred over the default TitleDocMain (if both metadata values are available, of course). However, if a structure node has a zzzTitlte it is not preferred over the default TitleDocMain. This might be confusing to users who have no idea that this implicit priority exists?

Maybe it is not a problem after all. What do you think?

@solth
Copy link
Member Author

solth commented Oct 10, 2024

May I ask, what exactly do you mean by count?

That is a good question. To be honest, I only considered the variation Type - Count which would make sense for long lists of identical structures if Count was interpreted as Counter:

Monograph
- Chapter - 1
- Chapter - 2
- Chapter - 3
...

Just count without the structure element type might be kind of pointless. Perhaps @matthias-ronge could weigh in on this since the idea originally came from him?

@henning-gerhardt
Copy link
Collaborator

A few comments:

  • the ruleset.xsd file must be extended for this new attribute value (already mentioned in the pull request). Maybe the discussions Ruleset validator #6168 and Umgang ruleset.xsd #6008 should be more discussed and maybe somehow implemented so only a change on the ruleset.xsd is needed to add new valid values or other changes.
  • on release it is necessary to inform the users that this value is moved from the global configuration file kitodo_config.properties to every used ruleset file.
  • the existing rule set files in the repository should be extended to use the new attribute on the right places so users have some examples how to use

@solth
Copy link
Member Author

solth commented Oct 11, 2024

My concern is, that this implicit priority is going to become a problem in some special scenarios. For example, let's assume there is a TitleDocMain metadata key, which is the de-facto default for all available divisions (maybe for legacy reasons). And then, there are division-specific metadata keys aaaTitle and zzzTitle. The ruleset may look like this:

<ruleset xmlns="http://names.kitodo.org/ruleset/v2" lang="en">
    <declaration>
        <key id="aaaTtitle" use="structureTreeTitle">
            <label>aaa title</label>
            <label lang="de">aaa Titel</label>
        </key>
        ...
        <key id="TitleDocMain" use="structureTreeTitle">
            <label>main title</label>
            <label lang="de">Haupttitel</label>
        </key>
        ...
        <key id="zzzTitle" use="structureTreeTitle">
            <label>zzz title</label>
            <label lang="de">ZZZ Titel</label>
        </key>
    </declaration>
</ruleset>

Because of the implicit priority based on the declaration order, if a structure node has a aaaTitle it is preferred over the default TitleDocMain (if both metadata values are available, of course). However, if a structure node has a zzzTitlte it is not preferred over the default TitleDocMain. This might be confusing to users who have no idea that this implicit priority exists?

Maybe it is not a problem after all. What do you think?

I think this is less an issue of this specific use case and more a general problem concerning how rulesets are validated at the moment. Ideally it shouldn't be possible to define more than one functional metadata of each type for each defined division. Functional metadata like recordIdentifier or higherLevelIdentifier can be especially critical if configured multiple times for one division.

As far as I know that is the reason why RulesetManagementInterface only contains a method definition getFunctionalKeys(FunctionalMetadata functionalMetadata) (plural!) and no corresponding getFunctionalKey(FunctionalMetadata functionalMetadata) (singular), even though the later would be preferable.

Because of that there are already several other places in the code like the one you described above, where a collection of functional metadata is retrieved, but only one (random) element of that collection is actually used.

I am afraid until we find a way to impose restrictions like unique functional metadata of specific types for individual structure in rulesets the administrator or author of that ruleset will be responsible for configuring it correclty.

@BartChris
Copy link
Collaborator

BartChris commented Oct 11, 2024

What does not work in the current config-file based approach is to define the LABEL of the division as to be displayable as the text of the structure tree node. One can enter LABEL as value in the configuration, but it does not work (when selecting LABEL, nothing is displayed, although there is a LABEL)

So my preferred solution would be, that when selecting one of

  • Title
  • Type - Title

to first display the content of the LABEL as Title, and only if this is not set, rely on the configured key (structureTreeTitle) in the ruleset. This would also align the display during the workflow more closely with presentation systems like DFG viewer, which present the division's LABEL in the document's outline.

Institutions right now use the export XSLT to derive the LABEL e.g. from the TitleDocMain during export. (see: #5016 (comment)) because the LABELS are very important for presentation. Applying a similar Logic inside of Kitodo by: a) constructing the display label from another metadatum or b) if it is already present taking it directly from the divsion's LABEL would bring the editor behaviour a little bit inline with the desired structure for the presentation.

@kitodo/kitodo-community-board Do you agree?

@BartChris
Copy link
Collaborator

BartChris commented Oct 11, 2024

We probably also have to specify if the desired change also has an effect on the display of parent processes in the editor. The linked children have a "display label", which is constructed slightly different than the one of "normal" processes' divisions:

#4925 (reply in thread)

I just optimized the display of linked child processes. Their displayed "name" always contains the type of the linked division:
#6185

I would really like to explore whether we can display more information (e.g., the volume number for 200 linked volumes) on linked child processes. However, implementing this might be more complex than it is for non-parent processes.

@thomaslow
Copy link
Collaborator

@BartChris By LABEL you mean the METS xml attribute of a division, right? Is this something that can be specified using the metadata editor at the moment?

@BartChris
Copy link
Collaborator

BartChris commented Oct 11, 2024

@thomaslow Yes, i mean the METS xml attribute of the division. And yes, you can list LABEL as a allowed key in any division:

<permit key="LABEL" minOccurs="1" maxOccurs="1"/>

In the key declaration we assign it a domain of mets:div which declares this metadatum as one which appears in the LOGICAL structure of the METS file and not in the DMDSec.

<key id="LABEL" domain="mets:div" use="displaySummary">
  <label>Label</label>
  <label lang="de">Label</label>
</key>

In the metadata editor you can work with LABEL as if it is a "normal" metadatum, but it actually gets stored in the LOGICAL structure of your METS file.

The story of LABEL (and also ORDERLABEL), is unfortunately a quite complicated if you search the repo, but especially the LABEL is important for every presentation system (METS or IIIF based). So it would be good if we can increase the usability of Kitodo at that point.

@thomaslow
Copy link
Collaborator

What does not work in the current config-file based approach is to define the LABEL of the division as to be displayable as the text of the structure tree node. One can enter LABEL as value in the configuration, but it does not work (when selecting LABEL, nothing is displayed, although there is a LABEL)

I tested this. Yes, defining LABEL as structureTreeTitle (or previously in the config file) still does not have any effect, because the LABEL is not included in the metadata object. However, a few years ago the LABEL was loaded as a fallback in case no other metadata title is available. Unfortunately, a minor mistake in the code prevents the LABEL from being displayed as a fallback right now:


getTitleValue returns - if no metadata title is available which disables the fallback detection in
title = DataEditorService.getTitleValue(logicalDivision, structurePanel.getTitleMetadata());
if (StringUtils.isBlank(title)) {
title = logicalDivision.getLabel();
if (StringUtils.isBlank(title)) {
title = " - ";
}
}

I fixed this in my pull request. The LABEL is now again shown as a fallback title. I updated the demo video in #6264.

We probably also have to specify if the desired change also has an effect on the display of parent processes in the editor. The linked children have a "display label", which is constructed slightly different than the one of "normal" processes' divisions

I did not change the way the label is generated for linked processes. Their label remains the same regardless of the current setting. I guess there would need to be a separate config option that defines how those labels are built, especially if additional information beyond the type and title are interesting.

@solth solth added this to the Kitodo.Production 3.8.0 milestone Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants