Web of Things (WoT) Thing Description

W3C Working Draft 5 April

This version:
https://www.w3.org/TR/2018/WD-wot-thing-description-20180405/ https://www.w3.org/TR/2018/WD-wot-thing-description-20181021/
Latest published version:
https://www.w3.org/TR/wot-thing-description/
Latest editor's draft:
https://w3c.github.io/wot-thing-description/
Previous version:
https://www.w3.org/TR/2017/WD-wot-thing-description-20170914/ https://www.w3.org/TR/2018/WD-wot-thing-description-20180405/
Editors:
Sebastian Kaebisch ( Siemens AG )
Takuki Kamiya ( Fujitsu Laboratories of America, Inc. )
Contributors:
In the GitHub repository
Repository:
We are on GitHub
File a bug

Editor's note : First draft based on Simplified TD

This is the first draft of the new simplified TD approach based on JSON-LD 1.1. Some definitions are not finished yet and are still in progress. A stable Thing Description deliverable version based on JSON-LD 1.0 can be found here .

Abstract

This document describes a formal model and a common representation for a Web of Things (WoT) Thing Description. A Thing Description describes the metadata and interfaces of Things, where a Thing is an abstraction of a physical or virtual entity that provides interactions to and participates in the Web of Things. Thing Descriptions provide a narrow-waist set of interactions based on a small vocabulary that makes it possible both to integrate diverse devices and to allow diverse applications to interoperate. Thing Descriptions, by default, are encoded in JSON-LD. a JSON format that also allows JSON-LD processing. The latter provides both a powerful foundation to represent knowledge about Things and simplicity, since it allows processing as in a JSON document. In addition to physical entities, Things can also represent virtual entities. machine-understandable way. A Thing Description instance can be hosted by the Thing itself or hosted externally due to Thing's when a Thing has resource restrictions (e.g. (e.g., limited memory space) or when a Web of Things-compatible legacy device is retrofitted with a Thing Description.

Status of This Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at https://www.w3.org/TR/.

Implementers need to be aware that this specification is considered unstable. Vendors interested in implementing this specification before it eventually reaches the Candidate Recommendation phase should subscribe to the repository and take part in the discussions.

Editor's note : The W3C WoT WG is asking for feedback

Please contribute to this draft using the GitHub Issue feature of the WoT Thing Description repository. For feedback on security and privacy considerations, please use the WoT Security and Privacy Issues, as they are security and privacy is cross-cutting over all our documents.

This document was published by the Web of Things Working Group as a Working Draft. This document is intended to become a W3C Recommendation.

Comments regarding this document are welcome. Please send them to public-wot-wg@w3.org ( subscribe , archives ).

Changes from the previous publication can be found in Appendix A B . A diff-marked version of this document is also available for comparison purposes.

Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.

This document was produced by a group operating under the W3C Patent Policy . W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy .

This document is governed by the 1 February 2018 W3C Process Document .

1. Introduction

The W3C Thing Description (TD) is a central building block in a the W3C Web of Things (WoT) enabled system and can be considered as the entry point of a Thing (aka (much like the index.html of the Thing). a Web site). The TD consists of semantic metadata for the Thing itself, a narrow-waist an interaction model with based on WoT's Properties, Actions, Properties , Actions , and Events, Events paradigm, a semantic schema to make data models machine-understandable, and features for Web Linking to express relations among Things.

