Copyright © 2017-2018 W3C ® ( MIT , ERCIM , Keio , Beihang ). W3C liability , trademark and permissive document license rules apply.
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 .
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.
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.
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 .
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
.
{
: [<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
structure
by
the
form
forms
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
pattern
enables
a
mechanism
for
asynchronous
messages
to
be
sent
by
a
Thing.
Here,
a
subscription
model.
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
.
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.
{
: [<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"
}]
}
]
}]
}
}
}
For
more
examples,
including
the
samples
provided
in
use
of
other
protocols
besides
HTTP,
see
Section
6.7.
7.
Example
Thing
Description
Instances
.
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.
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).
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 .
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.
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.
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.
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
.
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.
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 |
|
Default
value
|
Type |
---|---|---|---|---|
|
| yes | . |
|
|
| no | . |
|
|
|
yes | . |
|
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
].
|
no | . |
anyURI
|
|
| no | . |
Property
|
actions
|
All
Action-based
interaction
| no | . |
Action
|
events
| All Event-based interaction patterns of the Thing. | no | . |
Event
|
links
|
Provides
Web
links
to
arbitrary
resources
that
relate
to
|
no | . |
array
of
Link
|
| 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
|
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 |
|
Default
value
|
Type |
---|---|---|---|---|
|
Indicates
one
or
more
endpoints
from
which
an
interaction
pattern
is
|
yes | . |
array
of
Form
|
|
| no | . |
string
|
description
| Provides additional (human) readable information. | no | . |
string
|
security
|
Set
of
security
configurations,
provided
as
an
array,
that
must
all
be
| 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:
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 |
|
Default
value
|
Type |
---|---|---|---|---|
|
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
| no | false |
boolean
|
Property
instances
may
also
be
instances
of
the
class
DataSchema
and
therefore
can
contain,
among
others,
the
type
term.
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 |
|
Default
value
|
Type |
---|---|---|---|---|
|
|
no | . |
DataSchema
|
|
|
no | . |
DataSchema
|
Event
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.
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
.
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 |
|
Default
value
|
Type |
---|---|---|---|---|
href
|
URI
of
the
endpoint
where
an
interaction
pattern
is
| yes | . |
anyURI
|
mediaType
|
Assign
the
underlying
media
type
[
MEDIATYPES
]
of
| 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
The
value
of
the
|
no | . |
string
(one
of
|
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
|
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
|
Link
A
Web
link,
as
specified
by
IETF
RFC
8288
(
https://tools.ietf.org/html/rfc8288)
.
(https://tools.ietf.org/html/rfc8288).
Field Name | Description |
|
Default
value
|
Type |
---|---|---|---|---|
|
URI
of
the
endpoint
where
an
interaction
pattern
is
| yes | . |
anyURI
|
mediaType
|
Assign
the
underlying
media
type
[
MEDIATYPES
]
of
| 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
| no | . |
string
|
|
By
default,
the
context
of
a
link
is
the
| no | . |
anyURI
|
DataSchema
Field Name |
|
Mandatory |
| Type |
---|---|---|---|---|
description
|
|
| . |
string
|
type
|
|
no | . |
string
(one
of
|
const
|
|
no | . |
field
|
enum
|
|
no | . |
array
of
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:
@context
ArraySchema
BooleanSchema
@context
IntegerSchema
NumberSchema
ObjectSchema
StringSchema
Property
ArraySchema
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").
Field Name |
|
Mandatory |
| Type |
---|---|---|---|---|
items
|
|
| . |
|
minItems
|
|
|
. |
unsignedInt
|
maxItems
|
|
no | . |
unsignedInt
|
Action
ObjectSchema
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 |
|
Mandatory |
| Type |
---|---|---|---|---|
properties
|
|
| . |
|
required
|
|
no | . |
string
|
BooleanSchema
A JSON boolean value specification ("type": "boolean").
NumberSchema
A JSON number value specification ("type": "number").
Field Name | Description | Mandatory | Default value | Type |
---|---|---|---|---|
minimum
|
|
no | . |
double
|
maximum
|
|
no | . |
double
|
StringSchema
A
JSON
field
described
in
the
above
table.
string
value
specification
("type":
"string").
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
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").
Field Name |
|
Mandatory |
| Type |
---|---|---|---|---|
|
|
|
. |
integer
|
maximum
|
|
no | . |
integer
|
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.
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.
SecurityScheme
Field Name |
|
Mandatory |
| Type |
---|---|---|---|---|
scheme
|
|
yes | . |
string
(one
of
|
description
|
|
| . |
string
|
proxyUrl
|
|
no | . |
|
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:
CertSecurityScheme
alg
)
and
the
issuing
authority
of
the
security
token
(
as
APIKeySecurityScheme
Property
BasicSecurityScheme
Event
BearerSecurityScheme
schema
DigestSecurityScheme
Action
NoSecurityScheme
inputSchema
OAuth2SecurityScheme
outputSchema
PSKSecurityScheme
Property
PoPSecurityScheme
schema
PublicSecurityScheme
NoSecurityScheme
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.
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 |
---|---|---|---|---|
|
Specifies the location of security authentication information (one of header, query, body, or cookie). | no | header |
|
|
Name for query, header, or cookie parameters. | no | . |
|
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 |
|
Mandatory |
| Type |
---|---|---|---|---|
identity
|
|
| . |
string
|
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
| no | auth |
|
|
Specifies
the
| no | header |
string
|
name
| Name for query, header, or cookie parameters. | no | . |
string
|
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.
Field Name |
|
Mandatory |
| Type |
---|---|---|---|---|
authorizationUrl
|
|
no | . |
|
alg
|
|
no |
|
|
format
|
|
no |
|
string
|
in
|
|
no |
|
string
|
name
|
|
no | . |
string
|
inputSchema
PSKSecurityScheme
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 |
|
Mandatory |
| Type |
---|---|---|---|---|
identity
|
|
no | . |
string
|
form
PublicSecurityScheme
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 |
---|---|---|---|---|
|
Pre-shared key identity. | no | . |
string
|
OAuth2SecurityScheme
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
|
Type |
---|---|---|---|---|
|
URI
of
the
| no | . |
|
|
URI
of
| no | . |
|
|
URI
of
the
| no | . |
|
|
Set
of
authorization
scope
identifiers,
provided
as
an
array.
These
are
provided
in
| no | . |
array
of
|
flow
|
Authorization flow (one of implicit, password, client, or code). | no | implicit |
string
|
brightness
APIKeySecurityScheme
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 |
|
Mandatory |
| Type |
---|---|---|---|---|
|
|
|
|
string
|
name
|
|
no | . |
|
array
PoPSecurityScheme
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 |
|
Mandatory |
| Type |
---|---|---|---|---|
authorizationUrl
|
|
| . |
|
alg
|
|
| ES256 |
|
format
|
|
no |
|
string
|
in
|
|
no |
|
string
|
name
|
Name for query, header, or cookie parameters. | no | . |
string
|
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
].
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.
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",
...
}
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:
{
"id": "hljs-string">"urn:dev:wot:com:example:servient:myThing",
"name":
"hljs-string">"MyThing",
"description":
"hljs-string">"Additional (human) readable information of the Thing.",
"support":
"hljs-string">"https://servient.example.com/contact",
"security": [...], "base":
"hljs-string">"https://servient.example.com/",
"properties": {...}, "actions": {...}, "events": {...}, "links": [...]
}
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
):
{
"@context": "hljs-string">"http://www.w3.org/ns/td",
"@type":
"hljs-string">"Thing",
"id":
"hljs-string">"urn:dev:wot:com:example:servient:myThing",
"name":
"hljs-string">"MyThing",
"description":
"hljs-string">"Additional (human) readable information of the Thing.",
"support":
"hljs-string">"https://servient.example.com/contact",
"security": [...], "base":
"hljs-string">"https://servient.example.com/",
"properties": {...}, "actions": {...}, "events": {...}, "links": [...]
}
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.
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:
..."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": [...]
}
}
...
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.
inputSchema
Action
object
InteractionPattern
The
type
of
two
named
literals
the
fields
id
input
(of
type
and
MUST
be
serialized
as
a
JSON
object.
integer
output
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:
...
"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.
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.
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:
...
"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.
object
forms
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:
...
"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"}]
}]
...
links
Shown
below
is
Each
mandatory
and
optional
vocabulary
term
as
defined
in
the
type
system
class
array
Link
definition
,
MUST
be
serialized
as
a
JSON
key.
A
TD
snippet
based
on
the
defined
fields
is
given
for
below:
..."links": [{ "href":
"hljs-string">"https://servient.example.com/things/lampController",
"rel":
"hljs-string">"controlledBy",
"mediaType":
"hljs-string">"application/td+json"
}]
...
security
Each
mandatory
and
optional
vocabulary
term
as
defined
in
the
class
,
MUST
be
serialized
as
a
JSON
key.
inputSchema
SecurityScheme
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.
...
"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
is
array
security
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:
{
"id": "hljs-string">"urn:dev:wot:com:example:servient:myThing",
"name":
"hljs-string">"MyThing",
"description":
"hljs-string">"Additional (human) readable information of the Thing.",
"support":
"hljs-string">"https://servient.example.com/contact",
"security": [{
"hljs-string">"scheme": "nosec"}],
"properties": {...}, "actions": {...}, "events": {...}, "links": [...]
}
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.
{
...
"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
field
combines
them
in
an
"AND"
fashion,
since
in
that
case
they
would
all
need
to
be
array
,
and
needs
security
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"}]
}
]
}
},
...
The
JSON-based
serialization
of
the
TD
is
identified
by
the
media
type
[
MEDIATYPES
]
.
array
application/td+json
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.
Neither
the
application/td+json
media
type
nor
a
CoAP
Content-Format
identifier
have
been
registered
with
IANA
yet.
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.
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.
The following pre-processing steps of a Thing Description instance must be executed before starting JSON-LD 1.1 processing:
myTempSensor
defines
two
Properties:
myTemp
@context
reference
@context
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.
{
: [<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"
}]
}
]
}
]
}
{
"@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"
}]
}
}
}
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.
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" ] } } } } }
@context
and
@type
for
facilitating
semantic
evaluation
of
TDs.
(see
Section
6.1
Representation
Format
)
form
.
writable
,
observable
,
mediaType
)
now
id
for
uniquely
identifying
a
Thing,
and
an
optional
field
support
to
provide
information
about
Thing
Description
maintainer.
label
field
providing
text
for
such
uses
as
user
interfaces.
rel
attribute
for
form
now
has
enumerated
allowable
values
specified.
http://www.w3.org/ns/td
.
Changes from First Public Working Draft are described in the Second Public Working Draft
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.