forked from w3c/wot-thing-description
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtag-review.html
6210 lines (5933 loc) · 273 KB
/
tag-review.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-PROTOCOL-BINDING" : {
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;
}
</style>
<!-- BEGIN EXTRA TABS -->
<script>
// Add example button selection logic
document.addEventListener("DOMContentLoaded", () => {
for (const button of document.querySelectorAll(".ds-selector-tabs .selectors button")) {
button.onclick = () => {
const ex = button.closest(".ds-selector-tabs");
ex.querySelector("button.selected").classList.remove("selected");
ex.querySelector(".selected").classList.remove("selected");
button.classList.add('selected');
ex.querySelector("." + button.dataset.selects).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)
}
#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-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-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-op-for-property-readonly {
background-color: yellow;
}
#td-op-for-property-writeonly {
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-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-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-type--DataSchema {
background-color: yellow;
}
#td-vocab-token--OAuth2SecurityScheme {
background-color: yellow;
}
#td-vocabulary-default-values {
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 Thing itself, a collection of affordances
to interact with the Thing on the basis of WoT's high-level interaction paradigm
(involving the classes <code>Property</code>, <code>Action</code>, and <code>Event</code>),
schemas for the information exchanged with the Thing for machine-understandability,
and, finally, Web links to express any formal or informal relation to other Things.
</p>
<p>
<code>Property</code> affordances can be used for sensing and controlling parameters,
such as getting the current value or setting an operation state.
<code>Action</code> affordances model invocation of physical (and hence time-consuming) processes,
but can also be used to abstract RPC-like calls of existing platforms.
<code>Event</code> affordances 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., "application/json", "application/xml", "application/cbor",
"application/exi" 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>
Example 1 shows a TD instance with its different equivalent representation options (<i>Simple</i>, <i>Full (JSON-LD 1.1)</i>, <i>RDF</i>) and
illustrates the TD model's <code>Property</code>, <code>Action</code>,
and <code>Event</code> classes by describing a lamp Thing with the name <i>MyLampThing</i>.
</p>
<aside class="example ds-selector-tabs changed" id="simple-thing-description-sample" title="Thing Description Sample">
<div class="selectors">
<button class="selected" data-selects="ex-original">Simple</button>
<button data-selects="ex-full">Full (JSON-LD 1.1)</button>
<button data-selects="ex-rdf">RDF</button>
</div>
<pre class="ex-original selected">{
"id": "urn:dev:wot:com:example:servient:lamp",
"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>
<pre class="ex-full">{
"@context": "http://www.w3.org/ns/td",
"id": "urn:dev:wot:com:example:servient:lamp",
"name": "MyLampThing",
"securityDefinitions": {
"basic_sc": {"scheme": "basic", "in":"header"}
},
"security": ["basic_sc"],
"properties": {
"status" : {
"type": "string",
"forms": [{
"href": "https://mylamp.example.com/status",
"contentType": "application/json",
"op": ["readproperty", "writeproperty"]
}]
}
},
"actions": {
"toggle" : {
"idempotent" : false,
"safe" : false,
"forms": [{
"href": "https://mylamp.example.com/toggle",
"contentType": "application/json",
"op": "invokeaction"
}]
}
},
"events":{
"overheating":{
"data": {"type": "string"},
"forms": [{
"href": "https://mylamp.example.com/oh",
"contentType": "application/json",
"subprotocol": "longpoll",
"op": "subscribeevent"
}]
}
}
}</pre>
<pre class="ex-rdf"><urn:dev:wot:com:example:servient:lamp> <http://www.w3.org/ns/td#actions> _:b0 .
<urn:dev:wot:com:example:servient:lamp> <http://www.w3.org/ns/td#events> _:b2 .
<urn:dev:wot:com:example:servient:lamp> <http://www.w3.org/ns/td#name> "MyLampThing" .
<urn:dev:wot:com:example:servient:lamp> <http://www.w3.org/ns/td#properties> _:b5 .
<urn:dev:wot:com:example:servient:lamp> <http://www.w3.org/ns/td#securityDefinitions> _:b7 .
_:b0 <http://www.w3.org/ns/td#forms> _:b1 .
_:b0 <http://www.w3.org/ns/td#idempotent> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
_:b0 <http://www.w3.org/ns/td#safe> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
_:b1 <http://www.w3.org/ns/td#contentType> "application/json" .
_:b4 <http://www.w3.org/ns/td#op> "invokeaction" .
_:b1 <http://www.w3.org/ns/td#href> "https://mylamp.example.com/toggle"^^<http://www.w3.org/2001/XMLSchema#anyURI> .
_:b2 <http://www.w3.org/ns/td#data> _:b3 .
_:b2 <http://www.w3.org/ns/td#forms> _:b4 .
_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://w3.org/ns/json-schema#StringSchema> .
_:b4 <http://www.w3.org/ns/td#contentType> "application/json" .
_:b4 <http://www.w3.org/ns/td#op> "subscribeevent" .
_:b4 <http://www.w3.org/ns/td#href> "https://mylamp.example.com/oh"^^<http://www.w3.org/2001/XMLSchema#anyURI> .
_:b4 <http://www.w3.org/ns/td#subprotocol> "longpoll" .
_:b5 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://w3.org/ns/json-schema#StringSchema> .
_:b5 <http://www.w3.org/ns/td#forms> _:b6 .
_:b6 <http://www.w3.org/ns/td#contentType> "application/json" .
_:b4 <http://www.w3.org/ns/td#op> "readproperty" .
_:b4 <http://www.w3.org/ns/td#op> "writeproperty" .
_:b6 <http://www.w3.org/ns/td#href> "https://mylamp.example.com/status"^^<http://www.w3.org/2001/XMLSchema#anyURI> .
</pre>
</aside>
<p>
Based on the content that can be seen in the <i>Simple</i> tab,
we know there exists one <code>Property</code> <a>interaction resource</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-protocol-binding]].
</p>
<p>
In a similar manner, an <code>Action</code> 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 <code>Event</code> pattern 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 TD in the <i>Simple</i> tab reflects some additional defined default assumptions
that are not explicitly described.
For example, the content type of the
exchange format of the interactions is assumed to be JSON
(=<code>contentType</code>).
Specifically, the TD specification defines vocabulary terms
(e.g., <code>contentType</code>, <code>op</code>, <code>@contex</code>) that have default values.
If one or more of these vocabulary terms are not explicitly used in a Thing Description
instance we will call it <i>Simple</i> and a Thing Description processor (e.g. based on a raw JSON parser) follows default
assumptions for interpretation as defined in this specification.
The <i>Full (JSON-LD 1.1)</i> tab shows the identical information of the
simple form of the Thing Description instance, but includes these mentioned implicit vocabulary terms with its default values.
A TD instance that contains all corresponding mandatory vocabulary terms, we will call this representation as <i>Full</i>
and can be passed, e.g, directly to a JSON-LD 1.1 processor for semantic interpretation. The <i>RDF</i> tab just shows
the RDF triples from the JSON-LD 1.1 representation (as defined in [[json-ld11]]).
</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.
Example 2 extends the TD sample from Example 1 by introducing a <code>@context</code>
key to declare the prefix <code>htv</code> as referring to the HTTP vocabulary namespace.
This namespace is used here to specify explicitly the HTTP methods for the property and
action within the <code>forms</code>. 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>
<aside class="example ds-selector-tabs changed" id="thing-description-full-serialization" title="Thing Description with context extension">
<div class="selectors">
<button class="selected" data-selects="ex-original">Simple</button>
<button data-selects="ex-full">Full (JSON-LD 1.1)</button>
<button data-selects="ex-rdf">RDF</button>
</div>
<pre class="ex-original selected">
{
"@context": [
"http://www.w3.org/ns/td",
{"htv": "http://www.w3.org/2011/http#"}
],
"id": "urn:dev:wot:com:example:servient:lamp",
"name": "MyLampThing",
"securityDefinitions": {"basic_sc": {
"scheme": "basic",
"in": "header"
}},
"security": ["basic_sc"],
"properties": {
"status": {
"type": "string",
"forms": [{
"href": "https://mylamp.example.com/status",
"htv:methodName": "GET"
}]
}
},
"actions": {
"toggle": {
"forms": [{
"href": "https://mylamp.example.com/toggle",
"http:methodName": "POST"
}]
}
},
"events": {
"overheating": {
"data": {"type": "string"},
"forms": [{
"href": "https://mylamp.example.com/oh",
"subprotocol": "longpoll"
}]
}
}
}</pre>
<pre class="ex-full">
{
"@context": [
"http://www.w3.org/ns/td",
{"htv": "http://www.w3.org/2011/http#"}
],
"id": "urn:dev:wot:com:example:servient:lamp",
"name": "MyLampThing",
"securityDefinitions": {"basic_sc": {
"scheme": "basic",
"in": "header"
}},
"security": ["basic_sc"],
"properties": {
"status": {
"type": "string",
"forms": [{
"href": "https://mylamp.example.com/status",
"htv:methodName": "GET",
"contentType": "application/json",
"op": ["readproperty", "writeproperty"]
}]
}
},
"actions": {
"toggle": {
"idempotent": false,
"safe": false,
"forms": [{
"href": "https://mylamp.example.com/toggle",
"htv:methodName": "POST",
"contentType": "application/json",
"op": "invokeaction"
}]
}
},
"events": {
"overheating": {
"data": {"type": "string"},
"forms": [{
"href": "https://mylamp.example.com/oh",
"subprotocol": "longpoll",
"contentType": "application/json",
"op": "subscribeevent"
}]
}
}
}</pre>
<pre class="ex-rdf"><urn:dev:wot:com:example:servient:lamp> <http://www.w3.org/ns/td#actions> _:b0 .
<urn:dev:wot:com:example:servient:lamp> <http://www.w3.org/ns/td#events> _:b2 .
<urn:dev:wot:com:example:servient:lamp> <http://www.w3.org/ns/td#name> "MyLampThing" .
<urn:dev:wot:com:example:servient:lamp> <http://www.w3.org/ns/td#properties> _:b5 .
<urn:dev:wot:com:example:servient:lamp> <http://www.w3.org/ns/td#securityDefinitions> _:b7 .
_:b0 <http://www.w3.org/ns/td#forms> _:b1 .
_:b0 <http://www.w3.org/ns/td#idempotent> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
_:b0 <http://www.w3.org/ns/td#safe> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
_:b1 <http://www.w3.org/2011/http#methodName> "POST" .
_:b1 <http://www.w3.org/ns/td#contentType> "application/json" .
_:b1 <http://www.w3.org/ns/td#op> "invokeaction" .
_:b1 <http://www.w3.org/ns/td#href> "https://mylamp.example.com/toggle"^^<http://www.w3.org/2001/XMLSchema#anyURI> .
_:b2 <http://www.w3.org/ns/td#data> _:b3 .
_:b2 <http://www.w3.org/ns/td#forms> _:b4 .
_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://w3.org/ns/json-schema#StringSchema> .
_:b4 <http://www.w3.org/ns/td#contentType> "application/json" .
_:b1 <http://www.w3.org/ns/td#op> "subscribeevent" .
_:b4 <http://www.w3.org/ns/td#href> "https://mylamp.example.com/oh"^^<http://www.w3.org/2001/XMLSchema#anyURI> .
_:b4 <http://www.w3.org/ns/td#subprotocol> "longpoll" .
_:b5 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://w3.org/ns/json-schema#StringSchema> .
_:b5 <http://www.w3.org/ns/td#forms> _:b6 .
_:b6 <http://www.w3.org/2011/http#methodName> "GET" .
_:b6 <http://www.w3.org/ns/td#contentType> "application/json" .
_:b1 <http://www.w3.org/ns/td#op> "readproperty" .
_:b1 <http://www.w3.org/ns/td#op> "writeproperty" .
_:b6 <http://www.w3.org/ns/td#href> "https://mylamp.example.com/status"^^<http://www.w3.org/2001/XMLSchema#anyURI> .
</pre>
</aside>
</section>
<section id="terminology">
<h2>Terminology</h2>
<p>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>
</section>
<section>
<h1>Namespaces</h1>
<p>
The namespace for the W3C Thing Description vocabulary as defined in
this document is <a href="http://www.w3.org/ns/td">http://www.w3.org/ns/td</a>.
</p>
<p>
Using content negotiation, this namespace serves either the TD ontology file (Turtle) or the TD context file (JSON-LD).
</p>
</section>
<section>
<h1>Conformance</h1>
<p>
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.
</p>
<p>
The key words
<em title="MUST" class="rfc2119">MUST</em>,
<em title="MUST NOT" class="rfc2119">MUST NOT</em>,
<em title="REQUIRED" class="rfc2119">REQUIRED</em>,
<em title="SHOULD" class="rfc2119">SHOULD</em>,
<em title="SHOULD NOT" class="rfc2119">SHOULD NOT</em>,
<em title="RECOMMENDED" class="rfc2119">RECOMMENDED</em>,
<em title="MAY" class="rfc2119">MAY</em>,
and <em title="OPTIONAL" class="rfc2119">OPTIONAL</em>
in this specification are to be interpreted as described in [[!RFC2119]].
</p>
<p>
A Thing Description instance complies with this specification if it follows
the normative statements in Section
<a href="#sec-vocabulary-definition"></a>
and Section
<a href="#sec-td-serialization"></a>