Properties can be used for sensing and controlling (or retrieving) parameters, such as a setting an operation state (or getting the current value). value or setting an operation state. Actions model invocation of physical (and hence time-consuming) processes, but can also be used to abstract RPC-like calls of existing platforms. Events cover are used for the push model of communication where state change notifications, discrete events, and or streams of values are sent asynchronously to the receiver. In general, the TD provides metadata for the different communication bindings identified by URI schemes (e.g., HTTP, CoAP, MQTT, "http", "coap", "mqtt", etc.), mediaTypes media types (e.g., "application/json", "application/xml", "application/cbor", "application/exi" etc.), and security policies (authentication, mechanisms (for authentication, authorization, confidentiality, etc.). The default serialisation Serialization of the TD instances is JSON-LD. based on JSON and includes at least the TD core vocabulary as JSON keys as defined in this specification document.

Example 1 shows a simple TD instance that reflects in such a JSON serialization and depicts WoT's Property, Action, Event Properties , Actions , and Events paradigm by describing a lamp Thing with the name MyLampThing .

Example 1 : : Simple Thing Description Sample with JSON serialization
{
  : [<span class=
"hljs-string">"https://w3c.github.io/wot/w3c-wot-td-context.jsonld"],
  : [<span class=
"hljs-string">"Thing"],
  : <span class=

    "id": "hljs-string">"urn:dev:wot:com:example:servient:lamp",
    "name": "MyLampThing",
  : [
      {
          : [<span class=
"hljs-string">"Property"],
          : <span class=
"hljs-string">"status",
          : {<span class=
"hljs-attr">"type": <span class=
"hljs-string">"string"},
          : <span class=
"hljs-literal">false,
          : <span class=
"hljs-literal">true,
          : [{
              : <span class=
"hljs-string">"coaps://mylamp.example.com:5683/status",
              <span class=
"hljs-attr">"mediaType": <span class=
"hljs-string">"application/json"
          }]
      },
      {
          : [<span class=
"hljs-string">"Action"],
          : <span class=
"hljs-string">"toggle",
          : [{
              : <span class=
"hljs-string">"coaps://mylamp.example.com:5683/toggle",
              <span class=
"hljs-attr">"mediaType": <span class=
"hljs-string">"application/json"
          }]
      },
      {
          : [<span class=
"hljs-string">"Event"],
          : <span class=
"hljs-string">"overheating",
          : {<span class=
"hljs-attr">"type": <span class=
"hljs-string">"string"},
          : [{
              : <span class=
"hljs-string">"coaps://mylamp.example.com:5683/oh",
              <span class=
"hljs-attr">"mediaType": <span class=
"hljs-string">"application/json"
          }]
      }
  ]

    "security": [{"hljs-attr">"scheme": "basic"}],
    "properties": {        "status" : {            "type": 
"hljs-string">"string",
            "forms": [{
"hljs-attr">"href": "https://mylamp.example.com/status"}]
        }
    },
    "actions": {        "toggle" : {            "forms": [{
"hljs-attr">"href": "https://mylamp.example.com/toggle"}]
        }
    },
    "events":{        "overheating":{            "type": 
"hljs-string">"string",
            "forms": [{                "href": 
"hljs-string">"https://mylamp.example.com/oh",
                
"hljs-attr">"subProtocol": "LongPoll"
            }]
        }
    }

}

Based on this content, we know there exists one Property interaction resource with the name status . In addition, information is provided such as to indicate that this Property is accessable over accessible via (the secure form of) the CoAP HTTP protocol with a GET method (see CoAP protocol binding description in the W3C WoT protocol template deliverable [ WOT-PROTOCOL-BINDING ]) at coaps://mylamp.example.com:5683/status the URI https://mylamp.example.com/status (announced within the form forms structure by the href key), which and will return a string status value within a JSON structure (JSON as payload format value. The use of the GET method is announced by not stated explicitly, but is one of the mediaType field). default assumptions defined by this document.

In a similar manner manner, an Action is specified to toogle toggle the switch status using the POST method that is applied to the coaps://mylamp.example.com:5683/toggle resource (see CoAP protocol binding description in the W3C WoT protocol template deliverable [ WOT-PROTOCOL-BINDING ]). https://mylamp.example.com/toggle resource, where POST is again a default assumption for invoking Actions.

Events which are, e.g., unexpected or irregular can be specified with the WoT's The Event model. pattern enables a mechanism for asynchronous messages to be sent by a Thing. Here, a subscription of to be notified upon a possible overheating event of the lamp can be applied obtained by using CoAP OBSERVE at coaps://mylamp.example.com:5683/oh. (see CoAP protocol binding description in the W3C WoT protocol template deliverable [ WOT-PROTOCOL-BINDING ]). HTTP with its long polling sub-protocol at https://mylamp.example.com/oh .

1.1 Context Extensions

The Thing Description defines This example also specifies the basic security scheme, requiring a relative small set username and password for access. In combination with the use of terms to describe mainly Thing's interaction models. the HTTP protocol this indicates the use of HTTP Basic Authentication. Specification of a security scheme at the top level as in this example indicates that it is required for every resource. However, security schemes can also be specified per-interaction or per-form, with lower-level configurations overriding higher-level ones, allowing for the specification of fine-grained access control. Examples are provided later.

The TD opens in Example 1 reflects some additional defined default assumptions that are not explicitly described. For example, the re-usage media type of existing models from un-specific (e.g., schema.org, SSN) and specific domains (e.g., smart home, consumer electronics, industry, automotive) to enrich the capabilities exchange format of the interactions is assumed to be JSON (= mediaType ) and the Property status resource is not writable as well as not observable. Specifically, the TD specification defines vocabulary terms ( writable , observable , mediaType ) that have default values. If these vocabulary terms are not explicitly used in a Thing with further vocabulary and semantics. Description instance, the Thing Description processor follows default assumptions for interpretation as defined in this specification.

The following example extends TD can be also processed as an RDF-based model. In that case, the previous shown example Thing Description instance needs to be transformed into valid JSON-LD first. In terms of JSON-LD 1.1 serialization, the open-world assumption of RDF semantic processing requires vocabulary terms with further semantics from default values to be always present explicitly in the iotschema.org context. instances. Example 2 shows the same TD in a JSON-LD 1.1 serialization representing exactly the same information as in Example 1; however, default values have been filled in.

Example 2 : Sample with semantic extenstions : Thing Description as JSON-LD 1.1 Serialization
{
  : [<span class=
"hljs-string">"https://w3c.github.io/wot/w3c-wot-td-context.jsonld", 
          {: <span class=
"hljs-string">"http://iotschema.org/"}],
  : [<span class=
"hljs-string">"Thing",  <span class=
"hljs-string">"iot:Light", <span class=
"hljs-string">"iot:BinarySwitch"],
  : <span class=

    "@context": "hljs-string">"http://www.w3.org/ns/td",
    "id": 
"hljs-string">"urn:dev:wot:com:example:servient:lamp",
    "name": "MyLampThing",
  : [
      {
          : [<span class=
"hljs-string">"Property", <span class=
"hljs-string">"iot:SwitchStatus"],
          : <span class=
"hljs-string">"status",
          : {<span class=
"hljs-attr">"type": <span class=
"hljs-string">"string"},
          : <span class=

    "security": [{"hljs-attr">"scheme": "basic", "in": "header"}],
    "properties": {        "status": {            "writable": false,
          : <span class=
"hljs-literal">true,
          : [{
              : <span class=
"hljs-string">"coaps://mylamp.example.com:5683/status",
              <span class=

            "hljs-attr">"observable": false,
            "type": 
"hljs-string">"string",
            "forms": [{                "href": 
"hljs-string">"https://mylamp.example.com/status",
                
"hljs-attr">"http:methodName": "GET",
                "mediaType": "application/json"
          }]
      },
      {
          : [<span class=
"hljs-string">"Action", <span class=
"hljs-string">"iot:ChangeSwitchStatus"],
          : <span class=
"hljs-string">"toggle",
          : [{
              : <span class=
"hljs-string">"coaps://mylamp.example.com:5683/toggle",
              <span class=

            }]
        }
    },
    "actions": {        "toggle": {            "forms": [{                "href": 
"hljs-string">"https://mylamp.example.com/toggle",
                
"hljs-attr">"http:methodName": "POST",
                "mediaType": "application/json"
          }]
      },
      {
          : [<span class=
"hljs-string">"Event", <span class=
"hljs-string">"iot:TemperatureAlarm"],
          : <span class=
"hljs-string">"overheating",
          : {<span class=
"hljs-attr">"type": <span class=
"hljs-string">"string"},
          : [{
              : <span class=
"hljs-string">"coaps://mylamp.example.com:5683/oh",
              <span class=

            }]
        }
    },
    "events": {        "overheating": {            "type": 
"hljs-string">"string",
            "forms": [{                "href": 
"hljs-string">"https://mylamp.example.com/oh",
                
"hljs-attr">"subProtocol": "LongPoll",
                "mediaType": "application/json"
          }]
      }
  ]

            }]
        }
    }

}
Editor's note Provide detail description about the semantic usage in the example. Please also check

For more examples, including the samples provided in use of other protocols besides HTTP, see Section 6.7. 7. Example Thing Description Instances .

2. Terminology

The generic Generic WoT terminology is defined in [ WOT-ARCHITECTURE ]: Thing , Thing Description (in short TD ), Web of Things (in short WoT ), WoT Interface etc.

3. Namespaces

The namespace for the W3C TD is http://www.w3.org/ns/td# . TD itself defines a minimal set of classes and properties of its own. A full set of namespaces and prefixes used vocabulary as defined in this document is shown in http://www.w3.org/ns/td .

Using content negotiation, this namespace serves either the table below. TD ontology file (Turtle) or the TD context file (JSON-LD).

Prefix Namespace

The suggested prefix for the TD namespace is td http://www.w3.org/ns/td# rdf http://www.w3.org/1999/02/22-rdf-syntax-ns# .

The security ontology that can be used with the TD is available at https://www.w3.org/ns/wot-security .

The data schema ontology that can be used with the TD is available at https://www.w3.org/ns/json-schema .

Editor's note : Binding Vocabulary and Prefixes

ToDo: complete table The TD will reuse existing vocabulary definitions such as for http from the http://www.w3.org/2011/http# namespace. In that case the prefix http is used. However, there are prefixes such as coap and mqtt which have no namespace yet. Currently there are efforts to have such namespace representations which will be referenced in the TD specification in the future. In the meantime, the [ WOT-PROTOCOL-BINDING ] provides the list of terms that can be used to specify the protocol metadata in the Thing Description.

4. Conformance

As well as all sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.

The key words MUST , MUST NOT , REQUIRED , SHOULD , SHOULD NOT , RECOMMENDED , MAY , and OPTIONAL in this specification are to be interpreted as described in [ RFC2119 ].

A Thing Description instance complies with this specification if it follows the normative statements in Section 5. Vocabulary Definition Information Model . In case of JSON-LD serializiation, a Thing Description instance in JSON-LD format complies with this specification if it follows the normative statements in and Section 6. Thing Description Serialization regarding Thing Description serialization.

A JSON Schema [ JSON-SCHEMA-VALIDATION ] is provided in Annex A. JSON Schema for TD Instance Validation to validate Thing Description instances based on JSON-LD 1.1.

Issue 1 Editor's note

We need to be more precise here: How to validate a TD? E.g., structure validation and/or In the future some information about RDF validation? Comments are welcome. validation will be provided.

5. Vocabulary Definition Information Model

5.1 Overview

The W3C Thing Description relys on provides a small set of vocabulary. vocabulary for describing physical and virtual Things. To increase interoperability the vocabulary terms are defined using the Resource Description Framework (RDF). All vocabulary restrictions noted in these tables MUST be followed,including mandatory items and default values.

In general, the Thing Description vocabulary set is grouped in three modules: the core Thing Description vocabulary reflecting WoT's paradigm of Properties , Actions , and Events (also see [ WOT-ARCHITECTURE ]);the data schema vocabulary reflecting a subset of the terms defined in JSON Schema [ JSON-SCHEMA-VALIDATION ] in a linked data representation; and the security vocabulary used to define security mechanismconfiguration requirements.

An overview of this vocabulary with its class context and class relation is given by the following figure. three figures: the TD core model, the TD data schema model, and the TD security model. Please note that the figures reflect the vocabulary terms and structure as they would be used in a Thing Description instance (see Section 6. Thing Description Serialization ).The full ontology definitions of the different modules can be viewed by following the namespaces as provided in Section 3. Namespaces .

TD core model figure
Figure 1 TD core model
A detailed description of the vocabulary is given in the next sub-section.
5.2 TD data schema model figure
Figure 2 Classes TD data schema model
TD security model figure
Figure 3 TD security model
Editor's note : Default Values and Mandatory Attributes

There is an information missing from In the tables figures above, and in subsequent sub-sections as the tables to follow, items which vocabulary is have default values are indicated as being optional. However, technically, these are optional or mandatory. Since only in the JSON serialization . They are actually mandatory parts of the information model and are also mandatory in the JSON-LD serialization. In addition, the security scheme configuration is already available not actually optional even in the ontology files, tools need to JSON serialization. Security configuration is mandatory at least one of the three levels at which it may be updated to extract and utilize specified... so it can be omitted only if it is specified at a different level for each form. A future version of this information to generate document should better express the content status of these tables. attributes.

A detailed description of the vocabulary of the TD core model and TD data schema model is given in the next sub-section.

5.2 Core Vocabulary Definition

5.2.1 Thing

Describes a physical and/or virtual Thing (may represent one or more physical and / or and/or virtual Things) in the Web of Thing Things context.

Field Name Description Expected Mandatory Default value type Type
link id provides Web links to arbitrary resources that relate to unique identifier of the specified Thing Description. (URI, e.g. custom URN) yes . Link anyURI
interaction description Link from a Thing to the interaction patterns it provides Provides additional (human) readable information. no . InteractionPattern string
security name Links a given Thing to the security information that indicates the access metadata information for securely transmitting information via all the resources Name of the Thing. yes . Security string
support Provides information about the TD maintainer (e.g., author, link or telephone number to get support, etc). no . string
base Define the base URI that is valid for all defined local interaction resources. All other URIs in the TD must then be resolved using the algorithm defined in [ RFC3986 ]. This field is optional. no . anyURI
name properties Name All Property-based interaction patterns of the Thing or Thing. no . Property
actions All Action-based interaction pattern (must be a valid keyword patterns of the Thing. no . Action
events All Event-based interaction patterns of the Thing. no . Event
links Provides Web links to arbitrary resources that relate to be used in the scripting API) specified Thing Description. no . array of Link
string security Set of security configurations, provided as an array, that must all be satisfied for access to resources at or below the current level, if not overridden at a lower level. no . array of SecurityScheme

5.2.2 InteractionPattern

Three interaction patterns are defined as subclasses: Property, Action and Event. When a concrete Property, Action or Event is defined in a Thing Description, it is called an "interaction resource". Interactions between Things can be as simple as one Thing accessing another Thing's data to get or (in the case the data is also writable) change the representation of data such as metadata, status or mode. A Thing may also be interested in getting asynchronously notified of future changes in another Thing, or may want to initiate a process served in another Thing that may take some time to complete and monitor the progress. Interactions between Things may involve exchanges of data between them. This data can be either given as input by the client Thing, returned as output by the server Thing or both.

Each instance of a Property , Action , and Event class MUST have an identifier that is unique within the context of a Thing Description document. See Section Representation Format for more details about JSON-LD 1.1 identifiers.

Field Name Description Expected Mandatory Default value type Type
form forms Indicates one or more endpoints from which an interaction pattern is accessible accessible. yes . array of Form
name label Name Provides a label (e.g., display a text for UI representation) of the Thing or interaction pattern (must pattern. no . string
description Provides additional (human) readable information. no . string
security Set of security configurations, provided as an array, that must all be a valid keyword satisfied for access to be used in resources at or below the scripting API) current level, if not overridden at a lower level. no . array of SecurityScheme
scopes Set of authorization scope identifiers, provided as an array. These are provided in tokens returned by an authorization server and associated with forms in order to identify what resources a client may access and how. no . array of string

The class InteractionPattern has the following subclasses:

5.2.3 Property

Property provides readable and/or writeable data Properties expose internal state of a Thing that can be static (e.g., supported mode, rated output voltage, etc.) or dynamic (e.g., current fill level of water, minimum recorded temperature, etc.). Please note, this class directly retrieved (get) and optionally modified (set). In addition, Things can also inherited all vocabulary from choose to make Properties observable by pushing the InteractionPattern class. new state (not an event) after a change; this must follow eventual consistency (also see CAP Theorem).

Field Name Description Expected Mandatory Default value type Type
schema link to the n-ary class that allows the declaration of the data type and unit of measure provided by a property or an event. DataSchema observable Indicates whether a remote servient can subscribe to ("observe") the Property, to receive change notifications or periodic updates (true/false). no false boolean
writable Boolean value that indicates whether a property is writable (=true) or not (=false) (=false). no false boolean
Note

Property instances may also be instances of the class DataSchema and therefore can contain, among others, the type term.

5.2.4 Action

The Action interaction pattern triggers changes or processes on Actions offer functions of the Thing. These functions may manipulate the internal state of a Thing that take in a certain time to complete (i.e., actions cannot be applied instantaneously like property writes). way that is not possible through setting Properties. Examples include an LED fade in, moving are changing internal state that is not exposed as a robot, brewing Property, changing multiple Properties, changing Properties over time or with a cup of coffee, etc. Usually, ongoing process that should not be disclosed. Actions are modelled as Task resources, which are created when an Action invocation is received by the Thing. Please note, this class may also inherited all vocabulary from be pure functions, that is, they may not use any internal state at all, and may simply process input data and return a result that directly depends only on the InteractionPattern class. input given.

Field Name Description Expected Mandatory Default value type Type
inputSchema input link Link to the n-ary class that allows the declaration of the accepted data type of an action. no . DataSchema
outputSchema output link Link to the n-ary class that allows the declaration of the data type returned by an action. no . DataSchema

5.2.5 Event The Event interaction pattern enables a mechanism for events to be notified by a Thing on a certain condition (e.g., the fill level of the water tank reached a given threshold). Please note, this class also inherited all vocabulary from the InteractionPattern class. Field Name Description Expected value type schema link to the n-ary class that allows the declaration of the data type and unit of measure provided by a property or an event. DataSchema 5.2.6 DataSchema

This class embeds the terms The Event Interaction Pattern describes event sources that asynchronously push messages. Here not state, but state transitions (events) are defined communicated (e.g., "clicked"). Events may be triggered by JSON Schema ( https://tools.ietf.org/html/draft-handrews-json-schema-validation-00#section-6 ) and map them in a Linked Data form to allow, e.g., the representation of pairs (data type, semantic meaning such as unit of measure) internal state changes that are expected not exposed as input data or output data Properties. Events usually follow strong consistency, where messages need to be queued to ensure eventual delivery of a given interaction pattern. all events that have occurred.

Editor's note In next update

Instances of the TD deliverable Event class contains the full list term definitions of schema terms will be defined here. For now, please check the data schema defintions that are provided in Section 6.5 class InteractionPattern and examples provided in WoT Binding Template DataSchema .

5.2.7 5.2.6 Form

Communication metadata indicating where a service can be accessed by a client application. An interaction might have more than one form.

Field Name Description Expected Mandatory Default value type Type
href URI of the endpoint where an interaction pattern is provided provided. yes . anyURI
mediaType Assign the underlying media type [ MEDIATYPES ] of the an interaction pattern based on IANA ( https://www.iana.org/assignments/media-types/media-types.xhtml ) pattern. no application/json string
rel Indicates the expected result of performing the operation described by the form. For example, the Property interaction allows get and set operations. The protocol binding may contain a form for the get operation and a different form for the set operation. The value of the "rel" rel attribute of the form indicates which form is which and allows the client to select the correct form for the oeration required operation required.

The value of the rel attribute of the form must be one of readproperty, writeproperty, observeproperty, invokeaction, subscribeevent, or unsubscribeevent.

no . string

(one of "readproperty" , "writeproperty" , "observeproperty" , "invokeaction" , "subscribeevent" , or "unsubscribeevent" )

subProtocol Indicates the exact mechanism by which an interaction will be accomplished for a given protocol when there are multiple options. For example, for HTTP and Events, it indicates which of several available mechanisms should be used for asynchronous notifications. no . string

(one of "LongPoll" )

security Set of security configurations, provided as an array, that must all be satisfied for access to resources at or below the current level, if not overridden at a lower level. no . array of SecurityScheme
scopes Set of authorization scope identifiers, provided as an array. These are provided in tokens returned by an authorization server and associated with forms in order to identify what resources a client may access and how. no . array of string
6. JSON-LD Serialization Thing Description instances are modeled on the classes defined in

5. 5.3 Data Schema Vocabulary Definition , and they are serialized in JSON-LD by default, using the vocabulary defined there when they are served at run-time. JSON-LD is a serialization format that adds a semantic layer on top of the JSON specification: the terms that appear in a JSON document should be associated with uniquely identified concepts from shared vocabularies. This principle is part of a set of practices to publish data on the Web called Linked Data, where concepts are usually identified with URIs and originate from RDF vocabularies.

6.1 5.3.1 Thing as a Whole The JSON-LD representation for a Thing Description is a JSON object of which fields are defined below. DataSchema

Gives annotations to the Thing name security See 6.4 Security link
Field Name JSON Construct Description Mandatory Description Default value Type
@context description array of strings Provides additional (human) readable information. yes no . The array MUST contain a string "https://w3c.github.io/wot/w3c-wot-td-context.jsonld" . Also see below.
@type type array Assignment of strings JSON-based data types compatible with JSON Schema (one of boolean, integer, number, string, object, array, or null). no . string yes Name

(one of the Thing "boolean" , "integer" , "number" , "string" , "object" , "array" , or "null" )

base const string Provides a constant value. no . Base URI for use in a Thing Description. If relative URIs are used within value of any type that is consistent with the type given to the above form type field (see 6.3 Form ), base MUST be present. definition if any
interaction array of objects no See 6.2 Interaction Resources enum array Restricted set of objects values provided as an array. no . array of objects no tbd: see Link values of any type with each consistent with the type given to the above type field definition if any

Each field in Thing The class (see 5.2.1 Thing ) is represented by the namesake JSON field described in DataSchema has the above table. following subclasses:

The
6.2 Interaction Resources An interaction in the context of the Web of Things is an exchange of data between a Web client and a Thing. This data can be either given as input by the client, returned as output by the Thing, or both. Three interaction patterns are defined: Property , Action , and Event .

6.2.1 5.3.2 Property The Property interaction definitions (also see Property vocabulary definition section ) provides metadata for readable and/or writeable data that can be static (e.g., supported mode, rated output voltage, etc.) or dynamic (e.g., current fill level of water, minimum recorded temperature, etc.). Shown below is an example of a Property ArraySchema interaction definition. Example 6 { ... : [ { : [<span class= "hljs-string">"Property"], : <span class= "hljs-string">"temperature", :{ <span class= "hljs-string">"type": <span class= "hljs-string">"number" }, : <span class= "hljs-literal">false, : <span class= "hljs-literal">true, : [{ : <span class= "hljs-string">"coap://mytemp.example.com:5683/temp", : <span class= "hljs-string">"application/json" }] }, ... }

The JSON-LD representation for a Property interaction definition is a A JSON object of which the fields are defined below. array specification ("type": "array").

yes
Field Name JSON Construct Description Mandatory Description Default value Type
@type items array Used to define the characteristics of strings an array. yes no . Gives one or more semantic annotations to the Property DataSchema interaction. The array MUST start with a string "Property"
name string yes minItems Name Defines the minimum number of items that have to be in the Property schema array. object no . See 6.5 Type System unsignedInt
writable boolean yes a property is writable (=true) or not (=false) observable boolean yes a property is observable (=true) or not (=false) form maxItems array Defines the maximum number of objects items that have to be in the array. no . See 6.3 Form unsignedInt
Each field in Property class (see 5.2.3 Property ) is represented by the namesake JSON field described in the above table.

6.2.2 5.3.3 Action The Action ObjectSchema interaction pattern (also see Action vocabulary definition section ) targets changes or processes on a Thing that take a certain time to complete (i.e., actions cannot be applied instantaneously like property writes). Examples include an LED fade in, moving a robot, brewing a cup of coffee, etc. Usually, ongoing Actions are modeled as Task resources, which are created when an Action invocation is received by the Thing. Example 7 { ... : [ { : [<span class= "hljs-string">"Action"], : <span class= "hljs-string">"fadeIn", <span class= "hljs-string">"inputSchema" }, : [{ : <span class= "hljs-string">"coap://mytemp.example.com:5683/in", <span class= "hljs-string">"mediaType" }] } ] ... }

JSON-LD representation for an Action interaction definition is a A JSON object of which the fields are defined below. specification ("type": "object").

Field Name JSON Construct Description Mandatory Description Default value Type
@type properties array of strings Data schema nested definitions. yes no . Gives one or more semantic annotations to the Action DataSchema interaction. The array MUST start with a string "Action"
name string yes required Name Defines which members of the Action outputSchema object type are mandatory. no . See array of 6.5 string

5.3.4 Type System BooleanSchema

A JSON boolean value specification ("type": "boolean").

5.3.5 NumberSchema

A JSON number value specification ("type": "number").

Field Name Description Mandatory Default value Type
inputSchema minimum object Specifies a minimum numeric value. Only applicable for associated number or integer types. no . See 6.5 Type System double
form maximum array of objects Specifies a maximum numeric value. Only applicable for associated number or integer types. no . See 6.3 Form double
Each field in Action class (see

5.2.4 Action 5.3.6 StringSchema ) is represented by the namesake

A JSON field described in the above table. string value specification ("type": "string").

6.2.3 5.3.7 Event The Event interaction pattern (also see Event vocabulary definition section ) enables a mechanism to be notified by a Thing on a certain condition. While some protocols such as CoAP can provide such a mechanism natively, others do not. Furthermore, Events might need a specific configuration that requires data sent and stored on the Thing in a standard way. There are are three mandatory terms and one optional term defined within the Event IntegerSchema pattern: Example 8 { ... : [ { : [<span class= "hljs-string">"Event"], : <span class= "hljs-string">"criticalCondition", : { <span class= "hljs-string">"type": <span class= "hljs-string">"string" }, : [{ : <span class= "hljs-string">"coap://mytemp.example.com:5683/ev", <span class= "hljs-string">"mediaType" }] } ] ... }

The JSON-LD representation for an Event interaction definition is a A JSON object of which the fields are defined below. integer value specification, that is, numbers without a fractional part ("type": "integer").

yes
Field Name JSON Construct Description Mandatory Description Default value Type
@type array of strings yes Gives one or more semantic annotations to the Event minimum interaction. The array MUST start with a string "Event" name string yes Name of the Event schema Specifies a minimum numeric value. Only applicable for associated number or integer types. object no . See 6.5 Type System integer
form maximum array of objects Specifies a maximum numeric value. Only applicable for associated number or integer types. no . See 6.3 Form integer
Each field in Event class (see

5.2.5 Event 5.4 Security Vocabulary Definition ) is represented by the namesake JSON field described in the above table. 6.3 Form

This section describes JSON-LD serialization for For the instances core TD vocabulary only well-established security mechanisms are supported, such as those built into protocols supported by WoT or already in wide use with those protocols. The current set of the 5.2.7 Form HTTP security schemes is partly based on OpenAPI 3.0.1 (see also [ OPENAPI class. Shown below is an example ]). Note however that while the HTTP security schemes, vocabulary and syntax given in this specification share many similarities with OpenAPI they are not fully compatible. Also, since OpenAPI primarily targets web services built around HTTP, it does not cover the full set of a form definition. use cases required for the IoT. Security schemes appropriate for IoT-centered protocols such as CoAP and MQTT are therefore also included.

Example 9 Editor's note <span class= "hljs-string">"form": [ { : <span class= "hljs-string">"coap://mytemp.example.com:5683/temp", : <span class= "hljs-string">"application/json", : <span class= "hljs-string">"writeProperty" } ] : Security Scheme Extensions
JSON-LD representation

The vocabulary extension mechanism of the WoT Thing Description allows for additional security schemes if needed.However, for more information about what additional security schemes or modifications are under discussion for a web form definition is a JSON array with name "form". Each item in the array is core WoT vocabulary(and to file issues if you have a JSON object that consists of two JSON fields as summarized below. request) please visit the WoT Security TF repository.

5.4.1 SecurityScheme

Field Name JSON Construct Description Mandatory Description Default value Type
href scheme string Identification of security mechanism being configured. yes . URI. If a relative URI is given then this URI is relative to the MUST present base URI (see 6.1 Thing as a Whole string ).

(one of "nosec" , "basic" , "cert" , "digest" , "bearer" , "pop" , "psk" , "public" , "oauth2" , or "apikey" )

mediaType description string Provides additional (human) readable information. yes no . Media type based on IANA string
rel proxyUrl string URI of the proxy server this security configuration provides access to. If not given, the corresponding security configuration is for the endpoint. no . Provides the expected result of performing the operation described by the form. Check [ WOT-PROTOCOL-BINDING ] for detail usage of rel . anyURI

The form field is used to pointing a URI to an instance of the interaction and descriptions of the protocol settings and options expected to be used between the client and server for the interaction. The different opportunities of class SecurityScheme has the protocol settings (such as for HTTP, CoAP, MQTT, etc) is described in [ following subclasses:

5.4.2 NoSecurityScheme JSON-SCHEMA-VALIDATION ], it is intended

A security configuration corresponding to be encoding-neutral and integrates into the Linked Data vocabularies ("scheme": "nosec"), indicating there is no authentication or other mechanism required to allow semantic annotations. It can not only be directly translated into JSON schema, but also can be handily translated into XML Schema. Use of JSON-LD equips access the type system with a way to associate data elements with citations and semantic concepts defined elsewhere. resource.

6.5.1 Simple Data Definition

6.5.1.1 5.4.3 Simple Types Within schema , inputSchema BasicSecurityScheme

Basic authentication security configuration ("scheme": "basic"), using an unencrypted username and password. This scheme should be used with some other security mechanism providing confidentiality, for example, TLS.

Field Name Description Mandatory Default value Type
outputSchema in fields, simple type assignments can be done by using Specifies the location of security authentication information (one of header, query, body, or cookie). no header type string field that specifies one of the datatypes borrowed from [ JSON-SCHEMA-VALIDATION ]. Shown below is an example of an interaction snippet that carries a simple type definition
number name within Name for query, header, or cookie parameters. no . schema . string Example 11 <span class= "hljs-string">"schema": { <span class= "hljs-string">"type": <span class= "hljs-string"> "number"

5.4.4 } CertSecurityScheme

JSON-LD representation for primitive data type definition is a JSON object of which the field is defined below. Certificate-base asymmetric key security configuration ("scheme": "cert").

Field Name JSON Construct Description Mandatory Description Default value Type
type identity string Pre-shared key identity. yes no . The following type defintions are possible for simple type assignments: boolean integer number string null
These type constructs are in parallel to those that are available in JSON schema. Therefore, serialization of data exchanged between servients is straightforward when it is in JSON format.

6.5.1.2 5.4.5 Restrictions DigestSecurityScheme

In order Digest authentication security configuration ("scheme": "digest"). This scheme is similar to make more precise data type defintions the TD also allows the usage basic authentication but with added features to avoid man-in-the-middle attacks.

Field Name Description Mandatory Default value Type
qop Quality of restrication terms borrowed from [ protection (one of auth or auth-int). no auth JSON-SCHEMA-VALIDATION ]. Consider the following schema string definition which defines the value to be an
integer in within Specifies the value range location of [ 0 ... 255 ]. security authentication information (one of header, query, body, or cookie). no header Example 12 : { : <span class= "hljs-string">"integer", : <span class= "hljs-number">0, : <span class= "hljs-number">255 } string The following table only display a small subset of the restriction terms defined in JSON Schema. Please check [
name Name for query, header, or cookie parameters. no . string JSON-SCHEMA-VALIDATION ]

5.4.6 BearerSecurityScheme

Bearer token authentication security configuration ("scheme": "bearer"). This scheme is intended for the full set situations where bearer tokens are used independently of restrictions. OAuth2. If the oauth2 scheme is specified it is not generally necessary to specify this scheme as well as it is implied.

Provides a constand/default value. ... ... ...
Field Name JSON Construct Description Mandatory Description Default value Type
minimum authorizationUrl number URI of the authorization server. no . Specifies a minimum numeric value. Only applicable for associated number or integer anyURI types.
maximum alg number Encoding, encryption, or digest algorithm (one of MD5, ES256, or ES512-256). no Specifies a maximum numeric value. Only applicable for associated number or ES256 integer string types.
minLength format number Specifies format of security authentication information (one of jwt, jwe, or jws). no Minimum length of the string. Only applicable for associated jwt string type.
maxLength in number Specifies the location of security authentication information (one of header, query, body, or cookie). no Maximum length of the string. Only applicable for associated header string type.
const name any type Name for query, header, or cookie parameters. no . Check [ JSON-SCHEMA-VALIDATION string ] for further type restriction terms.

6.5.1.3 5.4.7 Semantic Annotation Unlike in JSON Schema, the TD with JSON-LD serializiation allows a semantic annotation of data members of the types by using the @type key. The example below comes with a semantic annotation within inputSchema PSKSecurityScheme to privide its semantic context DimmerData that is defined in the http://iotschema.org/ namespace. Example 13 { : [ <span class= "hljs-string">"https://w3c.github.io/wot/w3c-wot-td-context.jsonld", {: <span class= "hljs-string">"http://iotschema.org/"} ], ... : { : <span class= "hljs-string">"integer", : [<span class= "hljs-string">"iot:DimmerData" ], : <span class= "hljs-number">0, : <span class= "hljs-number">255, }, ... }

JSON-LD representation for semantic annotation of simple type within schema , inputSchema and outputSchema fields is defined below. Pre-shared key authentication security configuration ("scheme": "psk").

Field Name JSON Construct Description Mandatory Description Default value Type
@type identity array of strings Pre-shared key identity. no . Gives one or more semantic annotations to the data member. string
Editor's note ToDo: Provide information about JSON Schema validation with @type .

6.5.1.4 5.4.8 Runtime Data Serializiation Unless otherwise specified in the form PublicSecurityScheme field (also see [ WOT-PROTOCOL-BINDING ]) the provided schema reflects the payload structure of the runtime data of the Property , Action , and Event .

Let's consider the simple data type defintion as shown in Example 11. When the Raw public key asymmetric key security configuration ("scheme": "public").

Field Name Description Mandatory Default value Type
integer identity being exchanged is 184, data serialization in JSON format will look like the following: Example 14 Pre-shared key identity. no . 184 The snippet in the above example is a valid JSON document according to the syntax defined in [ string RFC7159 ], which allows sending simple types in the root of the document. There is no need for wrapping a single value into an object. The same data (i.e. a number equal to 184) will look like the following when the data is exchanged in XML. Example 15

<span class= "hljs-tag"><<span class= "hljs-name">integer184<span class= "hljs-tag"></<span class= "hljs-name"> integer > 5.4.9 OAuth2SecurityScheme 6.5.2 Structured Data Definition

With OAuth2 authentication security configuration ("scheme": "oauth2"). For the type system, it is also possible to define value types that have more than one literal value. The type system provides two distinct constructs to define a structure that can have multiple literal values. One is implicit flow the object , authorizationUrl and scopes are required. For the other one is the array . Both object password and array client flows both tokenUrl and scopes are assigned as required. For the code flow authorizationUrl, tokenUrl, and scopes are required.

Field Name Description Mandatory Default value of Type
type authorizationUrl field in order to indicate the use of those constructs. 6.5.2.1 Object In order to avoid duplicate key definitions with different meanings in URI of the context documents, authorization server. no . object anyURI definitions take a form that is slightly different from that of [ JSON-SCHEMA-VALIDATION ]. The following highlights the differences. TD uses a JSON array with a name
field tokenUrl instead of JSON Schema's properties URI of a JSON object Each object in a the token server. no . field anyURI array must contain the key
name refreshUrl (corresponding to the field name URI of the specified JSON object), and refresh server. no . schema , whose value must be a data schema as specified in the present section (recursive definition) The following example shows a Thing Description anyURI
object scopes definiton using JSON-LD serializiation, Set of authorization scope identifiers, provided as an array. These are provided in comparison with tokens returned by an equivalent JSON Schema object definition. TD authorization server and associated with JSON-LD object definition JSON Schema forms in order to identify what resources a client may access and how. no . array of object string definition
Example 16 { : <span class= "hljs-string">"object", : [{ : <span class= "hljs-string">"id", : { : <span class= "hljs-string">"integer" } }], : [<span class= "hljs-string">"id"] } flow Authorization flow (one of implicit, password, client, or code). no implicit Example 17 { : <span class= "hljs-string">"object", : { : {<span class= "hljs-attr">"type": <span class= "hljs-string">"integer"} }, : [<span class= "hljs-string">"id"] } string
The following is an example inputSchema definition that declares the value to be an object consisting of two named literals brightness (of type integer ) and name (of type string ) where

5.4.10 brightness APIKeySecurityScheme is required to be present. Example 18 : { : <span class= "hljs-string">"object", : [ { : <span class= "hljs-string">"brightness", : { <span class= "hljs-string">"type": <span class= "hljs-string">"integer", <span class= "hljs-string">"@type": [<span class= "hljs-string">"iot:DimmerData"], <span class= "hljs-string">"minimum", <span class= "hljs-string">"maximum": <span class= "hljs-number">255 } }, { : <span class= "hljs-string">"name", : { : <span class= "hljs-string">"string" } } ], : [<span class= "hljs-string">"brightness"] }

JSON-LD representation API key authentication security configuration ("scheme": "apikey"). This is for object data type definition the case where the access token is opaque and is not using a JSON object with terms as defined below. standard token format.

Field Name JSON Construct Description Mandatory Description Default value Type
type string yes "object" has to be assigned to type in for object declaration. field Specifies the location of security authentication information (one of header, query, body, or cookie). array of objects no yes query Each array entry defines within the object one member of the structure by its name (as string) schema (as defined in Simple Data Definition string )
required name array of strings Name for query, header, or cookie parameters. no . Defines which members (associated by member's name ) that are defined within the field string are mandatory or not in an instance.

6.5.2.2 5.4.11 Array Arrays follow again the same convention as defined in [ JSON-SCHEMA-VALIDATION ]. The following is an example value type definition that defines the value to be an array PoPSecurityScheme that consists of exactly three number literals with each value within the range of [ 0 ... 2047 ]. Example 19 : { : <span class= "hljs-string">"array", : { : <span class= "hljs-string">"number", : <span class= "hljs-number">0, : <span class= "hljs-number">2047 }, : <span class= "hljs-number">3, : <span class= "hljs-number">3 }

JSON-LD representation for array type definition is a JSON object with terms as defined below. Proof-of-possession token authentication security configuration ("scheme": "pop").

... ... ...
Field Name JSON Construct Description Mandatory Description Default value Type
type authorizationUrl string URI of the authorization server. yes no . "array" has to be assigned to type anyURI for array declaration.
items alg object Encoding, encryption, or digest algorithm (one of MD5, ES256, or ES512-256). yes no ES256 Defines characteristics of the array items by its underlying type string (assignment as defined in Simple Types or Structured Data Definition ) (optional) one or more type restrictions (as defined in Restriction )
minItems format integer Specifies format of security authentication information (one of jwt, jwe, or jws). no Defines the minimum number of itmes that have to be in the array. jwt string
maxItems in integer Specifies the location of security authentication information (one of header, query, body, or cookie). no Defines the maximum number of itmes that the array can provide. header string
name Name for query, header, or cookie parameters. no . Check [ JSON-SCHEMA-VALIDATION string ] for further array restriction terms.

6.5.2.3 6. Runtime Data Serializiation In Thing Description Serialization

Editor's note : JSON-LD 1.1

This is the case first draft that uses JSON-LD 1.1 as a serialization format of an object-based schema decleration the expected instance Thing Description. As that is straightforward and similar handling work in progress, working assumptions are based on the latest Community Draft of JSON-LD 1.1 . A new JSON-LD Working Group has already been chartered . It is planned that this section will conform to JSON Schema the latest working draft of their JSON-LD 1.1 deliverable and only use stable elements.

Thing Description instances are modeled and structured based on Section 5. Information Model . This section defines a TD serialization based on JSON instances. Let's consider Example 18: When [ RFC8259 ].

6.1 Representation Format

The JSON serialization of TDs follows the syntax of JSON-LD 1.1 in order to streamline semantic evaluation. Hence, serializations can be parsed either as raw JSON or with a JSON-LD 1.1 processor.

In order to enable this convergence, all vocabulary terms defined in Section 5. Information Model will have a JSON key representation.

In addition, Thing Description instances MAY contain JSON-LD 1.1 keywords such as brightness @context number and the name string values being exchanged @type .

The data types of the vocabulary as defined in Section 5.3 Data Schema Vocabulary Definition will be transformed to JSON-based types. The following rules are 200 used for vocabulary terms based on some simple type definitions:

All vocabulary terms in Section 5. Information Model associated with more complex class-based types are defined separately for structured JSON format will look like type transformation in the following. following subsections.

Example 20 6.1.1 Thing as a whole { : <span class= "hljs-number">200, : <span class= "hljs-string">"Web of Things" }

The above data will look root object of a Thing Description instance MAY include the following when @context key from JSON-LD 1.1 with the data is exchanged in XML. value URI of the Thing description context file http://www.w3.org/ns/td .

{      "@context": 
"hljs-string">"http://www.w3.org/ns/td",
    ...
}
Editor's note
<span class= "hljs-tag">< <<span class= "hljs-name">id <<span class= "hljs-name">integer200<span class= "hljs-tag"></ </<span class= "hljs-name">id <<span class= "hljs-name">name <<span class= "hljs-name">stringWeb of Things<span class= "hljs-tag"></ </<span class= "hljs-name">name </<span class= "hljs-name"> object

http://www.w3.org/ns/td uses content negotiation to return the context file. Thus, it must be fetched with an Accept header set to application/ld+json .

When a Thing Description instance is processed and interpreted by a JSON-LD 1.1 processor the @context field MUST be present > (see also Section JSON-LD 1.1 Processing ).

When a single Thing Description instance involves several contexts, additional namespaces with prefixes MUST be appended to the @context array structure. This option proves relevant if one wants to extend the existing Thing Description context without modifying it. For instance:

{
    "@context": ["hljs-string">"http://www.w3.org/ns/td",
                {"iot": "http://iotschema.org/"}],
    ...
}

In both JSON Each mandatory and XML serialization, values can appear in any order regardless of the order used optional field name as defined in the class field Thing definition of MUST be serialized as a JSON key in the root object . of the Thing Description instance.

In the case The type of an array decleration there is the same bahavior from JSON Schema fields properties , actions , and events MUST be a JSON instances. Let's consider Example 19: When object.

The type of the numbers being exchanged are 520, 184 fields links , scopes , and 1314, data serialization in security MUST be a JSON format will look like array.

A TD snippet based on the following. defined fields of the class Thing without the optional field @context is given below:

The above data will look Alternatively, the following when same example can be written instead to explicitly include the data is exchanged in XML. (semantic) keys used by JSON-LD 1.1 ( @context and @type ):

6.5.3 6.1.2 Mapping to XML Schema properties

In Properties (and sub-properties) offered by a Thing MUST be collected in the previous section, examples showed what data whose value type is described using JSON-object based properties field with (unique) Property names as JSON keys.

Each mandatory and optional vocabulary term as defined in the class Property , as well as its two superclasses InteractionPattern and DataSchema , MUST be serialized as a JSON key within a Property object.

The type system look like when of the fields properties and items MUST be serialized to XML in parallel to corresponding as a JSON serializations. object.

This section describes how The type definitions described using of the type system can fields forms , required , and enum , scopes , and security , MUST be mapped serialized as a JSON array.

A TD snippet based on the defined fields is given below:

{
    ...
    "properties": {        "on": {            "label": 
"hljs-string">"On/Off",
            "type": 
"hljs-string">"boolean",
            "forms": [...]
        },
        "status": {            "type": 
"hljs-string">"object",
            "properties": {                "brightness": {                    
"hljs-string">"type": "number",
                    
"hljs-string">"minimum": 0.0,
                    
"hljs-string">"maximum": 100.0
                 },
                 "rgb": {                    
"hljs-string">"type": "array",
                    "items" : {                        
"hljs-string">"type" : "number",
                        
"hljs-string">"minimum": 0,
                        
"hljs-string">"maximum": 255
                    },
                    
"hljs-string">"minItems": 3,
                    
"hljs-string">"maxItems": 3
                }
            },
            
"hljs-string">"required": ["brightness", "rgb"],
            "forms": [...]
        }
    }
    ...
}

Similar to XML schema definitions the case at the Thing level, properties MAY have additional semantic annotations based on JSON-LD 1.1 keywords.

When a Thing Description instance is processed and interpreted by using a JSON-LD 1.1 processor, each property MUST contain the same examples. Given these type definitions, providing vocabulary terms observable and writable due to the mapping open-world assumption of Linked Data. This assumption means that if a Linked Data model of a Thing Description instance were to XML schema allows XML tools omit these vocabulary terms, then the interpreter would not be able to directly validate serialized XML data, for example. The XML structure for which this mapping is designed is make any assumptions about their actual value.

A snippet of a JSON-LD 1.1 processable TD serialization including semantic annotations and the default values of observable and writable based on EXI4JSON [ the class exi-for-json Property ]. is given as follows:

6.5.3.1 Example 8
..."properties": {    "on": {        "@type": 
"hljs-string">"iot:SwitchToggle",
        "label": 
"hljs-string">"On/Off",
        "writable": 
"hljs-literal">false,
        "observable": 
"hljs-literal">false,
        "type": 
"hljs-string">"boolean",
        "forms": [...]
    },
    "status": {        "writable": 
"hljs-literal">false,
        "observable": 
"hljs-literal">false,
        "type": 
"hljs-string">"object",
        "properties": {            "brightness": {                
"hljs-string">"@type": "iot:CurrentLevel",
                
"hljs-string">"type": "number",
                
"hljs-string">"minimum": 0.0,
                
"hljs-string">"maximum": 100.0
            },
            "rgb": {                
"hljs-string">"@type": "iot:rgbData",
                
"hljs-string">"type": "array",
                "items" : {                    
"hljs-string">"type" : "number",
                    
"hljs-string">"minimum": 0,
                    
"hljs-string">"maximum": 255
                },
                
"hljs-string">"minItems": 3,
                
"hljs-string">"maxItems": 3
            }
        },
        "required": [
"hljs-string">"brightness","rgb"],
        "forms": [...]
    }
}
...

6.1.3 Object Definition to XML Schema actions

Shown below is Actions offered by a Thing MUST be collected in the type system JSON-object based object actions definition given for field with (unique) Action names as JSON keys.

Each optional vocabulary term as defined in the class inputSchema Action in Section Object . The and its superclass object InteractionPattern consists MUST be serialized as a JSON key within an Action object.

The type of two named literals the fields id input (of type and integer output MUST be serialized as a JSON object.

The keys of input ) and name output (of type rely on the the class string DataSchema ) where .

The type of the fields id forms , scopes , and security is required to MUST be present. serialized as a JSON array.

A TD snippet based on the defined fields is given below:

{ : <span class=
...
"actions": {
    "fade" {
        "label": "hljs-string">"Fade in/out",
        
"hljs-string">"description": "Smooth fade in and out animation.",
        "input": {            "type": "object",
    : [
        {
            : <span class=
"hljs-string">"id",
            : {
              : <span class=
"hljs-string">"integer"
            }

            "properties": {
                "from": {
                    "hljs-string">"type": "integer",
                    
"hljs-string">"minimum": 0,
                    
"hljs-string">"maximum": 100
                },
                "to": {                    
"hljs-string">"type": "integer",
                    
"hljs-string">"minimum": 0,
                    
"hljs-string">"maximum": 100
                },
                
"hljs-string">"duration": {"type": "number"}
            },
            
"hljs-string">"required": ["to","duration"],

        },
        {
            : <span class=
"hljs-string">"name",
            : {
              : <span class=
"hljs-string">"string"
            }
        }
    ],
    : [<span class=
"hljs-string">"id"]

        "output": {"hljs-string">"type": "string"},
        "forms": [...]
    }
    ...

}
...

When Definitions within the object actions is anonymous (i.e. it is field MAY have additional semantic annotations based on JSON-LD 1.1 keywords.

6.1.4 events

Events offered by a Thing MUST be collected in the root, or participates JSON-object based events field with (unique) Event names as JSON keys.

Each optional vocabulary term as defined in the class Event , as well as its two superclasses InteractionPattern and DataSchema , MUST be serialized as a JSON key within an Event object.

The type of the fields array properties definition), and items MUST be serialized as a JSON object.

The type of the above fields object forms , required , and enum , scopes , and security definition transforms to MUST be serialized as a JSON array.

A TD snippet based on the following XML Schema element definition. defined fields is given below:

<span class= "hljs-tag"><<span class= "hljs-name">xs:element <span class= "hljs-attr">name=<span class= "hljs-string">"object" <span class= "hljs-attr">xmlns:xs=<span class= "hljs-string">"http://www.w3.org/2001/XMLSchema" <<span class= "hljs-name">xs:complexType <<span class= "hljs-name">xs:all <<span class= "hljs-name">xs:element <span class= "hljs-attr">name=<span class= "hljs-string">"id" <<span class= "hljs-name">xs:complexType <<span class= "hljs-name">xs:sequence <<span class= "hljs-name">xs:element <span class= "hljs-attr">name=<span class= "hljs-string">"integer" <span class= "hljs-attr">type=<span class= "hljs-string">"xs:integer" </<span class= "hljs-name">xs:sequence </<span class= "hljs-name">xs:complexType </<span class= "hljs-name">xs:element <<span class= "hljs-name">xs:element <span class= "hljs-attr">name=<span class= "hljs-string">"name" <span class= "hljs-attr">minOccurs=<span class= "hljs-string">"0" <<span class= "hljs-name">xs:complexType <<span class= "hljs-name">xs:sequence <<span class= "hljs-name">xs:element <span class= "hljs-attr">name=<span class= "hljs-string">"string" <span class= "hljs-attr">type=<span class= "hljs-string">"xs:string" </<span class= "hljs-name">xs:sequence </<span class= "hljs-name">xs:complexType </<span class= "hljs-name">xs:element </<span class= "hljs-name">xs:all </<span class= "hljs-name">xs:complexType </<span class= "hljs-name"> xs:element >
...
"event": {
    "overheated": {
        "type": "hljs-string">"object",
        "properties": {            
"hljs-string">"temperature": { "type": "number" }
        },
        "forms": [...]
    }
    ...
}
...

Otherwise (i.e. Definitions within the object events is a member of another field MAY have additional semantic annotations based on JSON-LD 1.1 keywords.

6.1.5 object forms definition, thus has a name),

Each mandatory and optional vocabulary term as defined in the class object Form definition transforms to the following XML schema element definition. Note , MUST be serialized as a JSON key.

If required, forms MAY be supplemented with protocol-specific vocabulary terms identified with a prefix. See also [ $name WOT-PROTOCOL-BINDING ].

When a Thing Description instance is processed and interpreted by a JSON-LD 1.1 processor, each forms represents (array) entry MUST contain a mediaType due to the name open-world assumption of the object , and needs Linked Data. This assumption means that if a Linked Data model of a Thing Description instance were to be replaced by omit these vocabulary terms, then the interpreter would not be able to make any assumptions about their actual name of value.

A TD snippet based on the object . defined fields is given below:

<span class= "hljs-tag"><<span class= "hljs-name">xs:element <span class= "hljs-attr">name=<span class= "hljs-string">"$name" <span class= "hljs-attr">xmlns:xs=<span class= "hljs-string">"http://www.w3.org/2001/XMLSchema" <<span class= "hljs-name">xs:complexType <<span class= "hljs-name">xs:sequence <<span class= "hljs-name">xs:element <span class= "hljs-attr">name=<span class= "hljs-string">"object" <<span class= "hljs-name">xs:complexType <<span class= "hljs-name">xs:all <<span class= "hljs-name">xs:element <span class= "hljs-attr">name=<span class= "hljs-string">"id" <<span class= "hljs-name">xs:complexType <span class= "hljs-tag"><<span class= "hljs-name">xs:sequence <span class= "hljs-tag"><<span class= "hljs-name">xs:element <span class= "hljs-attr">name=<span class= "hljs-string">"integer" <span class= "hljs-attr">type=<span class= "hljs-string">"xs:integer" <span class= "hljs-tag"></<span class= "hljs-name">xs:sequence <span class= "hljs-tag"></ </<span class= "hljs-name">xs:element <<span class= "hljs-name">xs:element <span class= "hljs-attr">name=<span class= "hljs-string">"name" <span class= "hljs-attr">minOccurs=<span class= "hljs-string">"0" <<span class= "hljs-name">xs:complexType <span class= "hljs-tag"><<span class= "hljs-name">xs:sequence <span class= "hljs-tag"><<span class= "hljs-name">xs:element <span class= "hljs-attr">name=<span class= "hljs-string">"string" <span class= "hljs-attr">type=<span class= "hljs-string">"xs:string" <span class= "hljs-tag"></<span class= "hljs-name">xs:sequence <span class= "hljs-tag"></ </<span class= "hljs-name">xs:element </<span class= "hljs-name">xs:all </<span class= "hljs-name">xs:complexType </<span class= "hljs-name">xs:element </<span class= "hljs-name">xs:sequence </<span class= "hljs-name">xs:complexType </<span class= "hljs-name"> xs:element >
...
"forms": [{
    "href" : "hljs-string">"http://mytemp.example.com:5683/temp",
    "mediaType": 
"hljs-string">"application/json",
    
"hljs-string">"http:methodName": "POST",
    "rel": 
"hljs-string">"writeProperty",
    "security": [{
"hljs-string">"scheme":"basic", "in":"header"}]
}]
...

6.1.7 security

Each mandatory and optional vocabulary term as defined in the class inputSchema SecurityScheme , MUST be serialized as a JSON key.

The following TD snippet shows a simple security configuration specifying basic username/password authentication in Section Array . the header. The value of array in consists given is actually the default value of exactly three number literals header .

..."security": [{    "scheme": 
"hljs-string">"basic",
    "in": 
"hljs-string">"header"
}]
...

Here is a more complex example: a TD snippet showing digest authentication on a proxy combined with each value within bearer token authentication on an endpoint. Here the default value range of [ 0 ... 2047 ]. in in the digest scheme, header , is implied.

{ : <span class= "hljs-string">"array", : { : <span class= "hljs-string">"number", : <span class= "hljs-number">0, : <span class= "hljs-number">2047
...
"security": [
    {
       "scheme": 
"hljs-string">"digest",
       "proxyUrl": 
"hljs-string">"https://portal.example.com/"

    },
     : <span class=
"hljs-number">3,
     : <span class=
"hljs-number">3
}

    {
       "scheme": 
"hljs-string">"bearer",
       "format": 
"hljs-string">"jwt",
       "alg": 
"hljs-string">"ES256",
       
"hljs-string">"authorizationUrl": "https://servient.example.com:8443/"
    }
]
...

When Security definitions can be given at more than one level. In this case, definitions at the lower levels override (completely replace) the definitions at the higher level.

Security configuration is mandatory. Every form in a Thing MUST have a security configuration either provided in the form itself, at the interaction level directly above it (if security is not configured in the form), or at the Thing level (if security is not configured in either the form or at the interaction level). In the vocabulary defined above, note that array security is anonymous (i.e. it marked as non-mandatory. However, this is only true locally (at a specific level), and only if the root, security is configured at a higher or participates lower level. In other words, a security configuration must be provided at some level for each form.

Security configuration is considered binding. The security configuration metadata provided in another a Thing Description MUST accurately reflect the security requirements of the Thing. Some protocols can ask for authentication dynamically. If a protocol asks for a form of security credentials not declared in the Thing Description then the Thing Description is to be considered invalid.

The array nosec definition), security scheme is provided for the case that no security is needed. The minimal security configuration for a Thing is configuration of the above array nosec definition transforms to security scheme at the top level, as in the following XML Schema element definition. example:

Otherwise (i.e. To give a more complex example, suppose we have a Thing where all interactions require basic authentication except for one interaction for which no authentication is required. In the following, the array nosec is a member of an scheme for the security configuration in the object overheating definition, thus has a name), event to indicate no authentication is required. For the array status definition transforms to property and the following XML schema element definition. Note toggle action, however, basic authentication is required as defined at the top level of the Thing.

$name Example 16 represents
{
    ...
    "security": [{
"hljs-string">"scheme": "basic"}],
    "properties": {        "status": {
            ...
            "forms": [{                
"hljs-string">"href": "https://mylamp.example.com/status",
                
"hljs-string">"mediaType": "application/json",
            }]
        }
    },
    "actions": {        "toggle": {
            ...
            "forms": [{                
"hljs-string">"href": "https://mylamp.example.com/toggle",
                
"hljs-string">"mediaType": "application/json"
            }]
        }
    },
    "events": {        "overheating": {
            ...
            "forms": [{                
"hljs-string">"href": "https://mylamp.example.com/oh",
                
"hljs-string">"mediaType": "application/json",
                
"hljs-string">"security": [{"scheme": "nosec"}] 
            }]
        }
    }
}

Security definitions can also can be given for different elements at the name same level. This may be required for devices that support multiple protocols, for example CoAP and HTTP, with support for different security mechanisms. This is also useful when alternative authentication mechanisms are allowed. Here is a TD snippet demonstrating three possible ways to access a resource: via HTTPS with basic authentication, via HTTPS via digest authentication, or via CoAPS with an API key. In other words, the use of multiple security configurations at the same level provides a way to combine security mechanisms an in "OR" fashion. In contrast, putting multiple security configurations in the same array , and needs security field combines them in an "AND" fashion, since in that case they would all need to be replaced by satisfied to allow access to the actual name resource.

..."properties": {    "status": {
        ...
        "forms": [
            {
                
"hljs-string">"href": "https://mylamp.example.com/status",
                
"hljs-string">"mediaType": "application/json",
                
"hljs-string">"security": [{"scheme": "basic"}]
            },
            {
                
"hljs-string">"href": "https://mylamp.example.com/status",
                
"hljs-string">"mediaType": "application/json",
                
"hljs-string">"security": [{"scheme": "digest"}]
            },
            {
                
"hljs-string">"href": "coaps://mylamp.example.com:5683/status",
                
"hljs-string">"mediaType": "application/json",
                
"hljs-string">"security": [{"scheme": "apikey"}]
            }
        ]
    }
},
...

6.2 Media Type

The JSON-based serialization of the TD is identified by the media type [ MEDIATYPES ] array application/td+json .

Example 29 Editor's note : CoAP Content Format
<span class= "hljs-tag"><<span class= "hljs-name">xs:element <span class= "hljs-attr">name=<span class= "hljs-string">"$name" <span class= "hljs-attr">xmlns:xs=<span class= "hljs-string">"http://www.w3.org/2001/XMLSchema" <<span class= "hljs-name">xs:complexType <<span class= "hljs-name">xs:sequence <<span class= "hljs-name">xs:element <span class= "hljs-attr">name=<span class= "hljs-string">"array" <<span class= "hljs-name">xs:complexType <<span class= "hljs-name">xs:sequence <<span class= "hljs-name">xs:element <span class= "hljs-attr">name=<span class= "hljs-string">"double" <span class= "hljs-attr">minOccurs=<span class= "hljs-string">"3" <span class= "hljs-attr">maxOccurs=<span class= "hljs-string">"3" <<span class= "hljs-name">xs:simpleType <span class= "hljs-attr">name=<span class= "hljs-string">"minInclusive" <span class= "hljs-tag"><<span class= "hljs-name">xs:restriction <span class= "hljs-attr">base=<span class= "hljs-string">"xs:double" <span class= "hljs-tag"><<span class= "hljs-name">xs:minInclusive <span class= "hljs-attr">value=<span class= "hljs-string">"0" <span class= "hljs-tag"><<span class= "hljs-name">xs:maxInclusive <span class= "hljs-attr">value=<span class= "hljs-string">"2047" <span class= "hljs-tag"></<span class= "hljs-name">xs:restriction <span class= "hljs-tag"></ </<span class= "hljs-name">xs:element </<span class= "hljs-name">xs:sequence </<span class= "hljs-name">xs:complexType </<span class= "hljs-name">xs:element </<span class= "hljs-name">xs:sequence </<span class= "hljs-name">xs:complexType </<span class= "hljs-name"> xs:element

CoAP-based WoT implementations can use the experimental Content-Format 65100 until a proper identifier has been registered.

The media type application/td+json MUST be also associated with the JSON-LD context http://www.w3.org/ns/td . > That means that this media type can also be used for contextual identification of the vocabulary within a (simplified) TD instance that may omit the @context key term.

Editor's note : IANA Considerations

Neither the application/td+json media type nor a CoAP Content-Format identifier have been registered with IANA yet.

6.6 6.3 Parsing Implementation Notes

6.3.1 JSON Processing

To parse The minimum requirement to read the content of a valid Thing Description instance is a simple JSON-based parser and tools can (simple) JSON parser.

If the key terms writable and/or observable are not present within a properties definition, the default value defined in 5. Information Model MUST be used to retrieve assumed.

If the content. mediaType key term is not present within a forms definition, the default value as defined in 5. Information Model MUST be assumed.

To validate the semantic meaning and follow references to external context vocabulary, vocabulary terms (e.g., iot.schema.org), use of JSON-LD or RDF-based parsing tools and libraries are is highly recommended. recommended as explained in the next sub-section.

6.7 6.3.2 Examples JSON-LD 1.1 Processing

In To interpret the following, we give examples semantic meaning of full TDs. The first one, a temperature sensor, shows how to define relations between Thing Properties. As a second example, we modeled an actuator (LED lamp) where Actions have all been characterized semantically, so that machines could unambiguously interpret them Description in an automated manner. At last, association between Things is shown by defining terms of RDF triples, a master switch controlling other LED lamps. Thing Description instance first requires a valid JSON-LD 1.1 representation based on this Thing Description specification. Then this representation can be passed to a JSON-LD 1.1 processor.

6.7.1 Temperature Sensor Example 30 { : [<span class= "hljs-string">"https://w3c.github.io/wot/w3c-wot-td-context.jsonld", <span class= "hljs-string">"https://w3c.github.io/wot/w3c-wot-common-context.jsonld"], : [<span class= "hljs-string">"Sensor"], : <span class= "hljs-string">"myTempSensor", : <span class= "hljs-string">"coap:///www.example.com:5683/temp/", : [ { : [<span class= "hljs-string">"Property",<span class= "hljs-string">"Temperature"], : <span class= "hljs-string">"threshold", : <span class= "hljs-string">"myTemp", : { : <span class= "hljs-string">"number" }, : <span class= "hljs-literal">false, : <span class= "hljs-literal">true, : [{ : <span class= "hljs-string">"val", : <span class= "hljs-string">"application/json" }] }, { : [<span class= "hljs-string">"Property",<span class= "hljs-string">"Temperature"], : <span class= "hljs-string">"myThreshold", : { : <span class= "hljs-string">"number" }, : <span class= "hljs-literal">true, : [{ : <span class= "hljs-string">"thr", : <span class= "hljs-string">"application/json" }] }, { : [<span class= "hljs-string">"Event"], : { <span class= "hljs-attr">"type": <span class= "hljs-string">"number" }, : <span class= "hljs-string">"myChange", : <span class= "hljs-string">"temp", : [{ : <span class= "hljs-string">"val/changed", : <span class= "hljs-string">"application/json" }] }, { : [<span class= "hljs-string">"Event"], : { <span class= "hljs-attr">"type": <span class= "hljs-string">"number" }, : <span class= "hljs-string">"myWarning", : [{ : <span class= "hljs-string">"val/high", : <span class= "hljs-string">"application/json" }] } ] }

The following pre-processing steps of a Thing Description instance must be executed before starting JSON-LD 1.1 processing:

  • Before starting JSON-LD 1.1 processing of a Thing Description instance, there MUST be a myTempSensor defines two Properties: myTemp @context and myThreshold . Both are key from JSON-LD 1.1 as defined in Section 6.1.1 Thing as temperatures. A client that is able to parse a TD only needs to know the predicate reference to understand that the threshold acts as whole .
  • Before starting JSON-LD 1.1 processing of a reference value for myTemp while the latter is Thing Description instance, all external vocabulary terms used in the actual value measured by Thing Description MUST provide their context URIs as prefix or within the temperature sensor. Here, reference @context points to field. http://schema.org/valueReference
  • . Moreover, one of the Events Before starting JSON-LD 1.1 processing of the a Thing is linked to the measured value (with the predicate property ). It means Description instance, all mandatory vocabulary terms as defined in Section 5. Information Model that context that an event should be triggered each time myTemp changes. The other Event does not define further semantics. It could be used either in a closed system (where clients are aware of its meaning) or by a human but missing from the instance MUST be inserted explicitly with their default value.

Section 1. Introduction shows an external agent example of how the input and output of such preprocessing would not have sufficient information to interpret it. appear.

7. Example Thing Description Instances

6.7.2 7.1 LED Master Switch MyLampThing Example

Example 31 18 : MyLampThing represented as a compact JSON serialization
{
  : [<span class=
"hljs-string">"https://w3c.github.io/wot/w3c-wot-td-context.jsonld",
               <span class=
"hljs-string">"https://w3c.github.io/wot/w3c-wot-common-context.jsonld"],
  : [<span class=
"hljs-string">"Lamp"],
  : <span class=
"hljs-string">"myMasterLED",
  : [
    {
      : [<span class=
"hljs-string">"Action", <span class=
"hljs-string">"Toggle"],
      : <span class=
"hljs-string">"myMasterOnOff",
      : {
        : [<span class=
"hljs-string">"OnOff"],
        : <span class=
"hljs-string">"boolean"
      },
      : [
        {
           : <span class=
"hljs-string">"coap://www.example.com:5683/master",
          : <span class=
"hljs-string">"application/json"
        },
        {
           : <span class=
"hljs-string">"http://www.example.com:80/master",
          : <span class=
"hljs-string">"application/json"

    "id": "hljs-string">"urn:dev:wot:com:example:servient:lamp",
    "name": 
"hljs-string">"MyLampThing",
    "description" : 
"hljs-string">"MyLampThing uses JSON-LD 1.1 serialization",
    "security": [{
"hljs-attr">"scheme": "psk"}],
    "properties": {        "status": {            
"hljs-attr">"description" : "Shows the current status of the lamp",
            "type": 
"hljs-string">"string",
            "forms": [{                "href": 
"hljs-string">"coaps://mylamp.example.com/status"
            }]
        }
    },
    "actions": {        "toggle": {            
"hljs-attr">"description" : "Turn on or off the lamp",
            "forms": [{                "href": 
"hljs-string">"coaps://mylamp.example.com/toggle"
            }]
        }
    },
    "events": {        "overheating": {            
"hljs-attr">"description" : "Lamp reaches a critical temperature (overheating)",
            "type": 
"hljs-string">"string",
            "forms": [{                "href": 
"hljs-string">"coaps://mylamp.example.com/oh"
            }]

        }
      ]

    }
  ]

}
Editor's note Example 19 : MyLampThing with semantic annotations based on a valid JSON-LD 1.1 representation
In this last example, it would be good to illustrate the use of associations . The Thing we modeled here acts as a master switch for eight lamps. This means switching on and off myMasterOnOff will propagate to all associated Things by toggling their Action that is also of type Toggle . No precise semantics for associations have been defined yet and there might exist many other kinds of dependency between Things than simply parent/child relations. This issue will be addressed soon. Until then, Thing associations could be useful for discovery.
{
    "@context": ["hljs-string">"http://www.w3.org/ns/td", 
                {"iot": "http://iotschema.org/"}],
    "@type" : 
"hljs-string">"Thing",
    "id": 
"hljs-string">"urn:dev:wot:com:example:servient:lamp",
    "name": 
"hljs-string">"MyLampThing",
    "description" : 
"hljs-string">"MyLampThing uses JSON-LD 1.1 serialization",
    "security": [{
"hljs-attr">"scheme": "psk"}],
    "properties": {        "status": {            "@type" : 
"hljs-string">"iot:SwitchStatus",
            
"hljs-attr">"description" : "Shows the current status of the lamp",
            "writable": 
"hljs-literal">false,
            
"hljs-attr">"observable": false,
            "type": 
"hljs-string">"string",
            "forms": [{                "href": 
"hljs-string">"coaps://mylamp.example.com/status",
                
"hljs-attr">"mediaType": "application/json"
            }]
        }
    },
    "actions": {        "toggle": {            "@type" : 
"hljs-string">"iot:SwitchStatus",
            
"hljs-attr">"description" : "Turn on or off the lamp",
            "forms": [{                "href": 
"hljs-string">"coaps://mylamp.example.com/toggle",
                
"hljs-attr">"mediaType": "application/json"
            }]
        }
    },
    "events": {        "overheating": {            "@type" : 
"hljs-string">"iot:TemperatureAlarm",
            
"hljs-attr">"description" : "Lamp reaches a critical temperature (overheating)",
            "type": 
"hljs-string">"string",
            "forms": [{                "href": 
"hljs-string">"coaps://mylamp.example.com/oh",
                
"hljs-attr">"mediaType": "application/json"
            }]
        }
    }
}

7. 8. Security and Privacy Considerations

Editor's note

Please see the WoT Security and Privacy repository for work in progress regarding threat models, assets, risks, recommended mitigations, and best practices for security and privacy for systems using the Web of Things. Once complete, security and privacy considerations relevant to Thing Descriptions will be summarized in this section.

A. JSON Schema for TD Instance Validation

Below is a JSON Schema [ JSON-SCHEMA-VALIDATION ] for syntactically validating Thing Description instances serialized in JSON-LD 1.1.
Editor's note

This schema is known to be too permissive. This issue will be resolved in the next release of this document.

{
  "title": "WoT TD Schema for Bundang Plug Fest",
  "description": "JSON Schema representation of the TD serialization format.",
  "$schema ": "http://json-schema.org/draft-06/schema#",
  "type": "object",
  "properties": {
    "base": {
      "$ref": "#/definitions/url"
    },
    "@type": {
      "$ref": "#/definitions/type_declaration"
    },
    "@context": {
      "$ref": "#/definitions/context"
    },
    "name": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "properties": {
      "type": "object",
      "items": {
        "$ref": "#/definitions/properties"
      }
    },
    "actions": {
      "type": "object",
      "items": {
        "$ref": "#/definitions/actions"
      }
    },
    "events": {
      "type": "object",
      "items": {
        "$ref": "#/definitions/events"
      }
    },
    "links": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/links"
      }
    },
    "support": {
      "type": "string"
    },
    "security": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/securityScheme"
      }
    }
  },
  "required": [
    "name",
    "id"
  ],
  "additionalProperties": true,
  "definitions": {
    "context": {
      "oneOf": [
        {
          "type": "array",
          "items": {
            "anyOf": [
              {
                "$ref": "#/definitions/url"
              },
              {
                "type": "object"
              }
            ]
          },
          "contains": {
            "type": "string",
            "enum": [
              "https://w3c.github.io/wot-thing-description/context/td-context.jsonld",
              "http://www.w3.org/ns/td"
            ]
          }
        },
        {
          "type": "string",
          "enum": [
            "https://w3c.github.io/wot-thing-description/context/td-context.jsonld",
            "http://www.w3.org/ns/td"
          ]
        }
      ]
    },
    "type_declaration": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "array"
        }
      ]
    },
    "form_declaration": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/form_element"
      }
    },
    "form_element": {
      "type": "object",
      "properties": {
        "href": {
          "$ref": "#/definitions/url"
        },
        "rel": {
          "type": "string"
        },
        "mediaType": {
          "type": "string"
        },
        "subProtocol": {
          "type": "string"
        },
        "security": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/securityScheme"
          }
        },
        "scopes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "href"
      ],
      "additionalProperties": true
    },
    "properties": {
      "additionalProperties": {
        "type": "object",
        "items": {
          "$ref": "#/definitions/property_element"
        }
      }
    },
    "actions": {
      "additionalProperties": {
        "type": "object",
        "items": {
          "$ref": "#/definitions/action_element"
        }
      }
    },
    "events": {
      "additionalProperties": {
        "type": "object",
        "items": {
          "$ref": "#/definitions/event_element"
        }
      }
    },
    "property_element": {
      "type": "object",
      "properties": {
        "description": {
          "type": "string"
        },
        "@type": {
          "$ref": "#/definitions/type_declaration"
        },
        "label": {
          "type": "string"
        },
        "writable": {
          "type": "boolean"
        },
        "observable": {
          "type": "boolean"
        },
        "forms": {
          "$ref": "#/definitions/form_declaration"
        },
        "security": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/securityScheme"
          }
        },
        "scopes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [],
      "additionalProperties": true
    },
    "action_element": {
      "type": "object",
      "properties": {
        "description": {
          "type": "string"
        },
        "@type": {
          "$ref": "#/definitions/type_declaration"
        },
        "label": {
          "type": "string"
        },
        "forms": {
          "$ref": "#/definitions/form_declaration"
        },
        "input": {
          "$ref": "#/definitions/data"
        },
        "output": {
          "$ref": "#/definitions/data"
        },
        "security": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/securityScheme"
          }
        },
        "scopes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [],
      "additionalProperties": true
    },
    "event_element": {
      "type": "object",
      "properties": {
        "description": {
          "type": "string"
        },
        "@type": {
          "$ref": "#/definitions/type_declaration"
        },
        "label": {
          "type": "string"
        },
        "forms": {
          "$ref": "#/definitions/form_declaration"
        },
        "security": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/securityScheme"
          }
        },
        "scopes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [],
      "additionalProperties": true
    },
    "links": {
      "type": "object",
      "properties": {
        "anchor": {
          "$ref": "#/definitions/url"
        },
        "href": {
          "$ref": "#/definitions/url"
        },
        "rel": {
          "type": "string"
        },
        "mediatype": {
          "type": "string"
        }
      },
      "required": [
        "href"
      ],
      "additionalProperties": true
    },
    "securityScheme": {
      "type": "object"
    },
    "url": {
      "type": "string",
      "format": "uri",
      "pattern": "(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(([^#]*))?(#(.*))?"
    },
    "jsonld_url": {
      "type": "string",
      "format": "uri",
      "pattern": "http://[^/?#]*|https://[^/?#]*"
    },
    "data": {
      "title": "Data type",
      "anyOf": [
        {
          "description": "URI of an XSD built-in type",
          "type": "string"
        },
        {
          "description": "URI and media type for a complex type (XSD, SenML...)",
          "type": "object",
          "properties": {
            "name": {
              "type": "string"
            },
            "href": {
              "type": "string"
            },
            "mediatype": {
              "type": "string"
            }
          },
          "required": [
            "name",
            "href",
            "mediatype"
          ]
        },
        {
          "$ref": "http://json-schema.org/draft-06/schema#"
        }
      ]
    },
    "dataSchema": {
      "type": "object",
      "properties": {
        "description": {
          "type": "string"
        },
        "enum": {
          "type": "array",
          "items": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "boolean"
              },
              {
                "type": "object"
              },
              {
                "type": "number"
              },
              {
                "type": "array"
              }
            ]
          }
        },
        "type": {
          "type": "string",
          "enum": [
            "string",
            "boolean",
            "object",
            "number",
            "array"
          ]
        }
      }
    }
  }
}

