Complex properties
It is also possible to use complex properties. These properties use complex schemas such as Object, Enum, Array, and Map. All of these were explained in Chapter 3, Digital Twin Definition Model. In this section, we will focus on the complex schema type called Map. This complex schema type can be best compared to a dictionary in C#.
This example will demonstrate how to extend the Building model with a map containing all the temperatures of different rooms. This allows us to query the temperatures of the complete building easily in one go.
We need to create a new .json
file called building.json
under Models/chapter5
. Replace the content of the file with the following code:
{ "@id": "dtmi:com:smartbuilding:Building;1", "@type": "Interface", "@context": "dtmi:dtdl:context;2", "displayName": "Building", "contents"...