Introduction
TIC 4.0 uses the JSON format as default because it allows to express an array of subjects (for several sub-subjects) or observed properties (for different combinations of timestamps, pom, pomt, names, etc). JSON is also the default file format for many protocols, such as REST and MQTT, which are extensively used to share data or publish IoT data. These arrays give us a high flexibility thanks to the hierarchical structure. Other hierarchical structures, such as XML, are possible in TIC 4.0 lbut we recommend using JSON as default.
...
The semantic combines 6 basic elements: HEADER, SUBJECT, CONCEPT, OBSERVED PROPERTY, POINT OF MEASUREMENT and VALUE to represent a unique reality. TIC4.0 JSON format uses arrays for the SUBJECT and OBSERVED PROPERTY:
The SUBJECT never has timestamps
The OBSERVED PROPERTY always has a timestamp.
The CONCEPT never has arrays.
The POINT OF MEASUREMENT and VALUE (with their units) are always part of the observed properties so they cannot have an array (but can be part of one array).
...
Rule 2: Pathname includes objects and properties
To define the VALUE it is required to combine the SUBJECT, CONCEPT, OBSERVED PROPERTY, POINT OF MEASUREMENT in the path name. If the array contains values, it will be considered as a primitive element, but if it contains an object, the name of the final property will include the value of some of the attributes in the path.
...
Rule 3: Subjects include the extension “@”
The SUBJECT is always an array. To be able to convert automatically from Flat to JSON an identifier must be included in the pathname to identify that the subject is an array. Any array without a timestamp is a SUBJECT.
In consequence, if there is an array without any timestamp we will add to the pathname the character “@” with the “@arrayid” if exist. The “@” is always necessary and in case the array has an “arrayid” identification the value of it must be included after the ”@arrayid".
...
Bloque de código |
---|
[ { "msg|id": "001", "msg|sample": 1, "che|@|name": "STS01", "che|@|spreader|@spreader1@|id": "brm23423", "che|@|spreader|@spreader1@|name": "spreader1", "che|@|spreader|@spreader1@|number": "33", "che|@|spreader|@spreader1@|arrayid": "spreader1", "che|@|spreader|@spreader1@|location|technical|ioutput|actual|timestamp": "2021-11-18T08:27:28.613Z", "che|@|spreader|@spreader1@|location|technical|ioutput|actual|value": "1", "che|@|spreader|@spreader1@|location|technical|ioutput|actual|qualifier": "spreader" } ] |
...
Rule 4: Observed properties included in the pathname
The OBSERVED PROPERTY always has an array that includes at least the “timestamp”. Each array element is always a unique combination of the values of the object: timestamp, POINT OF MEASUREMENT, unit etc. Therefore the array identification is made by combining part of the content to make it unique. At the present release 2022.004 (in the future are expected to incorporate new values to this list) the values to include in the path name to identify the array are:
...