JSON schema structure for metadata

Yoda uses React for its configurable metadata forms. The content of the form is defined in a metadata schema, which can be configured on an environment, community or group level.

$id

Each JSON schema starts with the id of the schema. This is used as a means to uniquely identify the schema.

"$id": "https://leiden-yoda.irods.surfsara.nl/schemas/default-0/metadata.json",

Definitions - General

JSON schema supports various field types. The rest of this section shows some examples.

Strings

Yoda string type definitions:

"stringNormal": { "type": "string", "maxLength": 255 }, "stringLong": { "type": "string", "maxLength": 2700 },

These definitions can be used for fields in the metadata form:

"properties": { "Title": { "$ref": "#/definitions/stringNormal", "title": "Title" }, "Description": { "$ref": "#/definitions/stringLong", "title": "Description" },

Thus, describing a ‘Title’ element of data type stringNormal. And ‘Description’ of data type stringLong.

Enumerations

Example:

Form element ‘Licence’ is described using optionsLicense:

Default values for elements

REACT form allows default values to be set.

The default value is ‘’ - an empty string (which is not part of the selection list optionsDiscipline)

Multiplicity - type=’array’

Giving a user the possibility to add specific data multiple times is achieved by using the type ‘array’. This is an indication that the element involved can be added multiple times.

The above example will show a Selection field holding all present options for disciplines.

Complex structures - type=’object’

In order to be able to serve the need to create structures of data, the type ‘object’ is used. The object in fact constructs a structure that contains one or more other elements. The properties attribute contains the elements that constitute this structure.

The above example shows a structure of data with title ‘Collection process’. It will show two elements, ‘Start date’ and ‘End date’. The data itself is singular. I.e. only one start date and one end date can be added by the user.

Dependencies between elements

Dependencies can be added between data. I.e. if data is present in one element, the other element becomes mandatory as well.

In the example above, Start_Date and End_Date are dependent fields. I.e. if either one is holding data, the other field must hold data as well.

Specific Yoda attributes

Yoda:structure attributes

  • compound: A combination of form elements that can be regarded as one element.

  • Sub properties: A sub property structure consists of one main item and a properties section. This section can be an elaborate structure of form elements in itself.

The “yoda:required” attribute specifies whether an element is mandatory.

Example of complex structure

The following example shows a complex data structure for a Contributor entity.

Contributor data structure

Main structure is a sub property structure. It consists of Name as lead property and the entire structure below as its sub property.

The entire Contributor structure can be duplicated. I.e. copied including the entire sub property structure.

Sub property structure consists of 2 elements (Contributor type and Affiliation) and 1 compound element Person identifier (holding 2 compound elements).

Affiliation and Person Identifier can be added multiple times.

When a Person identifier type is added, a corresponding identifier is required as well. This is arranged by setting dependencies between the two fields.

JSON representation is as follows: