Syntax

The code of the metadata template file must contain the following sections:

  • Version
  • Type of file
  • List of metadata templates

 

The code in the following example illustrates this structure:

 

{

 "version": 1,

 "type": "metadata-template",

 "data": [ ]

}

 

The individual metadata templates must be defined by the following attributes in the "data" section (see also the following code example):

  • prefix (optional)
  • Compare the prefix of the (source) with this string.
  • suffix (optional):
  • Compare the suffix of the (source) with this string.
  • regex (optional)
  • Compare the regular expression in JavaScript syntax in the (source) with this string.
  • source (mandatory attribute)
  • Source for comparing prefix, suffix, regex.
  • applicationType (optional)
  • Set metadata "Application type".
  • referenceDesignator (optional)
  • Set metadata "Reference designator".
  • deviceLabel (optional)
  • Set metadata "Device label".

 

The code in the following example illustrates the mandatory syntax. The metadata templates define the following rules here:

  • If the source "label" of a device contains "tobias" as the prefix, the metadata "applicationType" should be set to "test" and the metadata "referenceDesignator" set to "AAAA".
  • If the source "model" of a device contains "UHX" as the prefix, the metadata "applicationType" should be set to "Control" and the metadata "referenceDesignator" set to "Plant hall A".
  • If the source "url" of a device contains the expression "opc.tcp://10\\.2.*", the metadata "applicationType" should be set to "Vibration sensor" and the metadata "referenceDesignator" set to "RGB measurement".

 

{

 "version": 1,

 "type": "metadata-template",

 "data": [

  {

   "source": "label",

   "prefix": "tobias",

   "applicationType": "test"

   "referenceDesignator": "AAAA"

  },

  {

   "source": "model",

   "prefix": "UHX",

   "applicationType": "control",

   "referenceDesignator": "plant hall A"

  },

  {

   "source": "url",

   "regex": "opc.tcp://10\\.2.*",

   "applicationType": "vibration sensor",

   "referenceDesignator": "RGB measurement"

  }

 ]

}