Metadata setting structure

The following code snippet shows an example of the MetadataConfiguration setting.

RequestResponse
{
 "from": {
  "extension": "extension",
  "filesize": {
   "file": "metadata",
   "path": ["$['File:FileSize']"]
  },
  "filename": {
   "file": "metadata",
   "path": ["$['File:FileName']"]
  },
  "width": {
   "file": "metadata",
   "path": [
    "$['Composite:ImageWidth']",
    "$['File:ImageWidth']",
    "$['EXIF:ImageWidth']",
    "$['QuickTime:ImageWidth']",
    "$['MPEG:ImageWidth']",
    "$['PNG:ImageWidth']",
    "$['GIF:ImageWidth']",
    "$['Photoshop:ImageWidth']",
    "$['RIFF:ImageWidth']",
    "$['ASF:ImageWidth']"
   ]
  }
 },
 "to": {
  "properties": {
   "MainFile": {
    "bag": "properties",
    "properties": {
     "extension": "extension",
     "filesize": {
      "value": "filesize",
      "conversion": "FileSize"
     },
     "filesizebytes": "filesize",
     "filename": "filename",
     "width": "width"
    }
   }
  },
  "related": [
   {
    "relation": "MasterFile",
    "role": "Child",
    "properties": {
     "FileSize": {
      "value": "filesize",
      "conversion": "FileSize"
     },
     "FileProperties": {
      "bag": "properties",
      "properties": {
       "extension": "extension",
       "width": "width"
      }
     }
    }
   }
  ]
 }
}

The ImportMetadataConfiguration JSON configuration contains two sections:

  • from - Metadata to extract from the uploaded file.

  • to - Asset properties where the metadata is to be mapped.

From section

The from section of the example contains three types of metadata property declarations. The following table explains them:

from clause

Description

RequestResponse
{
  "extension": "extension"
}
  • Extension (first occurrence) - reference used in the to section.

  • Extension (second occurrence) - the property name in the system.

Note

No file or path parameters indicates that this is referencing a static metadata property.

RequestResponse
{
  "filesize": {
    "file": "metadata",
    "path": [
      "$['File:FileSize']"
    ]
  }
}
  • filesize: reference used in the to section.

  • file: file where the property is located. In this case, metadata refers to the metadata.json file.

  • path: path of the property in the metadata file.

Note

The path values reference the metadata property in the metadata.json file.

RequestResponse
{
  "width": {
    "file": "metadata",
    "path": [
      "$['Composite:ImageWidth']",
      "$['File:ImageWidth']",
      "$['EXIF:ImageWidth']",
      "$['QuickTime:ImageWidth']",
      "$['MPEG:ImageWidth']",
      "$['PNG:ImageWidth']",
      "$['GIF:ImageWidth']",
      "$['Photoshop:ImageWidth']",
      "$['RIFF:ImageWidth']",
      "$['ASF:ImageWidth']"
     ]
  }
}
  • width - reference used in the to section.

  • file - file where the property is located. In this case, metadata refers to the metadata.json file.

  • path - path of the property in the metadata file.

Note

When the path parameter has multiple values, the processor parses all entries in order until it finds a valid value.

To section

The to section maps metadata properties defined in the from section to the asset properties.

When you upload a file, it is associated with an asset entity using the MasterFile relation. The to section in the metadata configuration starts with the file entity properties and continues with the asset entity properties using the related attribute.

The following diagram illustrates the structure of the to section:

Structure of the to section in the setting configuration

The to section contains two parts, properties and related.

properties is a list of mappings between the from section and the file entity properties. A mapping can be complex, containing sub-properties organized in bags; or simple, containing simple single-valued properties.

A complex mapping is a property that references a member of the entity definition, such as MainFile. It includes the following properties:

  • bag - name of the bag in which the properties are stored, such as properties.

  • properties - list of simple properties to be stored in the bag.

A simple mapping is a property that references a member of the entity definition, such as filesize. It includes the following properties:

  • value - value assigned to the property. For example, filesize that references a property of the from section.

  • conversion - conversion to apply on the value. For example, FileSize.

Both value and conversion are optional, so you can provide a simple key-value mapping instead, such as width:width.

related is an array of mappings between the from section and the properties of related entities such as Asset.

A related mapping is a property that describes the relation to a related entity, such as MasterFile. It includes the following properties:

  • role - role of the file entity in the relation. For example, in the MasterFile relation, File is a child of Asset. Valid values are parent or child.

  • properties - an array of complex or simple property mappings to the related entity.

Conversions values

Metadata configuration supports the following values for the conversion property:

  • Duration - Rounds the duration value with a factor of 1000.

  • FileSize - Rounds the file size using two decimal places and a factor of 0.000001.

  • ArrayToString - Concatenates the elements of the array to create a single, comma-separated string.

Do you have some feedback for us?

If you have suggestions for improving this article,