Thing Schema

Things represent the entities in your world. They store information about real world objects like assets, rooms or buildings, as well as information about concepts like Tasks or processes.

Things are defined through JSON formatting, in a standard schema called Web of Things "Thing Descriptions". This standard schema allows you to be very prescriptive about what kind of information you expect to populate these Things, validate that the data matches what you expect, and even create user experiences that adjust based on the schema of the data.

Based on the Web of Things (WoT) Things can be defined based on properties, actions, and events.


Figure 1.
Properties
Describe the Thing's attributes (e.g., sensor values, configuration parameters, status, results of an analysis)
Actions
Determine how you can interact with your Thing (e.g., change a property, turn on/off)
Events
Monitor the changes that can modify a Thing’s property (e.g., fire alarm, door open, data streams)
Similar to categories, include steps about how to create a Thing (upload schema should be inside skip to schema option) and how to add Properties, Actions and Events by clicking the + symbol

Our Thing schema provides a standard schema definition for the Things in your world, compliant with the Web of Things Thing Description and built on top of the popular "JSON Schema" definition.

It gives your application standard interfaces to communicate with Things in Category in the AnythingDB and provides a means for Things in your application to reference and communicate with entities outside of your application.

AnythingDB uses a standard schema definition to provide structure for Things in Category. These define the types of information you expect in the Thing. For example, below is a schema for a lamp.
{
  "@context": "https://www.w3.org/2019/wot/td/v1",
  "@type": "ThingTemplate",
  "actions": {
    "toggle": {
        "description": "Turn the lamp on or off",
        "input": {}
     }
  },
  "categories": [],
  "created": "2023-05-30T08:26:01.976718108Z",
  "description": "Lamp Thing Description Template",
  "events": {
      "overheating": {
          "data": {
              "type": "string"
           },
          "description": "Lamp reaches a critical temperature",
          "title": ""
      }
  },
  "href": "/spaces/myspace/things/01H1NW77BRDFK9BX7BAKNWBX7N",
  "id":"https://api.swx.altairone.com/spaces/myspace/things/01H1NW77BRDFK9BX7BAKNWBX6N,
  "model": null,
  "modified": "2023-05-30T08:28:09.591925617Z",
  "properties": {
      "state": {
        "description": "current state of the lamp on|off",
        "readOnly": true,
        "title": "",
         "type": "string"
    }
  },
  "title": "Lamp Thing Description Template",
  "uid": "01H1NW77BRDFK9BX7BAKNWBX7N"
  }
In this definition, you can see what data is expected for this device:
  1. state and volume properties for describing the current state of the Thing
  2. toggle action for adjusting the current state
  3. An overheating event to tell users that something worth noting is happening

All this helps create user experiences in applications that fit the data. You can use the "unit" definitions to populate a label in an input field, you can use the "type" definitions to determine whether a toggle switch is needed or an input field, and you can use the "maximum" and "minimum" definitions to validate that the data received is within expected bounds.

Note: For more information, the Web of Things is defined here by the World Wide Web Consortium´s (W3C).
Table 1. Altair IoT Studio-defined, top-level metadata keys
Metadata Key Description Auto-generated? Required? Type
uid Unique identifier for this Thing Yes Yes string
href Relative reference point for this Thing Yes Yes string
category AnythingDB Category to which this Thing belongs. Yes Yes string
space Altair IoT Studio space to which this Thing belongs Yes Yes string
model Model from which this Thing was created. Yes Yes object