You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This specification describes an application programming interface (API) representing the <a>WoT Interface</a> that allows scripts to discover, operate <a>Thing</a>s and to expose locally defined <a>Thing</a>s characterized by <a> WoT Interactions</a> specified by a script.
178
172
</p>
179
173
<p>
180
-
The APIs defined in this document deliberately follow the [[[WOT-TD]]] specification closely. It is possible to implement more abstract APIs on top of them, or implementing directly the WoT network facing interface (i.e. the <a>WoT Interface</a>).
174
+
The APIs defined in this document deliberately follow the [[[wot-thing-description11]]] specification closely. It is possible to implement more abstract APIs on top of them, or implementing directly the WoT network facing interface (i.e. the <a>WoT Interface</a>).
181
175
</p>
182
176
<pclass="ednote">
183
177
This specification is implemented at least by the <ahref="https://www.thingweb.io/">Eclipse Thingweb</a>
@@ -380,13 +374,13 @@
380
374
<section><h2>Terminology and conventions</h2>
381
375
<p>
382
376
The generic WoT terminology is defined in [[!wot-architecture11]]: <dfndata-lt="Things">Thing</dfn>, <dfndata-lt="Thing Descriptions">Thing Description</dfn> (in short <dfn>TD</dfn>), <dfn>Partial TD</dfn>, <dfn>Web of Things</dfn> (in short <b><i>WoT</i></b>), <dfn>WoT Interface</dfn>, <dfn>Protocol Bindings</dfn>, <dfn>WoT Runtime</dfn>, <dfndata-lt="consume|consume a TD|consuming a TD">Consuming a Thing Description</dfn>, <dfn>TD Directory</dfn>, <dfndata-lt="Properties">Property</dfn>, <dfndata-lt="Actions">Action</dfn>, <dfndata-lt="Events|WoT-Event">Event</dfn>,
<adata-cite="wot-thing-description11#securityscheme"><dfn>SecurityScheme</dfn></a>, <adata-cite="wot-thing-description11#nosecurityscheme"><dfn>NoSecurityScheme</dfn></a> etc.
386
380
</p>
387
381
<p>
388
382
<dfndata-plurals="WoT Interactions">WoT Interaction</dfn> is a synonym for <adata-cite="wot-architecture11#dfn-interaction-affordance"><dfn>Interaction Affordance</dfn></a>.
389
-
An <a>Interaction Affordance</a> (or shortly, affordance) is the term used in [[!WOT-TD]]
383
+
An <a>Interaction Affordance</a> (or shortly, affordance) is the term used in [[!wot-thing-description11]]
390
384
when referring to <a>Thing</a> capabilities, as explained in
Represents a <a>Thing Description</a> (<a>TD</a>) as
482
-
<adata-cite="WOT-TD#">defined</a> in
483
-
[[!WOT-TD]]. It is expected to be
484
-
a <adata-cite="infra#parse-json-bytes-to-a-javascript-value">parsed JSON object</a> that is validated using <adata-cite="WOT-TD#json-schema-for-validation">JSON Schema validation</a>.
476
+
<adata-cite="wot-thing-description11#">defined</a> in
477
+
[[!wot-thing-description11]]. It is expected to be
478
+
a <adata-cite="infra#parse-json-bytes-to-a-javascript-value">parsed JSON object</a> that is validated using <adata-cite="wot-thing-description11#json-schema-for-validation">JSON Schema validation</a>.
Note that the [[[WOT-TD]]] specification allows using a shortened <a>Thing Description</a>
507
-
by the means of <adata-cite="WOT-TD#sec-default-values">defaults</a> and requiring clients to expand them with default values specified in the
508
-
[[[WOT-TD]]] specification for the properties that are not explicitly defined in a given
500
+
Note that the [[[wot-thing-description11]]] specification allows using a shortened <a>Thing Description</a>
501
+
by the means of <adata-cite="wot-thing-description11#sec-default-values">defaults</a> and requiring clients to expand them with default values specified in the
502
+
[[[wot-thing-description11]]] specification for the properties that are not explicitly defined in a given
509
503
<a>TD</a>.
510
504
</p>
511
505
<div>
512
506
To <dfn>expand a TD</dfn> given |td:ThingDescription|, run the following steps:
513
507
<ol>
514
508
<li>
515
-
For each item in the <adata-cite="WOT-TD#sec-default-values">TD default values</a> table from [[!WOT-TD]], if the term is not defined in |td|, add the term definition with the default value specified in [[!WOT-TD]].
509
+
For each item in the <adata-cite="wot-thing-description11#sec-default-values">TD default values</a> table from [[!wot-thing-description11]], if the term is not defined in |td|, add the term definition with the default value specified in [[!wot-thing-description11]].
516
510
</li>
517
511
</ol>
518
512
</div>
519
513
</section>
520
514
521
515
<section><h3>Validating a Thing Description</h3>
522
516
<p>
523
-
The [[!WOT-TD]] specification defines how a <a>TD</a> should be validated.
517
+
The [[!wot-thing-description11]] specification defines how a <a>TD</a> should be validated.
524
518
Therefore, this API expects the {{ThingDescription}} objects be validated before used as parameters. This specification defines a basic <a>TD</a> validation as follows.
525
519
</p>
526
520
<div>
527
521
To <dfn>validate a TD</dfn> given |td:ThingDescription|, run the following steps:
528
522
<ol>
529
523
<li>
530
-
If <adata-cite="WOT-TD#json-schema-for-validation">JSON Schema
524
+
If <adata-cite="wot-thing-description11#json-schema-for-validation">JSON Schema
531
525
validation</a> fails on |td|, [= exception/throw =] a {{"TypeError"}} and stop.
Let |thing:ConsumedThing| be a new {{ConsumedThing}} object constructed from |td|.
569
563
</li>
570
564
<li>
571
-
Set up the <a>WoT Interactions</a> based on introspecting <a>td</a> as explained in [[!WOT-TD]] and [[!WOT-PROTOCOL-BINDINGS]]. Make a request to the underlying platform to initialize the <a>Protocol Bindings</a>.
565
+
Set up the <a>WoT Interactions</a> based on introspecting <a>td</a> as explained in [[!wot-thing-description11]] and [[!WOT-PROTOCOL-BINDINGS]]. Make a request to the underlying platform to initialize the <a>Protocol Bindings</a>.
572
566
<pclass="ednote">
573
567
Implementations encapsulate the complexity of how to use the
574
568
<a>Protocol Bindings</a> for implementing <a>WoT interactions</a>.
@@ -650,7 +644,7 @@ <h3>Expand an ExposedThingInit</h3>
650
644
</ol>
651
645
</li>
652
646
<li>Search for missing required properties in |td| accordingly to
<adata-cite="ECMASCRIPT#sec-ecmascript-data-types-and-values">ECMAScript value</a> that is accepted for <a>DataSchema</a> defined in [[WoT-TD]].
880
+
<adata-cite="ECMASCRIPT#sec-ecmascript-data-types-and-values">ECMAScript value</a> that is accepted for <a>DataSchema</a> defined in [[wot-thing-description11]].
887
881
The possible values MUST be of type <adata-cite="ECMASCRIPT#sec-ecmascript-language-types-null-type">null</a>, <adata-cite="ECMASCRIPT#sec-ecmascript-language-types-boolean-type">boolean</a>, <adata-cite="ECMASCRIPT#sec-ecmascript-language-types-number-type">number</a>, <adata-cite="ECMASCRIPT#sec-ecmascript-language-types-string-type">string</a>, <adata-cite="ECMASCRIPT#sec-array-objects">array</a>, or <adata-cite="ECMASCRIPT#sec-object-type">object</a>.
In conclusion, the WoT WG decided to explore the third option that
4289
-
closely follows the [[[WOT-TD]]] specification. Based on this, a simple
4283
+
closely follows the [[[wot-thing-description11]]] specification. Based on this, a simple
4290
4284
API can also be implemented.
4291
4285
Since Scripting is an optional module in WoT, this leaves room for
4292
4286
applications that only use the <a>WoT network interface</a>.
4293
-
Therefore all three approaches above are supported by the [[[WOT-TD]]] specification.
4287
+
Therefore all three approaches above are supported by the [[[wot-thing-description11]]] specification.
4294
4288
</p>
4295
4289
<p>
4296
4290
Moreover, the <a>WoT network interface</a> can be implemented in many languages
@@ -4313,7 +4307,7 @@ <h4>Requesting and validating a TD</h4>
4313
4307
HTTP client library, which offer already standardized options on
4314
4308
specifying fetch details.
4315
4309
In these cases, the user is required to perform validation manually as
4316
-
described by the [[[WOT-TD]]] specification.
4310
+
described by the [[[wot-thing-description11]]] specification.
4317
4311
</p>
4318
4312
<pclass="ednote" title="Extending the `requestThingDescription()` method">
4319
4313
In the future, `requestThingDescription()` might be extended with an
@@ -4353,7 +4347,7 @@ <h4>Requesting and validating a TD</h4>
4353
4347
</section>
4354
4348
<section><h4>Polymorphic functions</h4>
4355
4349
<p>
4356
-
The reason to use function names like <code>readProperty()</code>, <code>readMultipleProperties()</code> etc. instead of a generic polymorphic <code>read()</code> function is that the current names map exactly to the <code>"op"</code> vocabulary from the <adata-cite="WOT-TD#form">Form</a> definition in the [[[WOT-TD]]] specification.
4350
+
The reason to use function names like <code>readProperty()</code>, <code>readMultipleProperties()</code> etc. instead of a generic polymorphic <code>read()</code> function is that the current names map exactly to the <code>"op"</code> vocabulary from the <adata-cite="wot-thing-description11#form">Form</a> definition in the [[[wot-thing-description11]]] specification.
0 commit comments