Batch Metadata Expressions
Introduced in version 23.1
Introduction
Using Metadata Expressions a new batch task is available and named BatchExpressionTemplatesTask
. It takes as an argument a list of metadata sidecar-like arguments. An example of such metadata sidecar is
{
"Descriptive": {
"Title": "#{R('Descriptive.Title').toUpperCase()}",
"Description": "#{R('Descriptive.Title') + ': ' + R('Dynamic.CustomDescription')}",
"Keywords": {"Keyword": "#{R('Dynamic.CustomTag')}"}
},
"Dynamic": {
"Orientation": "#{(R('Technical.Width') > R('Technical.Height')) ? 'Horizontal' : 'Vertical'}",
"AdditionalInformation": "My custom field"
}
}
Merging
When the templated sidecar is evaluated against a record it will result for example in the following metadata sidecar
{
"Descriptive": {
"Title": "MY TEST FILE",
"Description": "My test file: this is a test file",
"Keywords": {"Keyword": ["My custom tag"]}
},
"Dynamic": {
"Orientation": "Horizontal",
"AdditionalInformation": "My custom field"
}
}
This metadata sidecar will then be merged against the record using the same rules as when MediaHaven Rest API - Updating a record.
Output after evaluating the expression
After evaluating all expressions in the input metadata sidecar, the result is a new metadata sidecar in JSON. The conversion follows the following rules
Output after evaluating the expression | Conversion into JSON |
---|---|
| JSON string |
| JSON boolean |
| JSON number |
| JSON array |
| JSON object |
| JSON object containing JSON arrays |
Notice how the string "#{R('Dynamic.CustomTag')}"
is evaluated into an array ["My custom tag"]
. The end result is a valid metadata sidecar for “Keywords” namely "Keywords": {"Keyword": ["My custom tag"]}
whereas before evaluating the expression "Keywords": {"Keyword": "#{...}"}
is not a strictly valid metadata sidecar because the value of "Keyword"
must be an array and not a string.