-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathhctl.html
325 lines (296 loc) · 22.3 KB
/
hctl.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
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>Web of Things (WoT) Hypermedia Controls Ontology</title>
<script src='https://www.w3.org/Tools/respec/respec-w3c' class='remove'></script>
<script class='remove'>
var respecConfig = {
specStatus: "ED",
latestVersion: null,
// publishDate: "2023-12-05",
group: "wg/wot",
editors: [{
name: "Victor Charpenay"
}, {
name: "Matthias Kovatsch"
}],
edDraftURI: "https://www.w3.org/2019/wot/hypermedia",
shortName: "wot-hctl-ontology",
localBiblio: {
"hydra": {
href: "https://www.hydra-cg.com/spec/latest/core/",
title: "Hydra Core Vocabulary",
publisher: "Hydra W3C Community Group",
authors: [
"Markus Lanthaler"
]
},
"rest" : {
title : "REST: Architectural Styles and the Design of Network-based Software Architectures",
author : "Roy Thomas Fielding",
status : "PhD thesis",
publisher : "University of California, Irvine",
date : "2000"
},
"coral" : {
href : "https://tools.ietf.org/html/draft-hartke-t2trg-coral",
title : "The Constrained RESTful Application Language (CoRAL)",
authors : [ "Klaus Hartke" ],
publisher : "IETF",
status : "Internet-Draft",
date : " March 2019"
}
},
otherLinks: [{
key: "Ontology in RDF",
data: [
{
value: "Web of Things (WoT) Hypermedia Controls Ontology in RDF",
href: "hctl.ttl",
}
]
}
]
};
</script>
</head>
<body>
<section id='abstract'>
<p>
This document introduces an ontology for links and forms, the main hypermedia
controls in use on the Web. This ontology offers, among others, a means to reify
RDF statements interpreted as links between Web resources. It also provides
a versatile exchange format for links and forms in RESTful Web applications.
</p>
<p>
Hypermedia controls are of importance in the fields of the Web of Things and
the Embedded Web, in particular in the W3C Thing Description model and the IETF
Constrained RESTful Application Language.
</p>
</section>
<section id='sotd'>
<p>
Validation of the document by the Working Group is expected by the end of June 2019.
</p>
</section>
<section>
<h2>Introduction</h2>
<p>
The concept of Representational State Transfer (REST) [[rest]] is at the core of most modern
Web applications. The state of a Web resources, exposed via a collection of Web
resources, can be browsed by clients by following <em>links</em> and acted upon by submitting
<em>forms</em> to servers.
</p>
<p>
Links and forms have always be present in Web technologies, including HTML [[html]]. Web
linking [[rfc8288]] is a fundamental principle of the Web architecture that can be leveraged to
drive applications, e.g. when a server returns a link to a newly created resource as the
result of a client's request. Conversely, forms, are request templates that servers can expose
to clients for them to fill in with client-specific information and send back to servers.
Forms are similar in spirit to operation desriptions as defined by the Open API Specification
[[openapis]] or by the Hydra RDF vocabulary [[hydra]].
</p>
<p>
Links and forms are generically referred to as <em>hypermedia controls</em>. They are
of increasing importance in the fields of the Web of Things and the Embedded Web,
which respectively led to the standardization of the Thing Description (TD) model
[[wot-thing-description]] and the Constrained RESTful Application Language (CoRAL)
[[coral]]. The present hypermedia controls ontology is an attempt to formalize the
concepts these two standards specify.
</p>
<p>
Please note that the Turtle version of the ontology can be always obtained by doing content negotiation as explained in <a href="https://www.w3.org/TR/2023/REC-wot-thing-description11-20231205/#json-ld-ctx-usage">Appendix D of the Thing Description Recommendation</a>.
You can include <code>Accept: text/turtle</code> in the request to obtain the Turtle version of this ontology.
</p>
</section>
<section id="conformance"></section>
<section id="terminology">
<h2>Terminology</h2>
<p>The fundamental WoT terminology such as
<dfn class="lint-ignore">Thing</dfn>,
<dfn class="lint-ignore">Consumer</dfn>,
<dfn class="lint-ignore">Thing Description</dfn> (<dfn class="lint-ignore">TD</dfn>),
<dfn class="lint-ignore">Interaction Model</dfn>,
<dfn class="lint-ignore">Interaction Affordance</dfn>,
<dfn class="lint-ignore">Property</dfn>,
<dfn class="lint-ignore">Action</dfn>,
<dfn class="lint-ignore">Event</dfn>,
<dfn class="lint-ignore">Protocol Binding</dfn>,
<dfn class="lint-ignore">Servient</dfn>,
etc. is defined in <a href="https://www.w3.org/TR/wot-architecture/#terminology">Section 3</a>
of the WoT Architecture specification [[WOT-ARCHITECTURE]].
</p>
<p>
The Thing Description terminology such as
<dfn class="lint-ignore">TD Information Model</dfn>,
<dfn class="lint-ignore">TD Document</dfn>,
<dfn class="lint-ignore">Term</dfn> (<dfn class="lint-ignore">Vocabulary Term</dfn>),
etc. is defined in <a href="https://www.w3.org/TR/wot-thing-description/#terminology">Section 3</a>
of the WoT Thing Description specification [[WOT-THING-DESCRIPTION]].
</p>
</section>
<!-- axioms rendered from RDF definitions -->
<section><h2>Axiomatization</h2><section><h3>Classes</h3><section id="AdditionalExpectedResponse"><h4>AdditionalExpectedResponse</h4><p>IRI: <code>https://www.w3.org/2019/wot/hypermedia#AdditionalExpectedResponse</code></p><span>Communication metadata describing the expected response message for additional responses.</span><table class="def numbered"><tbody><tr><td>In the domain of</td><td><code><a href="#hasAdditionalOutputSchema">hctl:hasAdditionalOutputSchema</a></code><br><code><a href="#isSuccess">hctl:isSuccess</a></code></td></tr><tr><td>In the range of</td><td><code><a href="#additionalReturns">hctl:additionalReturns</a></code></td></tr></tbody></table></section>
<section id="ExpectedResponse"><h4>ExpectedResponse</h4><p>IRI: <code>https://www.w3.org/2019/wot/hypermedia#ExpectedResponse</code></p><span>Communication metadata describing the expected response message for the primary response.</span><table class="def numbered"><tbody><tr><td>In the range of</td><td><code><a href="#returns">hctl:returns</a></code></td></tr></tbody></table></section>
<section id="Form"><h4>Form</h4><p>IRI: <code>https://www.w3.org/2019/wot/hypermedia#Form</code></p><span>A form can be viewed as a statement of "To perform an <b><em>operation type</em></b> operation on <b><em>form context</b></em>, make a <b><em>request method</b></em> request to <b><em>submission target</b></em>" where the optional <b><em>form fields</b></em> may further describe the required request. In Thing Descriptions, the <b><em>form context</b></em> is the surrounding Object, such as Properties, Actions, and Events or the Thing itself for meta-interactions.</span><table class="def numbered"><tbody><tr><td>In the domain of</td><td><code><a href="#additionalReturns">hctl:additionalReturns</a></code><br><code><a href="#forContentCoding">hctl:forContentCoding</a></code><br><code><a href="#forContentType">hctl:forContentType</a></code><br><code><a href="#forSubProtocol">hctl:forSubProtocol</a></code><br><code><a href="#hasOperationType">hctl:hasOperationType</a></code><br><code><a href="#hasTarget">hctl:hasTarget</a></code><br><code><a href="#returns">hctl:returns</a></code><br><code><a href="https://www.w3.org/2019/wot/td#hasSecurityConfiguration">td:hasSecurityConfiguration</a></code></td></tr><tr><td>In the range of</td><td><code><a href="https://www.w3.org/2019/wot/td#hasForm">td:hasForm</a></code></td></tr></tbody></table></section>
<section id="Link"><h4>Link</h4><p>IRI: <code>https://www.w3.org/2019/wot/hypermedia#Link</code></p><span>A link can be viewed as a statement of the form "<b><em>link context</em></b> has a <b><em>relation type</em></b> resource at <b><em>link target</em></b>", where the optional <b><em>target attributes</em></b> may further describe the resource.</span><table class="def numbered"><tbody><tr><td>In the domain of</td><td><code><a href="#hasAnchor">hctl:hasAnchor</a></code><br><code><a href="#hasHreflang">hctl:hasHreflang</a></code><br><code><a href="#hasRelationType">hctl:hasRelationType</a></code><br><code><a href="#hasSizes">hctl:hasSizes</a></code><br><code><a href="#hasTarget">hctl:hasTarget</a></code><br><code><a href="#hintsAtMediaType">hctl:hintsAtMediaType</a></code></td></tr><tr><td>In the range of</td><td><code><a href="https://www.w3.org/2019/wot/td#hasLink">td:hasLink</a></code></td></tr></tbody></table></section></section><section><h3>Object Properties</h3><section id="additionalReturns"><h4>additionalReturns</h4><p>IRI: <code>https://www.w3.org/2019/wot/hypermedia#additionalReturns</code></p><span>This optional term can be used if additional expected responses
are possible, e.g. for error reporting. Each additional response needs to be
distinguished from others in some way (for example, by specifying
a protocol-specific response code), and may also have its own data schema.</span><table class="def numbered"><tbody><tr><td>Domain includes</td><td><code><a href="#Form">hctl:Form</a></code></td></tr><tr><td>Range includes</td><td><code><a href="#AdditionalExpectedResponse">hctl:AdditionalExpectedResponse</a></code></td></tr></tbody></table></section>
<section id="hasAdditionalOutputSchema"><h4>hasAdditionalOutputSchema</h4><p>IRI: <code>https://www.w3.org/2019/wot/hypermedia#hasAdditionalOutputSchema</code></p><span>This optional term can be used to define a data schema for
an additional response if it differs from the default
output data schema.
Rather than a <code>DataSchema</code> object, the
name of a previous definition given in a
<code>schemaDefinitions</code> map must be used.</span><table class="def numbered"><tbody><tr><td>Domain includes</td><td><code><a href="#AdditionalExpectedResponse">hctl:AdditionalExpectedResponse</a></code></td></tr></tbody></table></section>
<section id="hasOperationType"><h4>hasOperationType</h4><p>IRI: <code>https://www.w3.org/2019/wot/hypermedia#hasOperationType</code></p><span>Indicates the semantic intention of performing the operation(s) described by the form.</span><table class="def numbered"><tbody><tr><td>Domain includes</td><td><code><a href="#Form">hctl:Form</a></code></td></tr></tbody></table></section>
<section id="returns"><h4>returns</h4><p>IRI: <code>https://www.w3.org/2019/wot/hypermedia#returns</code></p><span>This optional term can be used if, e.g., the output communication metadata differ from input metadata (e.g., output contentType differ from the
input contentType). The response name contains metadata that is only valid for the reponse messages.</span><table class="def numbered"><tbody><tr><td>Domain includes</td><td><code><a href="#Form">hctl:Form</a></code></td></tr><tr><td>Range includes</td><td><code><a href="#ExpectedResponse">hctl:ExpectedResponse</a></code></td></tr></tbody></table></section></section><section><h3>Datatype Properties</h3><section id="forContentCoding"><h4>forContentCoding</h4><p>IRI: <code>https://www.w3.org/2019/wot/hypermedia#forContentCoding</code></p><span>Content coding values indicate an encoding transformation that has been or can be applied to a representation. Content codings are primarily used to allow a representation to be compressed or otherwise usefully transformed without losing the identity of its underlying media type and without loss of information. Examples of content coding include "gzip", "deflate", etc. </span><table class="def numbered"><tbody><tr><td>Domain includes</td><td><code><a href="#Form">hctl:Form</a></code></td></tr><tr><td>Range includes</td><td><code><a href="http://schema.org/Text">schema:Text</a></code></td></tr></tbody></table></section>
<section id="forContentType"><h4>forContentType</h4><p>IRI: <code>https://www.w3.org/2019/wot/hypermedia#forContentType</code></p><span>Assign a content type based on a media type [[IANA-MEDIA-TYPES]] (e.g., 'text/plain') and potential parameters (e.g., 'charset=utf-8') for the media type.</span><table class="def numbered"><tbody><tr><td>Domain includes</td><td><code><a href="#Form">hctl:Form</a></code></td></tr><tr><td>Range includes</td><td><code><a href="http://schema.org/Text">schema:Text</a></code></td></tr></tbody></table></section>
<section id="forSubProtocol"><h4>forSubProtocol</h4><p>IRI: <code>https://www.w3.org/2019/wot/hypermedia#forSubProtocol</code></p><span>Indicates the exact mechanism by which an interaction will be accomplished for a given protocol when there are multiple options.
For example, for HTTP and Events, it indicates which of several available mechanisms should be used for asynchronous notifications such as long polling, websub (also see https://www.w3.org/TR/websub/), or server sent events (also see https://www.w3.org/TR/eventsource/). Please note that there is no restriction on the sub-protocol selection and other mechanisms can also be announced by this subprotocol term.</span><table class="def numbered"><tbody><tr><td>Domain includes</td><td><code><a href="#Form">hctl:Form</a></code></td></tr><tr><td>Range includes</td><td><code><a href="http://schema.org/Text">schema:Text</a></code></td></tr></tbody></table></section>
<section id="hasAnchor"><h4>hasAnchor</h4><p>IRI: <code>https://www.w3.org/2019/wot/hypermedia#hasAnchor</code></p><span>By default, the context, or anchor, of a link conveyed in the Link header field is the URL of the representation it is associated with, as defined in RFC7231, Section 3.1.4.1, and is serialized as a URI.</span><table class="def numbered"><tbody><tr><td>Domain includes</td><td><code><a href="#Link">hctl:Link</a></code></td></tr></tbody></table></section>
<section id="hasHreflang"><h4>hasHreflang</h4><p>IRI: <code>https://www.w3.org/2019/wot/hypermedia#hasHreflang</code></p><span>The hreflang attribute specifies the language of a linked document. The value of this must be a valid language tag [[BCP47]].</span><table class="def numbered"><tbody><tr><td>Domain includes</td><td><code><a href="#Link">hctl:Link</a></code></td></tr></tbody></table></section>
<section id="hasRelationType"><h4>hasRelationType</h4><p>IRI: <code>https://www.w3.org/2019/wot/hypermedia#hasRelationType</code></p><span>A link relation type identifies the semantics of a link.</span><table class="def numbered"><tbody><tr><td>Domain includes</td><td><code><a href="#Link">hctl:Link</a></code></td></tr></tbody></table></section>
<section id="hasSizes"><h4>hasSizes</h4><p>IRI: <code>https://www.w3.org/2019/wot/hypermedia#hasSizes</code></p><span>Target attribute that specifies one or more sizes for the referenced icon. Only applicable for relation type 'icon'. The value pattern follows {Height}x{Width} (e.g., "16x16", "16x16 32x32")</span><table class="def numbered"><tbody><tr><td>Domain includes</td><td><code><a href="#Link">hctl:Link</a></code></td></tr></tbody></table></section>
<section id="hasTarget"><h4>hasTarget</h4><p>IRI: <code>https://www.w3.org/2019/wot/hypermedia#hasTarget</code></p><span>target IRI of a link or submission target of a form.</span><table class="def numbered"><tbody><tr><td>Domain includes</td><td><code><a href="#Form">hctl:Form</a></code><br><code><a href="#Link">hctl:Link</a></code></td></tr></tbody></table></section>
<section id="hintsAtMediaType"><h4>hintsAtMediaType</h4><p>IRI: <code>https://www.w3.org/2019/wot/hypermedia#hintsAtMediaType</code></p><span>Target attribute providing a hint indicating what the media type [IANA-MEDIA-TYPES] of the result of dereferencing the link should be.</span><table class="def numbered"><tbody><tr><td>Domain includes</td><td><code><a href="#Link">hctl:Link</a></code></td></tr><tr><td>Range includes</td><td><code><a href="http://schema.org/Text">schema:Text</a></code></td></tr></tbody></table></section>
<section id="isSuccess"><h4>isSuccess</h4><p>IRI: <code>https://www.w3.org/2019/wot/hypermedia#isSuccess</code></p><span>Signals if the additional response should not be considered an error.</span><table class="def numbered"><tbody><tr><td>Domain includes</td><td><code><a href="#AdditionalExpectedResponse">hctl:AdditionalExpectedResponse</a></code></td></tr><tr><td>Range includes</td><td><code><a href="http://schema.org/Boolean">schema:Boolean</a></code></td></tr></tbody></table></section></section><section><h3>Annotation Properties</h3><p>No AnnotationProperty found in the ontology.</p></section></section>
<section>
<h2>Alignments</h2>
<section>
<h3>Hydra</h3>
<p>
The following table gives alignment between the hypermedia controls
ontology and <a href="http://www.w3.org/ns/hydra/core#">Hydra</a>,
an alternative vocabulary for hypermedia-driven Web APIs. Each row
represents a close match between two classes. These alignments are
not to be understood as formal semantic equivalences but rather as
hints to Hydra users.
</p>
<table class="def">
<tbody>
<tr>
<td><code>hctl:Link</code></td>
<td><code>hydra:Link</code></td>
</tr>
<tr>
<td><code>hctl:Form</code></td>
<td><code>hydra:Operation</code></td>
</tr>
</tbody>
</table>
</section>
</section>
<section>
<h2>Usage Examples</h2>
<section>
<h3>JSON Representation of Links & Forms</h3>
<p>
Same terms as specified by JSON hyper-schema and the TD model.
</p>
<aside class="example" title="JSON-LD context for hypermedia controls">
<pre>
{
"@context": {
"@vocab": "https://www.w3.org/2019/wot/hypermedia#",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"href": { "@id": "hasTarget" },
"rel": { "@id": "hasRelationType", "@type": "@vocab" },
"anchor": { "@id": "hasAnchor", "@type": "@id" },
"type": { "@id": "hintsAtMediaType" },
"op": { "@id": "rdf:type"; "@type": "@vocab" },
"contentType": { "@id": "forContentType" },
"contentCoding": { "@id": "forContentCoding" },
"subprotocol": { "@id": "forSubProtocol" },
"response": { "@id": "returns" },
"readproperty": { "@id": "ReadPropertyOperation" },
"writeproperty": { "@id": "WritePropertyOperation" },
"observeproperty": { "@id": "ObservePropertyOperation" },
"unobserveproperty": { "@id": "UnobservePropertyOperation" },
"readmultipleproperties": { "@id": "ReadMultiplePropertiesOperation" },
"writemultipleproperties": { "@id": "WriteMultiplePropertiesOperation" },
"readallproperties": { "@id": "ReadAllPropertiesOperation" },
"writeallproperties": { "@id": "WriteAllPropertiesOperation" },
"invokeaction": { "@id": "InvokeActionOperation" },
"subscribeevent": { "@id": "SubscribeEventOperation" },
"unsubscribeevent": { "@id": "UnsubscribeEventOperation" }
}
}
</pre>
</aside>
<p>
OCF example (equivalent to an OpenAPI definition). HTTP in RDF vocabulary.
</p>
<aside class="example" title="Links and forms for an OCF temperature sensor">
<pre>
{
"@context": [
...,
{
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"htv": "http://www.w3.org/2011/http#"
}
],
"@graph": [
{
"href": "https://openconnectivityfoundation.github.io/IoTDataModels/TemperatureResURI.swagger.json",
"rel": "rdfs:seeAlso"
},
{
"href": "/TemperatureResURI",
"op": "readproperty",
"htv:methodName": "GET",
"response": [
{ "htv:statusCodeNumber": 200 },
{ "htv:statusCodeNumber": 403 }
]
},
{
"href": "/TemperatureResURI",
"op": "writeproperty",
"htv:methodName": "POST",
"response": [
{ "htv:statusCodeNumber": 200 },
{ "htv:statusCodeNumber": 403 }
]
}
]
}
</pre>
</aside>
</section>
<section>
<h3>Reified Links</h3>
<aside class="example" title="Reified link">
<pre class="split-example">
{
"@context": { "about": "http://schema.org/about" },
"@id": "https://en.wikipedia.org/wiki/Web_of_Things",
"about": "http://www.wikidata.org/entity/Q2814098"
}
</pre>
<pre class="split-example">
{
"@context": [
...,
{ "about": "http://schema.org/about" }
],
"links": [
{
"anchor": "https://en.wikipedia.org/wiki/Web_of_Things",
"rel": "about",
"href": "http://www.wikidata.org/entity/Q2814098"
}
]
}
</pre>
</aside>
<p>
Either as RDF statements or as reified statements. Primarily for WoT compatibility but also e.g. to include validity metadata.
</p>
</section>
</section>
</body>
</html>