Metadata value validation

54 views
Skip to first unread message

Stephen Brush

unread,
Feb 23, 2022, 4:57:34 PM2/23/22
to DSpace Developers
Just wondering if there is an appropriate injection point to add validation to supplied metadata values (e.g. via an API). I don't believe I've seen examples of this to date.

Additionally,  is there a similar point to validate an item prior to "deposit" -- not against any particular metadata value on it's own but against other metadata values.

Just looking to here what is best practice or what others have done.

Thanks,

Steve

Mark H. Wood

unread,
Feb 24, 2022, 9:04:02 AM2/24/22
to dspace...@googlegroups.com
On Wed, Feb 23, 2022 at 01:20:15PM -0800, Stephen Brush wrote:
> Just wondering if there is an appropriate injection point to add
> validation to supplied metadata values (e.g. via an API). I don't believe
> I've seen examples of this to date.
>
> Additionally, is there a similar point to validate an item prior to
> "deposit" -- not against any particular metadata value on it's own but
> against other metadata values.

Some clarification would help. Do you mean to validate:

1) as data are entered in the UI?
2) when the Submit button is pressed?
3) during workflow?
4) (for completeness) after the Item is installed in the repository?

Case (1) is going to require some customization of the UI, and for
that we need to know what version of DSpace and, up through v6, which
UI.

For case (2) you should look at the code in
dspace-api/src/main/java/org/dspace/content for a starting point. I
would look first at InProgressSubmission and explore from there. You
may find the WorkspaceItem* classes worth inspection too.

Curation tasks can handle cases (3) and (4).

If the Collection has a workflow attached, you can add a curation task
to any workflow step. Or you could run the same task scheduled or
ad-hoc at any time.

--
Mark H. Wood
Lead Technology Analyst

University Library
Indiana University - Purdue University Indianapolis
755 W. Michigan Street
Indianapolis, IN 46202
317-274-0749
www.ulib.iupui.edu
signature.asc

Stephen Brush

unread,
Feb 25, 2022, 11:37:30 AM2/25/22
to DSpace Developers
Thanks Mark -- I think the primary use case would be setting fields via the REST API (Patch HTTP request) and to provide some immediate feedback that a value or set of values does not meet the expected the format or imposed rule. Perhaps that equates to #2 above. It seems the right place is in "package org.dspace.app.rest.submit.step.validation" and I see the <regex> is available for field formatting in the "submission-forms.xml" file. For more complex validation I could customize "MetadataValidation" existing or add my own validation class I assume.

General question on adding custom code -- it seems the recommended approach is to use "modules/additions". I don't seem to be able to add my own Validation class easily there though due to dependencies on some classes from the "dspace-server-webapp" project. I can add the new class directly to that project of course, just curious if there was another method/trick to use in this case.

Steve
Reply all
Reply to author
Forward
0 new messages