Local Metadata Definition Syntax

173 views
Skip to first unread message

Zhongping Yan

unread,
Oct 4, 2021, 11:44:05 AM10/4/21
to DSpace Technical Support
I registered some custom metadata fields in local-types.xml. Some of them have character underscore  '_' like this:
  <dc-type>
    <schema>local</schema>
    <element>conference_language</element>
    <qualifier>en</qualifier>
    <scope_note></scope_note>
  </dc-type>

I used this element in a custom submission form:
    <row>
        <field>
            <dc-schema>local</dc-schema>
            <dc-element>conference_language</dc-element>
            <dc-qualifier>en</dc-qualifier>
           <label>Conference language</label>
           <input-type>onebox</input-type>
           <hint>Enter the conference language.</hint>
           <required>You must enter the conference language.</required>
       </field>
    </row>

DSpace throwed a exception when saving the form:
2021-10-01 14:49:15,754 ERROR d18575a8-a1c9-4483-bb5d-f535cc6c6215 1c9425dd-cb7a-46fc-ab22-8672735aa3d1 org.dspace.app.rest.submit.SubmissionService @ bad_dublin_core schema=local.conference.language.en.. Metadata field does not exist!
java.sql.SQLException: bad_dublin_core schema=local.conference.language.en.. Metadata field does not exist!
at org.dspace.content.ItemServiceImpl.addMetadata(ItemServiceImpl.java:1418) ~[dspace-api-7.0.jar:7.0]
at org.dspace.content.ItemServiceImpl.addMetadata(ItemServiceImpl.java:71) ~[dspace-api-7.0.jar:7.0]
at org.dspace.app.rest.submit.factory.impl.ItemMetadataValueAddPatchOperation.replaceValue(ItemMetadataValueAddPatchOperation.java:183) ~[classes/:7.0]
at org.dspace.app.rest.submit.factory.impl.ItemMetadataValueAddPatchOperation.add(ItemMetadataValueAddPatchOperation.java:100) ~[classes/:7.0]
at org.dspace.app.rest.submit.factory.impl.AddPatchOperation.perform(AddPatchOperation.java:27) ~[classes/:7.0]
at org.dspace.app.rest.submit.step.DescribeStep.doPatchProcessing(DescribeStep.java:138) ~[classes/:7.0]
at org.dspace.app.rest.submit.SubmissionService.evaluatePatchToInprogressSubmission(SubmissionService.java:446) [classes/:7.0]
at org.dspace.app.rest.repository.WorkspaceItemRestRepository.patch(WorkspaceItemRestRepository.java:212) [classes/:7.0]
at org.dspace.app.rest.repository.WorkspaceItemRestRepository.patch(WorkspaceItemRestRepository.java:75) [classes/:7.0]
at org.dspace.app.rest.repository.WorkspaceItemRestRepository$$FastClassBySpringCGLIB$$987ae76d.invoke(<generated>) [classes/:7.0]

DSpace converted the character underscore in <dc-element> to character period.

Does DSpace restrict special characters in definition of customized metadata elements in local-types.xml?

Please suggest the specifications for defining customized metadata elements.

Thanks

Zhongping

Tim Donohue

unread,
Oct 4, 2021, 5:58:02 PM10/4/21
to Zhongping Yan, DSpace Technical Support
Hi Zhongping,

I'd recommend just avoiding "." and "_" in metadata field names.  Obviously "." is not allowed as that's the usual field separator.  But, "_" is sometimes used as a secondary separator, especially when using Authority control or similar (which DSpace 7 uses a little more than v6).

Beyond those two, other characters should be safe.  I just queried the codebase quickly and I don't immediately see any other characters used as separators.

All that said, the safest of all options would be to not use any special characters in metadata field names.  So, you could also consider using something like "local.conference.language" & have different values with different "language" settings, as each metadata value​ does support a language setting.

Tim

From: dspac...@googlegroups.com <dspac...@googlegroups.com> on behalf of Zhongping Yan <zhongpi...@gmail.com>
Sent: Monday, October 4, 2021 10:44 AM
To: DSpace Technical Support <dspac...@googlegroups.com>
Subject: [dspace-tech] Local Metadata Definition Syntax
 
--
All messages to this mailing list should adhere to the Code of Conduct: https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx
---
You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dspace-tech...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-tech/3f8ee5e0-da7f-4c35-b78f-2fa22171471an%40googlegroups.com.

Zhongping Yan

unread,
Oct 4, 2021, 7:26:18 PM10/4/21
to DSpace Technical Support
Thank you, Tim, for your recommendation.

Zhongping
Reply all
Reply to author
Forward
0 new messages