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

Controlled Vocabulary Fields Show Explicit Splitter-Separated Hierarchy and Does Not Automatically Assign Terms #3314

Open
aseyedia opened this issue Sep 9, 2024 · 2 comments
Labels
bug needs triage New issue needs triage and/or scheduling

Comments

@aseyedia
Copy link
Contributor

aseyedia commented Sep 9, 2024

Describe the bug

Apologies for the gory title, I just couldn't think of a better way to explain the issue I'm having.

image

We have uploaded (multiple) controlled vocabularies for our DSpace instance, but this issue is preserved across the different fields.

  1. The first issue is that when we go into the submission form and select an entry from the controlled vocabulary for a field (in this case, it's dc.subject, the result on the simple item view is a discovery.xml splitter-separated hierarchy for the term, the last term being the term of interest. We would like for the last term to be the only one to appear on the page. However, we do want the full, splitter-separated path of that term to be browseable when clicked on (currently set to valueList).

image
image

  1. The second issue is that when we bulk upload these items, we do so only with the final term of the term hierarchy/path attached. So in this example, "Clinical Follow-Up" is in dc.subject and shows up as linked in the onebox Submission Form. However, when we click on the item, it doesn't expand into its full path; it only browses-by the final term. I suspect this is because these entries simply don't contain the full item path, but is there a way to have them automatically link?

These items are being generated by ds-generic-item-page-field:

      <ds-generic-item-page-field [item]="object" [fields]="['dc.subject']" [separator]="', '"
        [label]="'item.preview.dc.subject'"></ds-generic-item-page-field>

And are being made browseable in local.cfg like so:

webui.browse.index.5 = tag:metadata:dc.subject:valueList
webui.browse.link.6 = tag:dc.subject

To Reproduce

  1. Upload/select/enable a controlled vocabulary
  2. Chose a non-top-level vocabulary term for that item
  3. Configure local.cfg like above
  4. Access them on the Simple Item page

Expected behavior

  1. I want the Controlled Vocab terms to be automatically assigned to their place in the Controlled Vocab hierarchy in the items
  2. I want to preserve the "browse link" behavior.

Related work

Link to any related tickets or PRs here.

@aseyedia aseyedia added bug needs triage New issue needs triage and/or scheduling labels Sep 9, 2024
@aseyedia aseyedia changed the title Subject Hierarchy Shows Explicit Splitter-Separated Subject Hierarchy and Is Not Facetable For Some Entries Controlled Vocabulary Fields Show Explicit Splitter-Separated Hierarchy and Does Not Automatically Assign Terms Sep 9, 2024
@aseyedia
Copy link
Contributor Author

Not sure if this is the sort of solution you are looking for, but I modified the metadata-values.component.ts file to include a function that split by :: separator:

    getLastItem(value: string): string {
    const parts = value.split('::');
    return parts[parts.length - 1];
  }

and in metadata-values.component.html, I simply called the function:

<!-- Render value as a link to browse index -->
<ng-template #browselink let-value="value">
<a class="dont-break-out preserve-line-breaks ds-browse-link"
[routerLink]="['/browse', browseDefinition.id]"
[queryParams]="getQueryParams(value)">{{value}}</a>
</ng-template>

<!-- Render value as a link to browse index -->
<ng-template #browselink let-value="value">
  <a class="dont-break-out preserve-line-breaks ds-browse-link"
     [routerLink]="['/browse', browseDefinition.id]"
     [queryParams]="getQueryParams(value)">{{ getLastItem(value) }}</a>
</ng-template>

So. I guess this is a feature, and I implemented an ugly workaround.

@aseyedia
Copy link
Contributor Author

I generated a quick Python script that will traverse a given XML, assemble the path for each term, and then update the corresponding term in metadatavalue.

https://gist.github.com/aseyedia/bc8754f0144a949618eb6cdf11aaae84

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs triage New issue needs triage and/or scheduling
Projects
Status: 🆕 Triage
Development

No branches or pull requests

1 participant