forked from w3c/wot-thing-description
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
5510 lines (5176 loc) · 248 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>
<meta charset="utf-8">
<title>Web of Things (WoT) Thing Description</title>
<script src="https://www.w3.org/Tools/respec/respec-w3c-common" class="remove"></script>
<script class='remove'>
var respecConfig = {
specStatus: "ED"
, processVersion: 2017
, shortName: "wot-thing-description"
, copyrightStart: 2017
, noLegacyStyle: true
, inlineCSS: true
, noIDLIn: true
, format: "markdown"
, wg: "Web of Things Working Group"
, wgURI: "https://www.w3.org/WoT/WG/"
, wgPublicList: "public-wot-wg"
, edDraftURI: "https://w3c.github.io/wot-thing-description/"
, githubAPI: "https://api.github.com/repos/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: "Takuki Kamiya"
, w3cid: "29376"
, company: "Fujitsu Laboratories of America, Inc."
, companyURL: "https://www.fujitsu.com/"
}
, {
name: "Michael McCool"
, w3cid: ""
, company: "Intel"
, companyURL: " www.intel.com/"
}
, {
name: "Victor Charpenay"
, w3cid: ""
, company: "Siemens AG"
, companyURL: "https://www.siemens.com/"
}
]
, localBiblio: {
"JSON-SCHEMA-VALIDATION": {
title: "JSON Schema Validation: A Vocabulary for Structural Validation of JSON"
, href: "https://tools.ietf.org/html/draft-handrews-json-schema-validation-00"
, authors: [
"Austin Wright"
, "Henry Andrews"
, "Geraint Luff"
]
, status: "Internet-Draft"
, publisher: "IETF"
}
, "JSON-SCHEMA-CORE": {
title: "JSON Schema: A Media Type for Describing JSON Documents"
, href: "https://tools.ietf.org/html/draft-handrews-json-schema-00"
, authors: [
"Austin Wright"
, "Henry Andrews"
]
, status: "Internet-Draft"
, publisher: "IETF"
}
, "OPENAPI": {
title: "OpenAPI Specification: Version 3.0.1"
, href: "https://swagger.io/specification/"
, authors: [
"Darrel Miller"
, "Jason Harmon"
, "Jeremy Whitlock"
, "Kris Hahn"
, "Marsh Gardiner"
, "Mike Ralphson"
, "Rob Dolin"
, "Ron Ratovsky"
, "Tony Tam"
]
, publisher: "OpenAPI Initiative, Linux Foundation"
, date: "7 December 2017"
}
, "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 Architecture"
, href: "https://w3c.github.io/wot-architecture/"
, authors: [
"Kazuo Kajimoto"
, "Matthias Kovatsch"
, "Uday Davuluru"
]
, publisher: "W3C"
, date: "20 August 2017"
}
, "WOT-SECURITY-CONSIDERATIONS" : {
title: "Web of Things Security and Privacy Considerations"
, href: "https://w3c.github.io/wot-security/"
, authors: [
, "Michael McCool"
, "Elena Reshetova"
]
, publisher: "W3C"
, date: "28 August 2017"
}
, "WOT-SECURITY-BEST-PRACTICES" : {
title: "Web of Things Security and Privacy Best Practices (WIP)"
, href: "https://github.com/w3c/wot-security/blob/master/wot-security-best-practices.md"
, authors: [
, "Michael McCool"
, "Elena Reshetova"
]
, publisher: "W3C"
, date: "WIP"
}
, "WoT-Binding-Templates" : {
title: "Web of Things Protocol Binding Templates"
, href: "https://w3c.github.io/wot-binding-templates/"
, authors: [
"Michael Koster"
]
, publisher: "W3C"
, date: "12 January 2018"
}
, "MQTT" : {
title: "MQTT Version 5.0"
, href: "http://docs.oasis-open.org/mqtt/mqtt/v5.0/cos01/mqtt-v5.0-cos01.html"
, authors: [
"Andrew Banks",
"Ed Briggs",
"Ken Borgendale",
"Rahul Gupta"
]
, publisher: "OASIS"
, date: "31 October 2018"
, status: "Candidate OASIS Standard 01"
}
}
, 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>
.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;
}
</style>
<script>
document.addEventListener('DOMContentLoaded', () => {
// let ReSpec do syntax highlighting first
document.respecIsReady.then(() => {
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');
}
});
});
});
});
</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;
}
.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)
}
#bindings-requirements-scheme {
background-color: yellow;
}
#bindings-server-accept {
background-color: yellow;
}
#td-context-ns-dataschema-dereferenceable-url {
background-color: yellow;
}
#td-context-ns-dataschema-mandatory {
background-color: yellow;
}
#td-context-ns-dataschema-map-of-namespaces {
background-color: yellow;
}
#td-context-ns-dataschema-optional {
background-color: yellow;
}
#td-context-ns-dataschema-prefix {
background-color: yellow;
}
#td-context-ns-multilanguage-content-negotiation {
background-color: yellow;
}
#td-context-ns-securityscheme-dereferenceable-url {
background-color: yellow;
}
#td-context-ns-securityscheme-mandatory {
background-color: yellow;
}
#td-context-ns-securityscheme-map-of-namespaces {
background-color: yellow;
}
#td-context-ns-securityscheme-optional {
background-color: yellow;
}
#rdf-transformation {
background-color: yellow;
}
#td-action-names {
background-color: yellow;
}
#td-action-names_descriptions {
background-color: yellow;
}
#td-action-names_titles {
background-color: yellow;
}
#td-arrays {
background-color: yellow;
}
#td-arrays_scopes {
background-color: yellow;
}
#td-context-ns-thing {
background-color: yellow;
}
#td-context-ns-dataschema {
background-color: yellow;
}
#td-context-ns-dataschema-prefix {
background-color: yellow;
}
#td-context-ns-securityscheme {
background-color: yellow;
}
#td-context-ns-securityscheme-prefix {
background-color: yellow;
}
#td-context-ns-thing-dereferenceable-url {
background-color: yellow;
}
#td-context-ns-thing-mandatory {
background-color: yellow;
}
#td-context-ns-thing-map-of-namespaces {
background-color: yellow;
}
#td-context-ns-thing-optional {
background-color: yellow;
}
#td-context-ns-thing-prefix {
background-color: yellow;
}
#td-data-schema-objects {
background-color: yellow;
}
#td-data-schema-objects_items {
background-color: yellow;
}
#td-data-schema-objects_properties {
background-color: yellow;
}
#td-data-schema-objects-arrays {
background-color: yellow;
}
#td-datetime-type {
background-color: yellow;
}
#td-default-alg {
background-color: yellow;
}
#td-default-context-of-thing {
background-color: yellow;
}
#td-default-context-of-dataschema {
background-color: yellow;
}
#td-default-context-of-securityscheme {
background-color: yellow;
}
#td-default-flow {
background-color: yellow;
}
#td-default-http-method {
background-color: yellow;
}
#td-default-http-method_get {
background-color: yellow;
}
#td-default-http-method_put {
background-color: yellow;
}
#td-default-http-method_post {
background-color: yellow;
}
#td-default-op-actions {
background-color: yellow;
}
#td-default-op-events {
background-color: yellow;
}
#td-default-op-properties {
background-color: yellow;
}
#td-default-qop {
background-color: yellow;
}
#td-event-names {
background-color: yellow;
}
#td-event-names_descriptions {
background-color: yellow;
}
#td-event-names_titles {
background-color: yellow;
}
#td-event-names_uriVariables {
background-color: yellow;
}
#td-json-open {
background-color: yellow;
}
#td-json-open_utf-8 {
background-color: yellow;
}
#td-json-open_no-byte-order {
background-color: yellow;
}
#td-json-open_accept-byte-order {
background-color: yellow;
}
#td-op-for-property-readonly {
background-color: yellow;
}
#td-op-for-property-writeonly {
background-color: yellow;
}
#td-processor-serialization {
background-color: yellow;
}
#td-property-names {
background-color: yellow;
}
#td-property-names_const {
background-color: yellow;
}
#td-property-names_scopes {
background-color: yellow;
}
#td-property-names_security {
background-color: yellow;
}
#td-property-names_uriVariables {
background-color: yellow;
}
#td-security-schemes {
background-color: yellow;
}
#td-security-ns {
background-color: yellow;
}
#td-serializiation-default-values {
background-color: yellow;
}
#td-vocab-alg--PoPSecurityScheme {
background-color: yellow;
}
#td-vocab-anchor--Link {
background-color: yellow;
}
#td-vocab-at-context--DataSchema {
background-color: yellow;
}
#td-vocab-at-context--SecurityScheme {
background-color: yellow;
}
#td-vocab-at-type--SecurityScheme {
background-color: yellow;
}
#td-vocab-authorization--OAuth2SecurityScheme {
background-color: yellow;
}
#td-vocab-authorization--PoPSecurityScheme {
background-color: yellow;
}
#td-vocab-contentCoding--Form {
background-color: yellow;
}
#td-vocab-description {
background-color: yellow;
}
#td-vocab-description--SecurityScheme {
background-color: yellow;
}
#td-vocab-descriptions--SecurityScheme {
background-color: yellow;
}
#td-vocab-flow--OAuth2SecurityScheme {
background-color: yellow;
}
#td-vocab-format--DataSchema {
background-color: yellow;
}
#td-vocab-format--PoPSecurityScheme {
background-color: yellow;
}
#td-vocab-identity--CertSecurityScheme {
background-color: yellow;
}
#td-vocab-identity--PSKSecurityScheme {
background-color: yellow;
}
#td-vocab-identity--PublicSecurityScheme {
background-color: yellow;
}
#td-vocab-in--APIKeySecurityScheme {
background-color: yellow;
}
#td-vocab-in--BearerSecurityScheme {
background-color: yellow;
}
#td-vocab-in--DigestSecurityScheme {
background-color: yellow;
}
#td-vocab-in--PoPSecurityScheme {
background-color: yellow;
}
#td-vocab-name--APIKeySecurityScheme {
background-color: yellow;
}
#td-vocab-name--CertSecurityScheme {
background-color: yellow;
}
#td-vocab-name--PSKSecurityScheme {
background-color: yellow;
}
#td-vocab-name--BasicSecurityScheme {
background-color: yellow;
}
#td-vocab-name--BearerSecurityScheme {
background-color: yellow;
}
#td-vocab-name--DigestSecurityScheme {
background-color: yellow;
}
#td-vocab-name--PoPSecurityScheme {
background-color: yellow;
}
#td-vocab-names--Thing {
background-color: yellow;
}
#td-vocab-op--Form {
background-color: yellow;
}
#td-vocab-proxy--SecurityScheme {
background-color: yellow;
}
#td-vocab-qop--DigestSecurityScheme {
background-color: yellow;
}
#td-vocab-refresh--OAuth2SecurityScheme {
background-color: yellow;
}
#td-vocab-scopes--Form {
background-color: yellow;
}
#td-vocab-scopes--OAuth2SecurityScheme {
background-color: yellow;
}
#td-vocab-scheme--SecurityScheme {
background-color: yellow;
}
#td-vocab-scheme--SecurityScheme_apikey {
background-color: yellow;
}
#td-vocab-scheme--SecurityScheme_cert {
background-color: yellow;
}
#td-vocab-scheme--SecurityScheme_oauth2 {
background-color: yellow;
}
#td-vocab-scheme--SecurityScheme_pop {
background-color: yellow;
}
#td-vocab-scheme--SecurityScheme_psk {
background-color: yellow;
}
#td-vocab-scheme--SecurityScheme_public {
background-color: yellow;
}
#td-vocab-token--OAuth2SecurityScheme {
background-color: yellow;
}
#td-vocab-type--DataSchema {
background-color: yellow;
}
#td-vocabulary-defaults {
background-color: yellow;
}
.at-risk {
background-color: yellow;
}
</style>
<!-- END ASSERTION HIGHLIGHTING -->
</head>
<body>
<section id="abstract">
<p>
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 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 Things in a machine-understandable way.
A Thing Description instance can be hosted by the Thing itself or hosted
externally when a Thing has resource restrictions (e.g., limited memory space)
or when a Web of Things-compatible legacy device is retrofitted
with a Thing Description.
</p>
</section>
<section id="sotd">
<p>
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
<a href="https://github.com/w3c/wot-thing-description">repository</a>
and take part in the discussions.
</p>
<!--
<p>This document is governed by the <a id=
"w3c_process_revision" href=
"https://www.w3.org/2019/Process-20190301/">1 March 2019
<abbr title="World Wide Web Consortium">W3C</abbr> Process
Document</a>.</p>
-->
<p>
<span class="at-risk">Text and table entries highlighted with a yellow background
indicates a feature associated with an at-risk assertion for which
insufficient implementation experience exists.</span>
When an entire section is at-risk the words
"<span class="at-risk">This section is at risk.</span>"
will be placed at the start of the section and highlighted with a yellow background.</span>
</p>
</section>
<section id="introduction" class="informative">
<h1>Introduction</h1>
<p>
The Thing Description (TD) model is a central building block in the W3C Web of
Things (WoT) and can be considered as the entry point of a Thing
(much like the <i>index.html</i> of a Web site). A TD instance has four main
components: textual metadata about the <a href="#thing">Thing</a> itself, a collection of
<a href="#interactionaffordance">affordances</a> to interact with the Thing on the
basis of WoT's high-level interaction paradigm (involving the classes
<a href="#propertyaffordance"><code>PropertyAffordance</code></a>,
<a href="#actionaffordance"><code>ActionAffordance</code></a> and
<a href="#eventaffordance"><code>EventAffordance</code></a>),
<a href="#sec-data-schema-vocabulary-definition">schemas</a> for the information
exchanged with the Thing for machine-understandability,
and, finally, <a href="#sec-web-linking-vocabulary-definition">Web links</a> to
express any formal or informal relation to other Things.
</p>
<p>
Property affordances (<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.
Action affordances (<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.
Event affordances (<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.
In general, the TD provides metadata for different communication bindings
identified by URI schemes [[iana-uri-schemes]] (e.g., <code>http</code>, <code>coap</code>, etc.),
content types based on media types (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 keys refers to terms of
the TD core 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 context extension and RDF processing.
</p>
<p>
<a href="#simple-thing-description-sample">Example 1</a> shows a TD instance and
illustrates the TD model's <a href="#propertyaffordance"><code>PropertyAffordance</code></a>,
<a href="#actionaffordance"><code>ActionAffordance</code></a> and
<a href="#eventaffordance"><code>EventAffordance</code></a>
classes by describing a lamp Thing with the name <i>MyLampThing</i>.
</p>
<aside class="example" id="simple-thing-description-sample" title="Thing Description Sample">
<pre>{
"@context": "https://www.w3.org/2019/td/v1",
"id": "urn:dev:ops:32473-WoTLamp-1234",
"name": "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 name <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> name), 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 and explained in [[WoT-Binding-Templates]].
</p>
<p>
In a similar manner, an <a href="#actionaffordance">action affordance</a> is specified to toggle the
switch status using the POST method applied to 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 Thing.
Here, a subscription to be notified upon a possible overheating event
of the lamp can be obtained by using the HTTP with its long polling
sub-protocol at <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 a
<code>securityDefinition</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 Thing 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 defintion in the <code>@context</code> to declare the
prefix <code>saref</code> as referring to the SAREF vocabulary namespace [[smartM2M]].
The SAREF vocabulary includes terms to describe lighting devices and other home automation
devices that one can embed in a TD as semantic labels as values for the <code>@type</code>
property. In the present example, the Thing is labelled with <code>saref:LightingDevice</code>,
the <code>status</code> property affordance is labelled with <code>saref:OnOffState</code>
and the <code>toggle</code> action affordance with <code>saref:ToggleCommand</code>.
</p>
<aside class="example" id="thing-description-full-serialization" title="Thing Description with context extension">
<pre>
{
"@context": [
"https://www.w3.org/2019/td/v1",
{
"saref": "https://w3id.org/saref#"
}
],
"id": "urn:dev:ops:32473-WoTLamp-1234",
"name": "MyLampThing",
"@type": "saref:LightingDevice",
"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": {
"@type": "saref:NotifyCommand",
"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
this specification [[json-ld11]]. The TD instance can be also processed as an RDF
document (details are given in <a href="#note-jsonld11-processing"></a>).
</p>
</section>
<section id="terminology">
<h2>Terminology</h2>
<p>The generic WoT terminology is defined in [[WOT-ARCHITECTURE]]:
<dfn data-lt="Things">Thing</dfn>,
<dfn data-lt="Thing Descriptions">Thing Description</dfn>
(in short <dfn>TD</dfn>),
<dfn>Web of Things</dfn> (in short <b><i>WoT</i></b>),
<dfn>WoT Interface</dfn> etc.
</p>
<p>
In addition, this document introduces the following definitions:
</p>
<dl>
<dt>
<dfn id="dfn-inf-model">TD Information Model</dfn>
</dt>
<dd>
Set of constraints and equivalence relations applying to pre-defined vocabularies
(i.e., a core vocabulary with extension like JSON Schema, Web Linking and WoT Security),
thus defining the semantics of these vocabularies. Constraints and
equivalence relations are typically expressed in terms of class signature,
property value assignment and property type on arbitrary object-oriented data
structures.
</dd>
<dt>
<dfn id="dfn-td-processor">TD Processor</dfn>
</dt>
<dd>
A system that can serialize some internal representation of a TD
in a given format and deserialize it from that format. If two TDs have different
serializations but are semantically equivalent, a TD processor must be able to
construct a canonical (i.e., identical) representation when deserializing them.
For instance, a TD in which default values were omitted is equivalent to a TD that
would include default values. Moreover, a TD processor must also detect semantically
inconsistent TDs, for which no representation should exist. A TD processor is
typically a sub-system of a WoT runtime.
</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 TD that can be stored and exchanged between
servients. A TD serialization follows a given format, provided as a content type
when exchanging it. The reference serialization format for TDs is JSON.
</dd>
<dt>
<dfn id="dfn-vocab">Vocabulary</dfn>
</dt>
<dd>
A collection of vocabulary terms, identified by a namespace IRI.
</dd>
<dt>
<dfn id="dfn-vocab-term">Vocabulary Term</dfn>
</dt>
<dd>
A class name (like <code>Thing</code>), a property name (like
<code>forms</code>) or a property value (like <code>readproperty</code>).
</dd>
</dl>
</section>
<section>
<h1>Namespaces</h1>
<p>
The TD information model presented in this document has its foundations in
RDF, with a mapping to JSON. This mapping is provided as a JSON-LD context
file, available at the following URI:
</p>
<p>
<code>https://www.w3.org/2019/td/v1</code>
</p>
<section>
<h2>Reference Namespaces</h2>
<p>
All terms defined in the context are grouped by vocabulary, mirroring the
structure of the present document (see
<a href="#thing-description-json-ld-context"></a> for more details on the
context). Each vocabulary is assigned a year-based namespace URI, as follows:
</p>
<table class="def">
<thead>
<tr>
<th>Vocabulary</th>
<th>Namespace URI</th>
</tr>
</thead>
<tbody>
<tr>
<td>Core</td>
<td><code>https://www.w3.org/2019/td#</code></td>
</tr>
<tr>
<td>Data Schema</td>
<td><code>https://www.w3.org/2019/json-schema#</code></td>
</tr>
<tr>
<td>Security</td>
<td><code>https://www.w3.org/2019/wot-security#</code></td>
</tr>
<tr>
<td>Web Linking</td>
<td><code>https://www.w3.org/2019/web-linking#</code></td>
</tr>
</tbody>
</table>
<p>
Vocabularies are independent from each other. They may be reused and
extended in other W3C recommendations. For every breaking change in the
design of a vocabulary, it will be assigned a new year-based namespace URI.
Note that to maintain the general coherence of the TD information model,
the JSON-LD context itself is versioned, such that every version has its own URI