use id, not label, for a DSpaceControlledVocabulary

178 views Asked by At

In my DSpace installation, I have a controlled vocabulary. It is similar to the example srsc.xml controlled vocabulary from the original Dspace distribution.

I noticed that for DSpaceControlledVocabulary/ (.xml file-based) controlled vocabularies, DSpace assigns to the metadata key (e.g. dc.subject) the value of the controlled vocabulary entry's label value.

Instead of the label value, I would rather prefer to assign the id value, that is: Instead of dc.subject=Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::Church studies I would rather like to transmit dc.subject=VR110103.

Is this possible to configure?

1

There are 1 answers

0
Tom Desair On

This is not so difficult. In the file vocabulary-support.js you need to change the line link.setAttribute('href', data.value); (https://github.com/DSpace/DSpace/blob/dspace-5_x/dspace-xmlui-mirage2/src/main/webapp/scripts/vocabulary-support.js#L181) to link.setAttribute('href', data.id);

This will insert the id into the metadata field instead of the value.

If you are using a DSpace release version, you have to put the modified file under dspace/modules/xmlui-mirage2/src/main/webapp/themes/Mirage2/scripts/vocabulary-support.js (assuming you are using Mirage 2).