-
Notifications
You must be signed in to change notification settings - Fork 63
/
index.html
11975 lines (11516 loc) · 545 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html lang="en">
<head>
<!-- <link rel="stylesheet" href="testing/atrisk.css"> -->
<meta charset="utf-8" />
<meta name="color-scheme" content="light dark" />
<title>Web of Things (WoT) Thing Description - Next</title>
<script src="https://www.w3.org/Tools/respec/respec-w3c" class="remove"></script>
<script class="remove">
var respecConfig = {
specStatus: "ED",
// crEnd: "2019-06-13",
// previousMaturity: "REC",
// previousPublishDate: "2023-12-05",
prevRecURI: "https://www.w3.org/TR/2023/REC-wot-thing-description11-20231205/",
// implementationReportURI: "https://w3c.github.io/wot-thing-description/testing/report11.html",
shortName: "wot-thing-description-next", // temporary for now
copyrightStart: 2017,
noLegacyStyle: true,
inlineCSS: true,
noIDLIn: true,
group: "wg/wot",
charterDisclosureURI: "https://www.w3.org/2004/01/pp-impl/95969/status",
wgPublicList: "public-wot-wg",
edDraftURI: "https://w3c.github.io/wot-thing-description/",
github: "https://github.com/w3c/wot-thing-description",
issueBase: "https://www.github.com/w3c/wot-thing-description/issues",
editors: [
{
name: "Sebastian Kaebisch",
w3cid: "43064",
company: "Siemens AG",
companyURL: "https://www.siemens.com/"
},
{
name: "Michael McCool",
w3cid: "93137",
company: "Intel Corp.",
companyURL: "https://www.intel.com"
},
{
name: "Ege Korkan",
w3cid: "110131",
company: "Siemens AG",
companyURL: "https://www.siemens.com/"
}
],
formerEditors: [
{
name: "Takuki Kamiya",
w3cid: "29376",
company: "Fujitsu Research of America",
companyURL: "https://www.fujitsu.com/global/"
},
{
name: "Victor Charpenay",
w3cid: "84448",
note: "when at Siemens AG"
},
{
name: "Matthias Kovatsch",
note: "when at Huawei"
}
],
xref: ["i18n-glossary"],
localBiblio: {
"iana-web-socket-registry": {
href: "https://www.iana.org/assignments/websocket/websocket.xml#subprotocol-name",
title: "IANA Registry for Websocket Subprotocols",
status: "",
publisher: "IANA",
date: "24 May 2019"
},
"JSON-SCHEMA": {
title: "JSON Schema Validation: A Vocabulary for Structural Validation of JSON",
href: "https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01",
authors: ["Austin Wright", "Henry Andrews", "Geraint Luff"],
status: "Internet-Draft",
date: "19 March 2018",
publisher: "IETF"
},
"LINKSET-MEDIA-TYPES": {
title: "Linkset: Media Types and a Link Relation Type for Link Sets",
href: "https://datatracker.ietf.org/doc/draft-ietf-httpapi-linkset/",
publisher: "IETF",
authors: ["Erik Wilde", "Herbert Van de Sompel"]
},
"LWM2M": {
href: "https://www.omaspecworks.org/what-is-oma-specworks/iot/lightweight-m2m-lwm2m/",
title: "Lightweight M2M",
status: "",
publisher: "Open Mobility Alliance"
},
"OCF": {
href: "https://openconnectivity.org/developer/specifications/",
title: "OCF Specification",
publisher: "Open Connectivity Foundation",
date: "Last accessed: February 2020"
},
"OPENAPI": {
title: "OpenAPI Specification: Version 3.0.1",
href: "https://spec.openapis.org/oas/v3.0.1",
authors: [
"Darrel Miller",
"Jeremy Whitlock",
"Marsh Gardiner",
"Mike Ralphson",
"Ron Ratovsky",
"Uri Sarid"
],
publisher: "OpenAPI Initiative, Linux Foundation",
date: "6 December 2017"
},
"OWASP-Top-10": {
title: "OWASP Top Ten",
href: "https://owasp.org/www-project-top-ten/",
publisher: "OWASP"
},
"SEMVER": {
title: "Semantic Versioning 2.0.0",
href: "https://semver.org/",
authors: ["Tom Preston-Werner"],
date: "26 December 2017"
},
"WOT-ARCHITECTURE": {
title: "Web of Things (WoT) Architecture 1.1",
href: "https://www.w3.org/TR/wot-architecture11/",
authors: ["Michael Lagally", "Ryuichi Matsukura", "Kunihiko Toumura"],
publisher: "W3C",
date: "November 2020"
},
"WOT-PROFILE": {
title: "Web of Things (WoT) Profile",
href: "https://www.w3.org/TR/wot-profile/",
authors: [
"Michael Lagally",
"Michael McCool",
"Ryuichi Matsukura",
"Sebastian Kaebisch",
"Tomoaki Mizushima"
],
publisher: "W3C",
date: "November 2020"
},
"WOT-SECURITY-GUIDELINES": {
title: "Web of Things (WoT) Security and Privacy Guidelines",
//, href: "https://www.w3.org/TR/wot-security/"
href: "https://w3c.github.io/wot-security/",
authors: ["Michael McCool", "Elena Reshetova"],
publisher: "W3C",
date: "July 2021"
},
"MQTT": {
title: "MQTT Version 3.1.1",
href: "http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/mqtt-v3.1.1.html",
authors: ["Andrew Banks", "Rahul Gupta"],
publisher: "OASIS",
date: "December 2015",
status: "OASIS Standard Incorporating Approved Errata 01"
},
"RIJGERSBERG": {
href: "http://www.semantic-web-journal.net/content/ontology-units-measure-and-related-concepts",
authors: ["Hajo Rijgersberg", "Mark van Assem", "Jan Top"],
title: "Ontology of Units of Measure and Related Concepts",
publisher: "Semantic Web journal, IOS Press",
date: "2013"
},
"LDML": {
title: "Unicode Technical Standard #35: Unicode Locale Data Markup Language (LDML)",
href: "https://unicode.org/reports/tr35/",
authors: ["Mark Davis", "CLDR Contributors"],
date: "March 2022"
},
"JSON-SCHEMA-ONTOLOGY": {
title: "JSON Schema in RDF",
href: "https://www.w3.org/2019/wot/json-schema",
authors: ["Victor Charpenay", "Maxime Lefrançois", "María Poveda Villalón"],
publisher: "W3C",
date: "July 2022"
}
},
otherLinks: [
{
key: "Contributors",
data: [
{
value: "In the GitHub repository",
href: "https://github.com/w3c/wot-thing-description/graphs/contributors"
}
]
},
{
key: "Repository",
data: [
{
value: "We are on GitHub",
href: "https://github.com/w3c/wot-thing-description/"
},
{
value: "File a bug",
href: "https://github.com/w3c/wot-thing-description/issues"
}
]
}
]
};
</script>
<style>
a[href].internalDFN {
color: inherit;
border-bottom: 1px solid #99c;
text-decoration: none;
}
.example {
border-color: #ea1252;
background: #fef11e;
counter-increment: example;
overflow: auto;
clear: both;
}
.with-default .with-default-control {
margin-top: 1em;
margin-bottom: 1em;
}
.with-default pre.selected {
margin-top: 0;
margin-bottom: 1em;
height: auto;
}
.with-default pre {
margin-top: 0;
margin-bottom: 0;
height: 0;
}
/* Print parts that might be hidden */
@media print {
.with-default pre {
margin-top: 0;
margin-bottom: 1em;
height: auto;
}
}
</style>
<script>
function defaultCheckboxListener() {
document.querySelectorAll(".with-default").forEach((n) => {
let wo = n.querySelector("pre:nth-of-type(1)");
let w = n.querySelector("pre:nth-of-type(2)");
let cbox = n.querySelector('.with-default-control input[type="checkbox"]');
w.classList.add("selected");
cbox.checked = true;
cbox.addEventListener("change", (e) => {
if (e.target.checked) {
// with default
w.classList.add("selected");
wo.classList.remove("selected");
} else {
// without
w.classList.remove("selected");
wo.classList.add("selected");
}
});
});
}
if (document.respec) {
// ReSpec mode
document.addEventListener("DOMContentLoaded", () => {
// let ReSpec do syntax highlighting first
document.respec.ready.then(() => {
defaultCheckboxListener();
});
});
} else {
// W3C specs on the W3C server don't use ReSpec
document.addEventListener("readystatechange", () => {
if (document.readyState === "complete") {
defaultCheckboxListener();
}
});
}
</script>
<script>
function openTab(example, tabClass) {
var i;
var x = document.getElementsByClassName(example);
for (i = 0; i < x.length; i++) {
x[i].classList.remove("selected");
if (x[i].classList.contains(tabClass)) {
x[i].classList.add("selected");
}
}
}
</script>
<style>
/* example tab selection */
.ds-selector-tabs {
padding-bottom: 2em;
}
.ds-selector-tabs .selectors {
padding: 0;
border-bottom: 1px solid #ccc;
height: 28px;
}
.ds-selector-tabs .selectors button {
display: inline-block;
min-width: 54px;
text-align: center;
font-size: 11px;
font-weight: bold;
height: 27px;
padding: 0 8px;
line-height: 27px;
transition: all, 0.218s;
border-top-right-radius: 2px;
border-top-left-radius: 2px;
color: #666;
border: 1px solid transparent;
}
.ds-selector-tabs .selectors button:first-child {
margin-left: 2px;
}
.ds-selector-tabs .selectors button.selected {
color: #202020 !important;
border: 1px solid #ccc;
border-bottom: 1px solid #fff !important;
}
.ds-selector-tabs .selectors button:hover {
background-color: transparent;
color: #202020;
cursor: pointer;
}
.ds-selector-tabs pre,
.ds-selector-tabs table {
display: none;
}
/* Print parts that might be hidden */
@media print {
.ds-selector-tabs pre,
.ds-selector-tabs table {
display: inline;
}
}
.ds-selector-tabs pre.selected,
.ds-selector-tabs table.selected {
display: block;
}
a.playground {
display: inline-block;
width: 150px;
border: 1px solid transparent;
border-top-right-radius: 2px;
border-top-left-radius: 2px;
background-color: rgb(192, 192, 192);
text-decoration: none;
font-size: 13px;
margin-bottom: 10px;
}
a[href].playground {
padding: 4px 0 3px 8px;
border-bottom: none;
text-decoration: none;
color: #666;
}
</style>
<!-- END EXTRA TABS -->
<!-- ASSERTION HIGHLIGHTING -->
<style>
.rfc2119-assertion {
background-color: rgb(230, 230, 230);
}
.at-risk {
background-color: yellow;
}
</style>
<!-- END ASSERTION HIGHLIGHTING -->
</head>
<body>
<section id="abstract">
<p>
This document describes a formal information model and a common representation for a Web of Things (WoT) Thing
Description Next Version. A Thing Description describes the metadata and interfaces of <a>Things</a>, where a
<a>Thing</a> is an abstraction of a physical or virtual entity that provides interactions to and participates in
the Web of Things. Thing Descriptions provide a 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 a JSON format that also allows JSON-LD processing. The latter provides
a powerful foundation to represent knowledge about <a>Things</a> in a machine-understandable way. A Thing
Description instance can be hosted by the <a>Thing</a> itself or hosted externally when a <a>Thing</a> has
resource restrictions (e.g., limited memory space) or when a Web of Things-compatible legacy device is
retrofitted with a Thing Description. Furthermore, this document introduces the Thing Model, which allows
authors to describe only the model or class of an Internet of Things (IoT) entity. Thing Models can be seen as a
template for Thing Description instances, but with reduced constraints such as no or few requirements for
specific communication metadata.
</p>
<p>
This specification continues the work of [[WOT-THING-DESCRIPTION11]] with no guarantees on backwards
compatibility. In case of no backwards compatibility, there will be concrete guidelines for implementers to
migrate to the new version.
</p>
</section>
<section id="sotd">
<!-- AT-RISK
<p>
The following <span class="at-risk">at-risk features</span> (marked in yellow throughout this specification)
may be removed due to insufficient implementation experience
<a href="https://w3c.github.io/wot-thing-description/testing/report11.html">reported</a>
and/or comments received during the CR period:
</p>
<ul>
<li>
Whole sections related to the security schemes described in
<a href="#certsecurityscheme"></a>,
<a href="#publicsecurityscheme"></a>, and
<a href="#popsecurityscheme"></a>.
</li>
<li>
Vocabulary terms and assertions related to the
<code>implicit</code>, <code>password</code>, and <code>client</code> flows in <a href="#oauth2securityscheme"></a>.
</li>
<li>All default values related to the above in <a href="#sec-default-values"></a>.</li>
<li>A <a href="#td-writeall-consumer">behavioral assertion</a> for <code>writeallproperties</code> that allows rejection of incomplete writes.</li>
</ul>
-->
<!-- <p>
Future updates to this specification may incorporate
<a href="https://www.w3.org/2021/Process-20211102/#allow-new-features">new features</a>.
</p> -->
<!-- <p>
The Web of Things Working Group intends to submit this document for consideration as a
<abbr title="World Wide Web Consortium">W3C</abbr> Proposed Recommendation after at least the minimum CR review
period has passed. However, before PR transition is requested, any features or assertions currently marked as
at-risk that did not appear in the TD 1.0 specification and do not have at least two implementations at that
time will either be removed or converted into informative statements, as appropriate.
</p> -->
</section>
<section id="introduction" class="informative">
<h1>Introduction</h1>
<section id="introduction-td">
<h2>Thing Description</h2>
<p>
The WoT Thing Description (TD) is a central building block in the W3C Web of Things (WoT) and can be
considered as the entry point of a <a>Thing</a> (much like the <i>index.html</i> of a Web site). A TD instance
has five main components: textual metadata about the <a href="#thing">Thing</a> itself, a set of
<a href="#interactionaffordance">Interaction Affordances</a> that indicate how the <a>Thing</a> can be used,
<a href="#sec-data-schema-vocabulary-definition">schemas</a> for the data exchanged with the <a>Thing</a> for
machine-understandability, <a href="#sec-security-vocabulary-definition">Security Definitions</a> to provide
metadata about the security mechanisms that must be used for interactions, and, finally,
<a href="#sec-hypermedia-vocabulary-definition">Web links</a> to express any formal or informal relation to
other <a>Things</a> or documents on the Web.
</p>
<p>
The <a>Interaction Model</a> of W3C WoT defines three types of <a>Interaction Affordances</a>: Properties (<a
href="#propertyaffordance"
><code>PropertyAffordance</code></a
>
class) can be used for sensing and controlling parameters, such as getting the current value or setting an
operation state. Actions (<a href="#actionaffordance"><code>ActionAffordance</code></a> class) model
invocation of physical (and hence time-consuming) processes, but can also be used to abstract RPC-like calls
of existing platforms. Events (<a href="#eventaffordance"><code>EventAffordance</code></a> class) are used for
the push model of communication where notifications, discrete events, or streams of values are sent
asynchronously to the receiver. See [[wot-architecture11]] for details.
</p>
<p>
In general, the TD provides metadata for different <a>Protocol Bindings</a> identified by URI schemes
[[RFC3986]] (e.g., <code>http</code>, <code>coap</code>, etc. [[?IANA-URI-SCHEMES]]), content types based on
media types [[RFC2046]] (e.g., <code>application/json</code>, <code>application/xml</code>,
<code>application/cbor</code>, <code>application/exi</code>, etc. [[?IANA-MEDIA-TYPES]]), and security
mechanisms (for authentication, authorization, confidentiality, etc.). Serialization of TD instances is based
on JSON [[RFC8259]], where JSON names refer to terms of the TD vocabulary, as defined in this specification
document. In addition the JSON serialization of TDs follows the syntax of JSON-LD 1.1 [[?JSON-LD11]] to enable
extensions and rich semantic processing.
</p>
<p>
<a href="#simple-thing-description-sample">Example 1</a> shows a TD instance and illustrates the
<a>Interaction Model</a> with Properties, Actions, and Events by describing a lamp <a>Thing</a> with the title
<i>MyLampThing</i>.
</p>
<aside class="example" id="simple-thing-description-sample" title="Thing Description sample">
<pre>
{
"@context": "https://www.w3.org/2022/wot/td/v1.1",
"id": "urn:uuid:0804d572-cce8-422a-bb7c-4412fcd56f06",
"title": "MyLampThing",
"securityDefinitions": {
"basic_sc": {"scheme": "basic", "in": "header"}
},
"security": "basic_sc",
"properties": {
"status": {
"type": "string",
"forms": [{"href": "https://mylamp.example.com/status"}]
}
},
"actions": {
"toggle": {
"forms": [{"href": "https://mylamp.example.com/toggle"}]
}
},
"events": {
"overheating": {
"data": {"type": "string"},
"forms": [{
"href": "https://mylamp.example.com/oh",
"subprotocol": "longpoll"
}]
}
}
}</pre
>
</aside>
<p>
From this TD example, we know there exists one <a href="#propertyaffordance">Property affordance</a> with the
title <i>status</i>. In addition, information is provided to indicate that this Property is accessible via
(the secure form of) the HTTP protocol with a GET method at the URI
<code>https://mylamp.example.com/status</code> (announced within the <code>forms</code> structure by the
<code>href</code> member), and will return a string-based status value. The use of the GET method is not
stated explicitly, but is one of the default assumptions defined by this document.
</p>
<p>
In a similar manner, an <a href="#actionaffordance">Action affordance</a> is specified to toggle the switch
status using the POST method on the <code>https://mylamp.example.com/toggle</code> resource, where POST is
again a default assumption for invoking Actions.
</p>
<p>
The <a href="#eventaffordance">Event affordance</a> enables a mechanism for asynchronous messages to be sent
by a <a>Thing</a>. Here, a subscription to be notified upon a possible overheating event of the lamp can be
obtained by using HTTP with its long polling subprotocol on <code>https://mylamp.example.com/oh</code>.
</p>
<p>
This example also specifies the <code>basic</code> security scheme, requiring a username and password for
access. Note that a security scheme is first given a name in <code>securityDefinitions</code> and then
activated by specifying that name in a <code>security</code> section. In combination with the use of the HTTP
protocol this example demonstrates the use of HTTP Basic Authentication. Specification of at least one
security scheme at the top level is mandatory, and gives the default access requirements for every resource.
However, security schemes can also be specified per-form, with configurations given at the form level
overriding configurations given at the <code>Thing</code> level, allowing for the specification of
fine-grained access control. It is also possible to use a special <code>nosec</code> security scheme to
indicate that no access control mechanisms are used. Additional examples will be provided later.
</p>
<p>
The Thing Description offers the possibility to add contextual definitions in some namespace. This mechanism
can be used to integrate additional semantics to the content of the Thing Description instance, provided that
formal knowledge, e.g., logic rules for a specific domain of application, can be found under the given
namespace. Contextual information can also help specify some configurations and behavior of the underlying
communication protocols declared in the <code>forms</code> field.
<a href="#thing-description-full-serialization">Example 2</a> extends the TD sample from Example 1 by
introducing a second definition in the <code>@context</code> to declare the prefix <code>saref</code> as
referring to <a href="https://ontology.tno.nl/saref.ttl">SAREF</a>, the Smart Appliance Reference Ontology
[[SMARTM2M]]. This IoT ontology includes terms interpreted as semantic labels that can be set as values of the
<code>@type</code> field, giving the semantics of <a>Things</a> and their <a>Interaction Affordances</a>. In
the example below, the <a>Thing</a> is labelled with <code>saref:LightSwitch</code>, the <code>status</code>
<a>Property</a> is labelled with <code>saref:OnOffState</code> and the <code>toggle</code> <a>Action</a> with
<code>saref:ToggleCommand</code>.
</p>
<aside
class="example"
id="thing-description-full-serialization"
title="Thing Description with TD Context Extension for semantic annotations"
>
<pre>
{
"@context": [
"https://www.w3.org/2022/wot/td/v1.1",
{ "saref": "https://w3id.org/saref#" }
],
"id": "urn:uuid:300f4c4b-ca6b-484a-88cf-fd5224a9a61d",
"title": "MyLampThing",
"@type": "saref:LightSwitch",
"securityDefinitions": {
"basic_sc": {"scheme": "basic", "in": "header"}
},
"security": "basic_sc",
"properties": {
"status": {
"@type": "saref:OnOffState",
"type": "string",
"forms": [{
"href": "https://mylamp.example.com/status"
}]
}
},
"actions": {
"toggle": {
"@type": "saref:ToggleCommand",
"forms": [{
"href": "https://mylamp.example.com/toggle"
}]
}
},
"events": {
"overheating": {
"data": {"type": "string"},
"forms": [{
"href": "https://mylamp.example.com/oh"
}]
}
}
}</pre
>
</aside>
<p>
The declaration mechanism inside some
<code>@context</code> is specified by JSON-LD. A TD instance complies to version 1.1 of that specification
[[?json-ld11]]. Hence, a TD instance can be also processed as an RDF document (for details about semantic
processing, please refer to Appendix <a href="#json-ld-ctx-usage"></a> and the documentation under the
namespace IRIs, e.g., <a href="https://www.w3.org/2019/wot/td">https://www.w3.org/2019/wot/td</a>).
</p>
</section>
<section id="introduction-tm">
<h2>Thing Model</h2>
<p>
One of the main intentions of a <a>Thing Description</a> is to provide a <a>Consumer</a> with all the details
necessary to successfully interact with a <a>Thing</a>. In some IoT application scenarios, a fully detailed
<a>Thing Description</a>, e.g., with communication metadata is not necessary (e.g., IoT ecosystems may
implicitly handle communication separately), or may not be available because a new entity has not yet been
deployed (e.g., IP address is not yet known). Sometimes, also a kind of class definition is required that
forces capability definitions that should be available for all created instances (e.g., large-scale production
of new devices).
</p>
<p>
In order to address the above-mentioned scenarios or others, the <a>Thing Model</a> can be used that mainly
provides the data model definitions within <a>Things</a>' <a>Properties</a>, <a>Actions</a>, and/or
<a>Events</a> and can be potentially used as template for creating <a>Thing Description</a> instances. In the
following a sample <a>Thing Model</a> is presented that can be seen as a model for the
<a>Thing Description</a> instance in <a href="#simple-thing-description-sample"></a>.
</p>
<pre class="example" title="Thing Model sample" id="td-model-example-lamp">
{
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": "tm:ThingModel",
"title": "Lamp Thing Model",
"properties": {
"status": {
"description": "current status of the lamp (on|off)",
"type": "string",
"readOnly": true
}
},
"actions": {
"toggle": {
"description": "Turn the lamp on or off"
}
},
"events": {
"overheating": {
"description": "Lamp reaches a critical temperature (overheating)",
"data": {"type": "string"}
}
}
}
</pre>
<p>
<a>Thing Model</a> definitions are identified by the <code>"@type": "tm:ThingModel"</code>. As the example
shows, it does not provide details about a single <a>Thing</a> instance due to the lack of communication and
security metadata. This specification presents a mechanism for deriving valid
<a>Thing Description</a> instances from such <a>Thing Model</a> definitions. In addition, other design
concepts are specified, including how to override, extend, and reuse existing <a>Thing Model</a> definitions.
</p>
</section>
</section>
<section id="conformance">
<p>
A Thing Description instance complies with this specification if it follows the normative statements in
<a href="#sec-vocabulary-definition"></a>
and
<a href="#sec-td-serialization"></a>
regarding Thing Description serialization.
</p>
<p>
A JSON Schema [[?JSON-SCHEMA]] to validate Thing Description instances is provided in Appendix
<a href="#json-schema-for-validation"></a>.
</p>
</section>
<section id="terminology" class="informative">
<h2>Terminology</h2>
<p>
The fundamental WoT terminology such as <dfn>Thing</dfn>, <dfn>Consumer</dfn>, <dfn>Producer</dfn>,
<dfn>Thing Description</dfn> (<dfn class="lint-ignore">TD</dfn>), <dfn>Partial TD</dfn>,
<dfn>Thing Model</dfn> (<dfn class="lint-ignore">TM</dfn>), <dfn>Interaction Model</dfn>,
<dfn>Interaction Affordance</dfn>, <dfn class="lint-ignore">IoT Platform</dfn>, <dfn>Property</dfn>,
<dfn>Action</dfn>, <dfn>Event</dfn>, <dfn class="lint-ignore">Data Schema</dfn>,
<dfn class="lint-ignore">Content Type</dfn>, <dfn>Protocol Binding</dfn>, <dfn>Servient</dfn>,
<dfn>Vocabulary</dfn>, <dfn>Term</dfn>, <dfn id="dfn-vocab-term">Vocabulary Term</dfn>,
<dfn>WoT Interface</dfn>, and
<dfn>WoT Runtime</dfn>
are defined in <a href="https://www.w3.org/TR/wot-architecture/#terminology">Section 3</a>
of the WoT Architecture specification [[wot-architecture11]].
</p>
<p>In addition, this specification introduces the following definitions:</p>
<dl>
<dt>
<dfn id="dfn-semantic-tag">Semantic Tag</dfn>, <dfn id="dfn-semantic-annotation">Semantic Annotation</dfn>
</dt>
<dd>
A JSON-LD mechanism that links definitions in a <a>Thing Descriptions</a> document to concepts in an (RDF)
ontology. This allows Thing Description authors to provide further context and express domain knowledge in a
standardized way. In a <a>Thing Descriptions</a> document, this can be achieved using
<code>@type</code> members, and through the use of string prefixes using a colon (<code>:</code>).
</dd>
<dt>
<dfn id="dfn-context-ext">TD Context Extension</dfn>
</dt>
<dd>
A mechanism to extend <a>Thing Descriptions</a> with additional <a>Vocabulary Terms</a>. It is the basis for
<a>semantic annotations</a> and extensions to core mechanisms such as Protocol Bindings, Security Schemes, and
Data Schemas.
</dd>
<dt>
<dfn id="dfn-inf-model">TD Information Model</dfn>
</dt>
<dd>
Set of <a>Class</a> definitions constructed from pre-defined <a>Vocabularies</a> on which constraints apply,
thus defining the semantics of these <a>Vocabularies</a>. Class definitions are typically expressed in terms
of a <a>Signature</a> (a set of <a>Vocabulary Terms</a>) and functions over that <a>Signature</a>. The
<a>TD Information Model</a> also includes <a>Default Values</a>, defined as a global function over
<a>Classes</a>.
</dd>
<dt>
<dfn id="dfn-td-processor">TD Processor</dfn>
</dt>
<dd>
A system that can serialize some internal representation of a <a>Thing Description</a> in a given format
and/or deserialize it from that format. A <a>TD Processor</a> can follow validation steps to detect
semantically inconsistent <a>Thing Descriptions</a>, that is, <a>Thing Descriptions</a> that cannot satisfy
constraints on the <a>Instance Relation</a> of the <code>Thing</code> class. For that purpose, a
<a>TD Processor</a> can compute fill in the forms of <a>Thing Descriptions</a> in which all possible
<a>Default Values</a> are assigned. A <a>TD Processor</a> is typically a sub-system of a <a>WoT Runtime</a>.
Implementations of a TD Processor can be a TD <a>producer</a> (able to serialize to TD Documents) or a TD
consumer (able to deserialize from TD Documents) or both.
</dd>
<dt>
<dfn id="dfn-td-serialization">TD Serialization</dfn>
or
<dfn id="dfn-td-document">TD Document</dfn>
</dt>
<dd>
Textual or binary representation of <a>Thing Descriptions</a> that can be stored and exchanged between
<a>Servients</a>. A <a>TD Serialization</a> follows a given representation format, identified by a media type
when exchanged over the network. The default representation format for <a>Thing Descriptions</a> is JSON-based
as defined by this specification.
</dd>
<dt>
<dfn id="dfn-td-level" class="lint-ignore">Levels of a TD</dfn> (including
<dfn id="dfn-td-thing-level">Thing Level</dfn>,
<dfn id="dfn-td-affordance-level" class="lint-ignore">Affordance Level</dfn>,
<dfn id="dfn-td-data-schema-level" class="lint-ignore">Data Schema Level</dfn>,
<dfn id="dfn-td-forms-level" class="lint-ignore">Forms Level</dfn>)
</dt>
<dd>
The scope of a TD or TM instance at the given hierarchy level. For example, the root of a TD, where terms such
as <code>@context</code> are defined is the Thing level, <code>forms</code> are defined within the Affordance
level, <code>type</code>, <code>maximum</code> are defined within the Data Schema level and
<code>href</code> is defined within the Forms level. Even if not defined, other levels can be used such as
Links level.
</dd>
<dt><dfn id="dfn-subspecification">Binding Template Subspecification</dfn>, <dfn>subspecification</dfn></dt>
<dd>
A binding template document that is published separately from this document that specifies a binding template
for a protocol, payload format or platform. All binding template subspecifications respect the rules set in
the <a href="binding-templates">Binding Templates</a> section.
</dd>
</dl>
<p>These definitions are further developed in <a href="#preliminary-definitions"></a>.</p>
</section>
<section class="normative">
<h1>Namespaces</h1>
<p>
The version of the <a>TD Information Model</a> defined in <a href="#sec-vocabulary-definition"></a> of this
specification is identified by the following IRI:
</p>
<p>
<code>https://www.w3.org/2022/wot/td/v1.1</code>
</p>
<p>
This IRI [[RFC3987]], which is also a URI [[!RFC3986]], can be dereferenced to obtain a
<a href="https://www.w3.org/2022/wot/td/v1.1">JSON-LD context file</a> [[?json-ld11]], allowing the compact
strings in <a>TD Documents</a> to be expanded to full IRI-based <a>Vocabulary Terms</a>. However, this
processing is only required when transforming JSON-based <a>TD Documents</a> to RDF, an optional feature of
<a>TD Processor</a>
implementations.
</p>
<p>
In the present specification, <a>Vocabulary Terms</a> are always presented in their compact form. Their expanded
form can be accessed under the namespace IRI of the <a>Vocabulary</a> they belong to. These namespaces follow
the structure of <a href="#class-definitions"></a>. Each <a>Vocabulary</a> used in the
<a>TD Information Model</a> has its own namespace IRI, as follows:
</p>
<table class="def numbered">
<caption>
Namespaces used in TDs
</caption>
<thead>
<tr>
<th>Vocabulary</th>
<th>Namespace IRI</th>
</tr>
</thead>
<tbody>
<tr>
<td>Core</td>
<td><code>https://www.w3.org/2019/wot/td#</code></td>
</tr>
<tr>
<td>Data Schema</td>
<td><code> https://www.w3.org/2019/wot/json-schema#</code></td>
</tr>
<tr>
<td>Security</td>
<td><code>https://www.w3.org/2019/wot/security#</code></td>
</tr>
<tr>
<td>Hypermedia Controls</td>
<td><code>https://www.w3.org/2019/wot/hypermedia#</code></td>
</tr>
</tbody>
</table>
<p>
All vocabularies that are additionally used for <a>Thing Model</a> definitions have the following namespace IRI:
</p>
<table class="def numbered">
<caption>
Namespaces used in TMs
</caption>
<thead>
<tr>
<th>Vocabulary</th>
<th>Namespace IRI</th>
</tr>
</thead>
<tbody>
<tr>
<td>Thing Model</td>
<td><code>https://www.w3.org/2022/wot/tm#</code></td>
</tr>
</tbody>
</table>
<p>
The <a>Vocabularies</a> are independent from each other. They may be reused and extended in other W3C
specifications. Every breaking change in the design of a <a>Vocabulary</a> will require the assignment of a new
year-based namespace URI. Note that to maintain the general coherence of the <a>TD Information Model</a>, the
associated JSON-LD context file is versioned such that every version has its own URI (<code>v1</code>,
<code>v1.1</code>, <code>v2</code>, ...) to also identify non-breaking changes, in particular the addition of
new <a>Terms</a>.
</p>
<p>
Because a <a>Vocabulary</a> under some namespace IRI can only undergo non-breaking changes, its content can be
safely cached or embedded in applications. One advantage of exposing relatively static content under a namespace
IRI is to optimize payload sizes of messages exchanged between constrained devices. It also avoids any privacy
leakage resulting from devices accessing publicly available vocabularies from private networks (see also
<a href="#sec-privacy-consideration"></a>).
</p>
</section>
<section id="sec-vocabulary-definition" class="normative">
<h1>TD Information Model</h1>
<p>
This section introduces the <a>TD Information Model</a>. The <a>TD Information Model</a> serves as the
conceptual basis for the processing of Thing Descriptions and their serialization, which is described separately
in <a href="#sec-td-serialization"></a>.
</p>
<p></p>
<section>
<h2>Overview</h2>
<p>The <a>TD Information Model</a> is built upon the following, independent <a>Vocabularies</a>:</p>
<ul>
<li>
the <em>core</em> TD <a>Vocabulary</a>, which reflects the <a>Interaction Model</a> with the
<a>Properties</a>, <a>Actions</a>, and <a>Events</a> <a>Interaction Affordances</a> [[wot-architecture11]]
</li>
<li>
the <em>Data Schema</em> <a>Vocabulary</a>, including (a subset of) the terms defined by JSON Schema
[[?JSON-SCHEMA]]
</li>
<li>
the <em>WoT Security</em> <a>Vocabulary</a>, identifying security mechanisms and requirements for their
configuration
</li>
<li>
the <em>Hypermedia Controls</em> <a>Vocabulary</a>, encoding the main principles of RESTful communication
using Web links and forms
</li>
</ul>
<p>
Each of these <a>Vocabularies</a> is essentially a set of <a>Terms</a> that can be used to build data
structures, interpreted as objects in the traditional object-oriented sense. Objects are instances of classes
and have properties. In the context of W3C WoT, they denote <a>Things</a> and their
<a>Interaction Affordances</a>. A formal definition of objects is given in
<a href="#preliminary-definitions"></a>. The main elements of the <a>TD Information Model</a> are then
presented in <a href="#class-definitions"></a>. Certain object properties may be omitted in a TD when
<a>Default Values</a> exist. A list of defaults is given in <a href="#sec-default-values"></a>.
</p>
<p>
The UML diagram shown next gives an overview of the <a>TD Information Model</a>. It represents all classes as
tables and the associations that exist between classes, starting from the class
<a href="#thing"><code>Thing</code></a
>, as directed arrows. For the sake of readability, the diagram was split in four parts, one for each of the
four base <a>Vocabularies</a>.
</p>
<!--<p><a href="http://visualdataweb.de/webvowl/#iri=https://rawgit.com/w3c/wot-thing-description/TD-JSON-LD-1.1/ontology/td.ttl">Click here for the visualization</a></p>-->
<figure id="td-core-model">
<img src="visualization/td.svg" alt="UML diagram of the TD information model for the TD core vocabulary" />
<figcaption>TD core vocabulary</figcaption>
</figure>
<hr />
<figure id="td-data-schema-model">
<img
src="visualization/jsonschema.svg"
alt="UML diagram of the TD information model for the Data schema vocabulary"
/>
<figcaption>Data schema vocabulary</figcaption>
</figure>
<hr />
<figure id="td-security-model">
<img
src="visualization/wotsec.svg"
alt="UML diagram of the TD information model for the WoT security vocabulary"
/>
<figcaption>WoT security vocabulary</figcaption>
</figure>
<hr />
<figure id="hypermedia-model">
<img
src="visualization/hctl.svg"
alt="UML diagram of the TD information model for the hypermedia controls vocabulary"
/>
<figcaption>Hypermedia controls vocabulary</figcaption>
</figure>
</section>
<section id="preliminary-definitions">
<h2>Preliminaries</h2>
<p>
To provide a model that can be easily processed by both, simple rules on a tree-based document (i.e., raw JSON
processing) and rich Semantic Web tooling (i.e., JSON-LD processing), this document defines the following
formal preliminaries to construct the <a>TD Information Model</a> accordingly.
</p>
<p>
All definitions in this section refer to <em>sets</em>, which intuitively are collections of elements that can
themselves be sets. All arbitrarily complex data structures can be defined in terms of sets. In particular, an
<dfn>Object</dfn> is a data structure recursively defined as follows:
</p>
<ul>
<li>a <a>Term</a>, which may or may not belong to a <a>Vocabulary</a>, is an <a>Object</a>.</li>
<li>
a set of name-value pairs where the name is a <a>Term</a> and the value is another <a>Object</a>, is also an
<a>Object</a>.
</li>
</ul>
<p>