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: [email protected] <[email protected]> on behalf of 
Zhongping Yan <[email protected]>
Sent: Monday, October 4, 2021 10:44 AM
To: DSpace Technical Support <[email protected]>
Subject: [dspace-tech] Local Metadata Definition Syntax

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

--
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 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dspace-tech/3f8ee5e0-da7f-4c35-b78f-2fa22171471an%40googlegroups.com<https://groups.google.com/d/msgid/dspace-tech/3f8ee5e0-da7f-4c35-b78f-2fa22171471an%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dspace-tech/DM5PR2201MB1148252E1564AE8C613C2755EDAE9%40DM5PR2201MB1148.namprd22.prod.outlook.com.

Reply via email to