B. Recent Specification Changes A.1

Changes from First Second Public Working Draft

Changes from First Public Working Draft

Changes from First Public Working Draft are described in the Second Public Working Draft

B. C. Acknowledgements Acknowledgments

This document contains a significant contribution from Web of Things members: ... The editors would like to thank Dave Raggett, Matthias Kovatsch, Michael McCool, Michael Koster, Victor Charpenay, Kawaguchi Toru, Michael Lagally, Kazuyuki Ashimura, María Poveda, Daniel Peintner, Ben Francis for their contributions, comments, and guidance.

C. D. References

C.1 D.1 Normative references

[MEDIATYPES]
Media Types . IANA. URL: https://www.iana.org/assignments/media-types/media-types.xhtml
[RFC2119]
Key words for use in RFCs to Indicate Requirement Levels . S. Bradner. IETF. March 1997. Best Current Practice. URL: https://tools.ietf.org/html/rfc2119
[RFC3986]
Uniform Resource Identifier (URI): Generic Syntax . T. Berners-Lee; R. Fielding; L. Masinter. IETF. January 2005. Internet Standard. URL: https://tools.ietf.org/html/rfc3986
[RFC7159]
[RFC8259]
The JavaScript Object Notation (JSON) Data Interchange Format . T. Bray, Ed.. IETF. March 2014. Proposed December 2017. Internet Standard. URL: https://tools.ietf.org/html/rfc7159 https://tools.ietf.org/html/rfc8259
[WOT-ARCHITECTURE]
Web of Things Architecture . Kazuo Kajimoto; Matthias Kovatsch; Uday Davuluru. W3C. 20 August 2017. URL: https://w3c.github.io/wot-architecture/
[WOT-PROTOCOL-BINDING]
Web of Things Protocol Binding Templates . Michael Koster. W3C. 12 January 2018. URL: https://w3c.github.io/wot-binding-templates/

C.2 D.2 Informative references [exi-for-json] EXI for JSON (EXI4JSON) . Daniel Peintner; Don Brutzman. W3C. 23 August 2016. W3C Working Draft. URL: https://www.w3.org/TR/exi-for-json/ [JSON-SCHEMA-CORE] JSON Schema: A Media Type for Describing JSON Documents . Austin Wright; Henry Andrews. IETF. Internet-Draft. URL: https://tools.ietf.org/html/draft-handrews-json-schema-00

[JSON-SCHEMA-VALIDATION]
JSON Schema Validation: A Vocabulary for Structural Validation of JSON . Austin Wright; Henry Andrews; Geraint Luff. IETF. Internet-Draft. URL: https://tools.ietf.org/html/draft-handrews-json-schema-validation-00
[OPENAPI]
OpenAPI Specification: Version 3.0.1 . Darrel Miller; Jason Harmon; Jeremy Whitlock; Kris Hahn; Marsh Gardiner; Mike Ralphson; Rob Dolin; Ron Ratovsky; Tony Tam. OpenAPI Initiative, Linux Foundation. 7 December 2017. URL: https://swagger.io/specification/