DSpace 7: Hot to add a language tag to a metadata field.

236 views
Skip to first unread message

Carlos Campo

unread,
Dec 27, 2022, 5:41:22 AM12/27/22
to DSpace Technical Support
Hello everyone,
I'm using DSpace 7.4

My goal is to add a language tag to a metadata field.

According to the DSpace 7.4 manual (pdf version):

Screenshot_01_01.png

Therefore I have written the following code.

    <row>
        <field>
            <dc-schema>dc</dc-schema>
            <dc-element>description</dc-element>
            <dc-qualifier></dc-qualifier>
            <language value-pairsname="common_iso_languages2">true</language>
            <repeatable>false</repeatable>
            <label>Description</label>
            <input-type>textarea</input-type>
            <hint>Enter any other description or comments in this box.</hint>
            <required></required>
        </field>
    </row
>

However, I got the following error: (...field description.null has no language attribute)

2022-12-27 10:10:22,450 ERROR unknown unknown org.springframework.boot.SpringApplication @ Application run failed
java.lang.RuntimeException: Failure during ServletContext initialisation: Error creating bean with name 'patchConfigurationService' defined in URL [jar:file:/var/lib/tomcat9/webapps/server/WEB-INF/lib/dspace-server-webapp-7.4-classes.jar!/spring/spring-dspace-core-services.xml]: Cannot create inner bean 'org.dspace.app.rest.submit.factory.impl.BitstreamMetadataValueMovePatchOperation#1dff5a71' of type [org.dspace.app.rest.submit.factory.impl.BitstreamMetadataValueMovePatchOperation] while setting bean property 'map' with key [TypedStringValue: value [move], target type [null]] with key [TypedStringValue: value [bitstreammetadata], target type [null]]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.dspace.app.rest.submit.factory.impl.BitstreamMetadataValueMovePatchOperation#1dff5a71' defined in URL [jar:file:/var/lib/tomcat9/webapps/server/WEB-INF/lib/dspace-server-webapp-7.4-classes.jar!/spring/spring-dspace-core-services.xml]: Cannot resolve reference to bean 'org.dspace.app.rest.utils.BitstreamMetadataValuePathUtils' while setting bean property 'bitstreamMetadataValuePathUtils'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.dspace.app.rest.utils.BitstreamMetadataValuePathUtils' defined in URL [jar:file:/var/lib/tomcat9/webapps/server/WEB-INF/lib/dspace-server-webapp-7.4-classes.jar!/spring/spring-dspace-core-services.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.dspace.app.rest.utils.BitstreamMetadataValuePathUtils]: Constructor threw exception; nested exception is org.dspace.app.util.DCInputsReaderException: Error creating submission forms: org.xml.sax.SAXException: Form traditionalpagetwo, field description.null has no language attribute


Why am I getting this error?

Thanks.


Mohammad S. AlMutairi

unread,
Dec 27, 2022, 10:19:10 AM12/27/22
to DSpace Technical Support
Hello,

Try this. It should work for you.

                <field>
                    <dc-schema>dc</dc-schema>
                    <dc-element>description</dc-element>
                    <dc-qualifier></dc-qualifier>
                    <language value-pairs-name="common_iso_languages">true</language>
                    <repeatable>false</repeatable>
                    <label>Language</label>
                    <input-type value-pairs-name="common_iso_languages">dropdown</input-type>
                    <hint>Select the language of the main content of the item. If the language does not appear in the
                        list, please select 'Other'. If the content does not really have a language (for example, if it
                        is a dataset or an image) please select 'N/A'.
                    </hint>
                    <required></required>
                </field>

It think it failed with an error ( field description.null has no language attribute ) because there was no value-pairs-name with the name common_iso_languages2. If it has to be a custom value-pairs-name that you need to use then just create it and customize with any language you want and add it to the bottom of submission file somewhere near the other  value-pairs-names and reference it in the above field.


Hope it help you.

Mohammad S. AlMutairi

unread,
Dec 27, 2022, 11:46:17 AM12/27/22
to DSpace Technical Support
On Tuesday, December 27, 2022 at 1:41:22 PM UTC+3 hipot...@gmail.com wrote:
Why am I getting this error?

Thanks.
You got everything right except the missing value-pairs by the name (common_iso_languages2). You can use the built-in common_iso_languages but if you must use the one you picked to customize it just create it in submission file as below:

        <value-pairs value-pairs-name="common_iso_languages2" dc-term="language_iso">
            <pair>
                <displayed-value>N/A</displayed-value>
                <stored-value></stored-value>
            </pair>
            <pair>
                <displayed-value>English (United States)</displayed-value>
                <stored-value>en_US</stored-value>
            </pair>
            <pair>
                <displayed-value>English</displayed-value>
                <stored-value>en</stored-value>
            </pair>
            <pair>
                <displayed-value>Spanish</displayed-value>
                <stored-value>es</stored-value>
            </pair>
            <pair>
                <displayed-value>German</displayed-value>
                <stored-value>de</stored-value>
            </pair>
        </value-pairs>

Carlos Campo

unread,
Dec 29, 2022, 3:56:41 AM12/29/22
to DSpace Technical Support
Hi  " alo...@gmail.com"

There was an error un my code:

I wrote "value-pairsname", instead of "value-pairs-name"

Now it works properly:
Screenshot_01_02.png


Thank you for your help.

Mohammad S. AlMutairi

unread,
Dec 29, 2022, 6:16:56 AM12/29/22
to DSpace Technical Support
Hi,

That would explains it & glad you had it resolved. It's good to know that I'm not alone in making typos everywhere ;-). Check the subject of this thread "Hot to add a language tag to a metadata field." :-).

Cheers

Carlos Campo

unread,
Dec 29, 2022, 8:28:32 AM12/29/22
to DSpace Technical Support
Hi,

You're right.
I hadn't realized.  :-)

Cheers.
Reply all
Reply to author
Forward
0 new messages