Copyright © 2017-2025 World Wide Web Consortium. W3C® liability, trademark and permissive document license rules apply.
この文書は、Web of Things (WoT) Thing Description (TD) バージョン 2.0 のための、正式な情報モデルと 共通表現を記述する。Thing Description は、 Things のメタデータとインターフェイスを記述するものであり、 ここで Thing は、相互作用を提供し、 Web of Things に参加する物理的または仮想的なエンティティの抽象である。 Thing Description は、小さな語彙に基づく 一連の相互作用を提供し、多様なデバイスを統合することと、 多様なアプリケーションの相互運用を可能にする。Thing Description は、既定では JSON-LD 処理も可能な JSON 形式で符号化される。 後者は、Things に関する知識を機械可読な 方法で表現するための強力な基盤を提供する。Thing Description インスタンスは、 Thing 自身によってホストすることも、 Thing に リソース上の制約(例: 限られたメモリ空間)がある場合や、 Web of Things 互換のレガシーデバイスに Thing Description を後付けする場合には外部でホストすることもできる。 さらに、この文書は Thing Model を導入する。Thing Model により、 作成者は Internet of Things (IoT) エンティティのモデルまたはクラスのみを 記述できる。Thing Model は Thing Description インスタンスの テンプレートと見なすことができるが、特定の通信メタデータに対する 要件が存在しない、または少ないなど、制約が軽減されている。
この仕様は [WOT-THING-DESCRIPTION11] の作業を継続するものであり、後方互換性は保証されない。 後方互換性がない場合、実装者が新しいバージョンへ移行するための 具体的なガイドラインが提供される。
このセクションは、この文書の公開時点における ステータスを説明する。現在の W3C 公開物の一覧と、この技術報告書の 最新改訂版は、 W3C 標準および草案 インデックスで確認できる。
この文書は、Web of Things Working Group により、Recommendation track を用いて First Public Working Draft として公開された。
First Public Working Draft としての公開は、 W3C およびそのメンバーによる承認を意味しない。
これは草案文書であり、いつでも更新、置換、または 他の文書によって廃止される可能性がある。この文書を進行中の作業以外のものとして 引用することは適切ではない。
この文書は、 W3C Patent Policy の下で運営されるグループにより作成された。 W3C は、このグループの成果物に関連して行われた すべての 特許開示の公開リストを維持している。そのページには、 特許を開示するための手順も含まれている。 個人が、その個人が Essential Claim(s) を含むと考える特許について実際の知識を有する場合、 その個人は W3C Patent Policy 第 6 章に従って情報を開示しなければならない。
この文書は、2025年8月18日版 W3C Process Document によって管理される。
このセクションは非規範的である。
WoT Thing Description (TD) は、 W3C Web of Things (WoT) における中心的な構成要素であり、 Thing の入口 (Web サイトの index.html のようなもの)と見なすことができる。 TD インスタンスには、5 つの主要な構成要素がある。 Thing 自体に関するテキストメタデータ、 Interaction Affordances の集合( Thing を どのように使用できるかを示すもの)、 機械理解性のために Thing と 交換されるデータの スキーマ、 相互作用に使用しなければならないセキュリティ機構に関するメタデータを提供する Security Definitions、そして最後に、 他の Things または Web 上の文書との 形式的または非形式的な関係を表現するための Web リンク である。
W3C WoT の
Interaction Model は、
Interaction
Affordances の 3 種類を定義する。Properties(
PropertyAffordance
クラス)は、現在値の取得や動作状態の設定など、
パラメーターの検知および制御に使用できる。
Actions(ActionAffordance クラス)は、
物理的な(したがって時間を要する)プロセスの呼び出しをモデル化するが、
既存プラットフォームの RPC 的な呼び出しを抽象化するためにも使用できる。
Events(EventAffordance クラス)は、
通知、離散イベント、または値のストリームが受信者に非同期に送信される
通信のプッシュモデルに使用される。詳細については
[wot-architecture11]
を参照。
一般に、TD は、URI スキーム [RFC3986]
(例: http、coap など
[IANA-URI-SCHEMES])
によって識別される異なる
Protocol Bindings、
メディアタイプ [RFC2046]
に基づくコンテンツタイプ
(例: application/json、
application/xml、application/cbor、
application/exi など [IANA-MEDIA-TYPES])、および
セキュリティ機構(認証、認可、機密性など)のための
メタデータを提供する。TD インスタンスのシリアル化は
JSON [RFC8259]
に基づき、JSON 名はこの仕様文書で定義される
TD 語彙の用語を参照する。さらに TD の JSON
シリアル化は、拡張および豊かなセマンティック処理を可能にするため、
JSON-LD 1.1 [JSON-LD11] の構文に従う。
例 1 は TD インスタンスを示し、 MyLampThing というタイトルのランプ Thing を記述することにより、Properties、Actions、および Events を伴う Interaction Model を例示している。
この TD 例から、タイトルが
status である 1 つの
Property affordance が存在することが分かる。
さらに、この Property が(安全な形式の)HTTP プロトコルを介して、
URI https://mylamp.example.com/status における
GET メソッドでアクセス可能であり(forms 構造内の
href メンバーによって通知される)、
文字列ベースのステータス値を返すことを示す情報が提供されている。
GET メソッドの使用は明示的には述べられていないが、
この文書で定義される既定の前提の 1 つである。
同様に、
https://mylamp.example.com/toggle リソース上で
POST メソッドを使用してスイッチ状態を切り替えるための
Action
affordance が指定されている。ここでも、POST は
Actions を呼び出すための既定の前提である。
Event affordance は、
Thing
によって非同期メッセージを送信できるようにする機構を可能にする。
ここでは、ランプの過熱イベントが発生する可能性について通知を受けるための
サブスクリプションを、HTTP とその long polling サブプロトコルを使用して
https://mylamp.example.com/oh 上で取得できる。
この例では、アクセスにユーザー名とパスワードを要求する
basic セキュリティスキームも指定している。
セキュリティスキームは、まず securityDefinitions で名前を与えられ、
次に security セクションでその名前を指定することにより
有効化されることに注意。この例は、HTTP プロトコルの使用と組み合わせて、
HTTP Basic Authentication の使用を示している。
トップレベルで少なくとも 1 つのセキュリティスキームを指定することは必須であり、
各リソースの既定のアクセス要件を与える。ただし、セキュリティスキームは
form ごとに指定することもでき、form レベルで与えられた構成は
Thing レベルで与えられた構成を上書きするため、
きめ細かなアクセス制御を指定できる。また、アクセス制御機構を使用しないことを示すために、
特別な nosec セキュリティスキームを使用することも可能である。
追加の例は後で提供される。
Thing Description は、何らかの名前空間内に
コンテキスト定義を追加する可能性を提供する。この機構は、
与えられた名前空間の下で、特定のアプリケーション領域に対する
論理規則などの形式的知識が見つかる場合に、Thing Description インスタンスの
内容へ追加のセマンティクスを統合するために使用できる。
コンテキスト情報は、forms フィールドで宣言された
基礎となる通信プロトコルの構成や振る舞いを指定する助けにもなる。
例 2 は、
@context に 2 つ目の定義を導入して、
接頭辞 saref が
SAREF、すなわち
Smart Appliance Reference Ontology [SMARTM2M]
を参照することを宣言することにより、例 1 の TD サンプルを拡張している。
この IoT オントロジーには、@type フィールドの値として設定できる
セマンティックラベルとして解釈される用語が含まれ、
Things とその
Interaction
Affordances の意味を与える。以下の例では、
Thing は
saref:LightSwitch でラベル付けされ、
status
Property は
saref:OnOffState で、そして
toggle Action
は saref:ToggleCommand でラベル付けされている。
何らかの @context 内部の宣言機構は
JSON-LD によって指定される。TD インスタンスは、その仕様の
バージョン 1.1 に適合する
[json-ld11]。
したがって、TD インスタンスは RDF 文書として処理することもできる
(セマンティック処理の詳細については、
付録 D. JSON-LD Context
Usage および名前空間 IRI の下の文書、たとえば
https://www.w3.org/2019/wot/td を参照)。
Thing Description の主な意図の 1 つは、 Consumer に、 Thing と正常に相互作用するために必要な すべての詳細を提供することである。一部の IoT アプリケーションシナリオでは、 完全に詳細な Thing Description、 たとえば通信メタデータを伴うものは不要な場合がある (例: IoT エコシステムが通信を別個に暗黙的に処理する場合)、 または新しいエンティティがまだデプロイされていないため利用できない場合がある (例: IP アドレスがまだ不明である場合)。場合によっては、 生成されるすべてのインスタンスで利用可能であるべき能力定義を強制する 一種のクラス定義も必要になる(例: 新しいデバイスの大規模生産)。
上記のシナリオやその他のシナリオに対処するため、 Thing Model を使用できる。これは主として、 Things の Properties、Actions、および/または Events 内の データモデル定義を提供し、 Thing Description インスタンスを作成するためのテンプレートとして潜在的に使用できる。 以下では、例 1 の Thing Description インスタンスのモデルと見なすことができる サンプルの Thing Model を示す。
{
"@context": ["https://www.w3.org/ns/wot-next/td"],
"@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"}
}
}
}
Thing
Model 定義は、"@type":
"tm:ThingModel" によって識別される。例が示すように、
通信およびセキュリティメタデータを欠いているため、
単一の Thing
インスタンスに関する詳細は
提供しない。この仕様は、そのような
Thing
Model 定義から
有効な Thing
Description インスタンスを導出するための機構を提示する。
さらに、既存の
Thing
Model
定義を上書き、拡張、再利用する方法を含む、
その他の設計概念も規定されている。
非規範的と示されたセクションに加え、この仕様におけるすべての作成ガイドライン、 図、例、および注記は非規範的である。この仕様のそれ以外のすべては 規範的である。
この文書におけるキーワード MAY、MUST、MUST NOT、 RECOMMENDED、SHOULD、および SHOULD NOT は、ここに示すようにすべて大文字で現れる場合に限り、 BCP 14 [RFC2119] [RFC8174] に記述されるとおりに解釈される。
Thing Description インスタンスは、 Thing Description シリアル化に関して、 5. TD Information Model および 6. TD Representation Format における規範的記述に従う場合、この仕様に適合する。
Thing Description インスタンスを検証するための JSON Schema [JSON-SCHEMA] は、付録 B. JSON Schema for TD Instance Validation で提供されている。
このセクションは非規範的である。
Thing、Consumer、Producer、Thing Description (TD)、Partial TD、 Thing Model (TM)、Interaction Model、Interaction Affordance、IoT Platform、Property、Action、Event、Data Schema、Content Type、Protocol Binding、Servient、Vocabulary、Term、Vocabulary Term、WoT Interface、および WoT Runtime などの基本的な WoT 用語は、 WoT Architecture 仕様 [wot-architecture11] の 第 3 章で定義されている。
さらに、この仕様は次の定義を導入する:
@type
メンバーを使用し、コロン(:)を用いた文字列接頭辞を使用することで
実現できる。
Thing クラスの
Instance Relation に関する
制約を満たせない
Thing Descriptions
を検出できる。その目的のために、TD Processor
は、可能なすべての Default Values が割り当てられた
Thing Descriptions
の形式を補完して計算できる。
TD
Processor は通常、WoT Runtime のサブシステムである。
TD Processor の実装は、TD Documents にシリアル化できる TD
producer、TD Documents から
デシリアル化できる TD consumer、またはその両方であり得る。
@context などの用語が定義される TD のルートは
Thing level であり、forms は Affordance level 内で定義され、
type、maximum は
Data Schema level 内で定義され、href は Forms level 内で定義される。
定義されていない場合でも、Links level など他のレベルを使用できる。
http:// または https:// で始まる
href を持つ Form である。
これらの定義は、5.2 準備事項でさらに展開される。
この仕様の 5. TD Information Model で定義される TD Information Model のバージョンは、 次の IRI によって識別される:
https://www.w3.org/ns/wot-next/td
この IRI [RFC3987] は、 URI [RFC3986] でもあり、 JSON-LD context file [json-ld11] を取得するために 参照解決できる。これにより、TD Documents 内のコンパクトな文字列を、 完全な IRI ベースの Vocabulary Terms に展開できる。ただし、この処理が必要になるのは、 JSON ベースの TD Documents を RDF に変換する場合のみであり、 これは TD Processor 実装の任意機能である。
この名前空間は、仕様が Recommendation ステータスに達するまでの 一時的なものであることに注意。その時点で、永続的な名前空間が割り当てられる。 一時名前空間を使用するすべての文書は、仕様の git リポジトリの main ブランチを指すため、安定していない。
本仕様では、Vocabulary Terms は常に コンパクト形式で提示される。その展開形式は、それらが属する Vocabulary の名前空間 IRI の下で アクセスできる。これらの名前空間は、5.3 Class Definitions の構造に従う。 TD Information Model で使用される 各 Vocabulary は、それぞれ次の独自の名前空間 IRI を持つ:
| 語彙 | 名前空間 IRI |
|---|---|
| Core |
https://www.w3.org/ns/wot-next/td-ontology
|
| Data Schema |
https://www.w3.org/ns/wot-next/json-schema-ontology
|
| Security |
https://www.w3.org/ns/wot-next/security-ontology
|
| Hypermedia Controls |
https://www.w3.org/ns/wot-next/security-ontologyy
|
Thing Model 定義のために 追加で使用されるすべての語彙は、次の名前空間 IRI を持つ:
| 語彙 | 名前空間 IRI |
|---|---|
| Thing Model |
https://www.w3.org/ns/wot-next/tm-ontology
|
Vocabularies は互いに独立している。
それらは他の
W3C
仕様で再利用および拡張され得る。
Vocabulary の設計における
すべての破壊的変更には、新しい年ベースの名前空間 URI の割り当てが必要となる。
TD
Information Model の全体的な一貫性を
維持するため、関連する JSON-LD context file は、各バージョンが独自の URI
(v1、v1.1、
v2、...)を持つようにバージョン管理され、
非破壊的変更、特に新しい Terms
の追加も識別することに注意。
何らかの名前空間 IRI の下にある Vocabulary は 非破壊的変更のみを受けることができるため、その内容はアプリケーション内で 安全にキャッシュまたは埋め込みできる。名前空間 IRI の下で比較的静的な内容を 公開する利点の 1 つは、制約のあるデバイス間で交換されるメッセージの ペイロードサイズを最適化することである。また、プライベートネットワークから 公開語彙へアクセスするデバイスに起因するプライバシー漏洩も回避する (12. プライバシーの考慮事項も参照)。
このセクションでは、TD Information Model を導入する。 TD Information Model は、Thing Descriptions の処理およびそれらのシリアル化のための概念的基盤として機能する。 シリアル化については、 6. TD Representation Format で別途説明する。
TD Information Model は、次の独立した Vocabularies に基づいて構築される:
これらの Vocabularies はそれぞれ、本質的には データ構造を構築するために使用できる Terms の集合であり、伝統的なオブジェクト指向の意味でのオブジェクトとして解釈される。 オブジェクトはクラスのインスタンスであり、プロパティを持つ。 W3C WoT の文脈では、 それらは Things と その Interaction Affordances を表す。オブジェクトの形式的な定義は 5.2 準備事項で 与えられる。次に、 TD Information Model の主要要素を 5.3 Class Definitions で示す。 Default Values が存在する場合、TD 内で特定のオブジェクトプロパティを省略できる。 既定値の一覧は 5.4 Default Value Definitions で与えられる。
次に示す UML 図は、
TD
Information Model の概要を与える。
これはすべてのクラスを表として表し、Thing クラスから
始まる、クラス間に存在する関連を有向矢印として表す。
読みやすさのため、この図は 4 つの基礎
Vocabularies それぞれに対応する
4 つの部分に分割されている。
木ベースの文書に対する単純な規則(すなわち、生の JSON 処理)と、豊かな Semantic Web ツール(すなわち、JSON-LD 処理)の両方によって容易に処理できるモデルを提供するため、 この文書は、TD Information Model を構築するために、次の形式的な準備事項を定義する。
このセクションのすべての定義は 集合 を参照する。 集合は直観的には要素の集まりであり、その要素自体が集合であってもよい。 任意に複雑なデータ構造は、集合の観点から定義できる。特に、 Object は、次のように再帰的に定義される データ構造である:
この定義は、Objects が同じ名前を持つ複数の name-value pair を含むことを妨げないが、この仕様では通常それらを考慮しない。 要素が名前として数値のみを持つ Object は Array と呼ばれる。同様に、 要素が名前として(いかなる Vocabulary にも属さない) Term のみを 持つ Object は Map と呼ばれる。 Map 内の name-value pair に現れる すべての名前は、その Map のスコープ内で 一意 であると仮定される。
さらに、Object は 何らかの Class のインスタンスであり得る。 Vocabulary Term によって表される Class は、まず Signature と呼ばれる Vocabulary Terms の集合によって定義される。 Signature が空である Class は、 Simple Type と呼ばれる。
Class の
Signature は、
Classes
をさらに定義する 2 つの関数、
すなわち Assignment Function と Type Function
を構築できる。
Class の
Assignment Function
は、その Class の
Signature に属する
Vocabulary Term を入力として受け取り、
出力として true または false を返す。
直観的には、Assignment Function
は、Class
をインスタンス化するとき、
Signature の要素が必須か任意かを示す。
Class の
Type Function も、
その Class の
Signature に属する
Vocabulary Term を入力として受け取り、
出力として別の Class を返す。
これらの関数は 部分的 であり、その定義域は定義される
Class の
Signature に限定される。
これら 2 つの関数に基づいて、 Object と Class から構成される対について、 Instance Relation を定義できる。 この関係は、満たされるべき制約として定義される。すなわち、 次の 2 つの制約が 両方 満たされる場合、 Object は Class の インスタンスである:
true を返すすべての
Term について、
Object
が、その
Vocabulary Term を名前とする
name-value pair を含む場合。
上記の定義によれば、Object は、その構造にかかわらず、
すべての Simple
Type のインスタンスになることになる。代わりに、
Simple
Types については、Instance Relation の別の定義を導入する。
Object
は、所定の字句形式を持つ
Term
である場合、
Simple Type のインスタンスである
(例: boolean 型では true、false、
unsignedInt 型では 1、2、
3、... など)。
さらに、Parameterized Classes と呼ばれる追加の Classes を、汎用的な Map および Array 構造から導出できる。 Object は、 それが Map であり、 かつそれに含まれるすべての name-value pair の値がこの Class のインスタンスであるような場合、 何らかの Class の Map、 すなわち何らかの Class で パラメーター化 された Map 型の インスタンスである。同じことが Arrays にも当てはまる。
最後に、Class は、 前者のすべてのインスタンスが後者のインスタンスでもある場合、 何らかの他の Class の Subclass である。
上記のすべての定義を踏まえると、
TD
Information Model は、
Class 名(
Vocabulary Term)、
Signature(
Vocabulary Terms の集合)、
Assignment Function、
および Type
Function を含む
Class
定義の集合として理解されるべきである。
これらの Class
定義は、5.3 Class Definitions
の表として提供される。
各表について、assignment 列の値 "mandatory"(それぞれ "optional")は、
対応する Vocabulary Term に対して
Assignment Function
が true(それぞれ false)を返すことを示す。
慣例により、Simple Types は、小文字で始まる名前で表される。
TD Information Model
は、XML Schema [XMLSCHEMA11-2-20120405]
で定義される次の
Simple Types を参照する:
string、anyURI、
dateTime、integer、
unsignedInt、double、および
boolean。それらの定義(すなわち、それらの字句形式の仕様)は、
TD
Information Model の範囲外である。
さらに、TD
Information Model は、
Vocabulary Terms の対に対する
大域関数を定義する。この関数は
Class 名と別の
Vocabulary Term を入力として受け取り、
Object
を返す。
返された Object が null と異なる場合、
それは入力 Class
のインスタンス内における、
入力 Vocabulary Term への何らかの割り当てに対する
Default Value を表す。この関数により、
Assignment Function に関して
上で定義された制約を緩和できる。すなわち、
Object
は、すべての必須割り当てを含む場合、または 欠落した割り当てに対して
Default Value が存在する場合、
Class の
インスタンスである。すべての
Default Values は、
5.4 Default Value
Definitions の表で与えられる。
5.3 Class Definitions の各表では、
TD
Information
Model における
Class と
Vocabulary Term の
対応する組み合わせに対して
Default Value が利用可能な場合、
assignment 列には "with default" という値が含まれる。
ここで導入された形式化は、抽象データ構造としての Objects と、 Things などの物理世界のオブジェクトとの 間にあり得る関係を考慮しない。ただし、 TD Information Model に関与するすべての Vocabulary Terms を、 RDF リソースとして再解釈し、物理世界のより大きなモデル(オントロジー)に 統合できる可能性には注意が払われている。 セマンティック処理の詳細については、 D. JSON-LD Context Usage と、 名前空間 IRI の下の文書、たとえば https://www.w3.org/2019/wot/td を参照。
A TD Processor は、5.3.1 コア語彙 定義、5.3.2 データスキーマ 語彙定義、5.3.3 セキュリティ語彙 定義、および 5.3.4 ハイパーメディア制御 語彙定義で定義されるすべての Classes について、Class のインスタンス化制約を MUST 満たす。
特に、すべての語彙用語と値は大文字・小文字を区別することに注意。 これは情報モデルのシリアル化 (6. TD 表現形式)にも当てはまる。
メタデータとインターフェイスが WoT Thing Description によって記述される、物理的または仮想的なエンティティの抽象。 ここで仮想的なエンティティは、1 つ以上の Things の合成である。
| 語彙用語 | 説明 | 割り当て | 型 |
|---|---|---|---|
@context |
TD 文書全体で使用される、terms と呼ばれる 短縮名を定義する JSON-LD キーワード。 | 必須 |
anyURI または Array
|
@type |
オブジェクトに semantic tags (または型)を付与する JSON-LD キーワード。 | 任意 |
string または Array of
string
|
id |
URI 形式の Thing の識別子 [RFC3986] (例: 安定 URI、一時的で変更可能な URI、ローカル IP アドレスを持つ URI、 URN など)。 | 任意 |
anyURI
|
title |
既定言語に基づく人間可読なタイトル (例: UI 表現用のテキストを表示)を提供する。 | 必須 |
string
|
titles |
複数言語の人間可読なタイトル (例: 異なる言語で UI 表現用のテキストを表示)を提供する。 MultiLanguage も参照。 | 任意 |
Map of MultiLanguage
|
description |
既定言語に基づく追加の(人間可読な) 情報を提供する。 | 任意 |
string
|
descriptions |
異なる言語による(人間可読な) 情報をサポートするために使用できる。 MultiLanguage も参照。 | 任意 |
Map of MultiLanguage
|
version |
バージョン情報を提供する。 | 任意 |
VersionInfo
|
created |
TD インスタンスが作成された時点に関する 情報を提供する。 | 任意 |
dateTime
|
modified |
TD インスタンスが最後に変更された時点に関する 情報を提供する。 | 任意 |
dateTime
|
support |
TD メンテナーに関する情報を URI スキームとして
提供する(例: mailto
[RFC6068]、
tel [RFC3966]、
https [RFC9112])。
|
任意 |
anyURI
|
base |
TD 文書全体のすべての相対 URI 参照に使用される
ベース URI を定義する。TD インスタンスでは、すべての相対 URI は
[RFC3986]
で定義されるアルゴリズムを用いて、ベース URI を基準に解決される。base は、@context で使用される URI、
および TD インスタンスにセマンティック処理が適用される場合に関連する
Linked Data [LINKED-DATA]
グラフ内で使用される IRI には影響しない。
|
任意 |
anyURI
|
properties |
Thing のすべての Property ベースの Interaction Affordances。 | 任意 |
Map of PropertyAffordance
|
actions |
Thing のすべての Action ベースの Interaction Affordances。 | 任意 |
Map of ActionAffordance
|
events |
Thing のすべての Event ベースの Interaction Affordances。 | 任意 |
Map of EventAffordance
|
links |
指定された Thing Description に関連する任意のリソースへの Web リンクを提供する。 | 任意 |
Array of Link
|
forms |
操作をどのように実行できるかを記述する form ハイパーメディア制御の集合。 Forms は Protocol Bindings のシリアル化である。 Thing level forms は、interaction affordances のグループのエンドポイントを 記述するために使用される。 | 任意 |
Array of Form
|
security |
securityDefinitions で定義されたものから選択される
セキュリティ定義名の集合。
リソースへアクセスするには、これらすべてが満たされなければならない。 |
必須 |
string または Array of
string
|
securityDefinitions |
名前付きセキュリティ構成の集合
(定義のみ)。security
name-value pair で名前が使用されない限り、実際には適用されない。 |
必須 |
Map of SecurityScheme
|
profile |
この Thing Description および対応する Thing 実装が従う WoT Profile 機構を示す。 | 任意 |
anyURI または Array of
anyURI
|
schemaDefinitions |
名前付きデータスキーマの集合。
AdditionalExpectedResponse
オブジェクト内の schema name-value pair で
使用される。
|
任意 |
Map of DataSchema
|
uriVariables |
[RFC6570] に従って、
DataSchema 宣言に基づく集合として URI テンプレート変数を定義する。
Thing
level
の uriVariables は、
Thing
level
forms または Interaction Affordances で使用できる。
個々の変数 DataSchema は ObjectSchema または ArraySchema にすることはできない。
各変数は、操作の実行時に href 内で文字列へ
シリアル化される必要があるためである。同じ変数が
Thing level
uriVariables と Interaction
Affordance level の両方で宣言されている場合、Interaction Affordance
level の変数が優先される。
|
任意 |
Map of DataSchema
|
以下の @context URL 規則に関する
リスト項目は、大きく変更される予定である。
@context については、
Thing Description
インスタンスに対して次の規則が定義される:
@context name-value pair は、文書を TD 1.1 として識別し、
Consumers が新たに導入された用語を
使用できるようにするため、anyURI
https://www.w3.org/2022/wot/td/v1.1 を
含まなければならない(MUST)。https://www.w3.org/2019/wot/td/v1
は最初の項目でなければならず(MUST)、
https://www.w3.org/2022/wot/td/v1.1
は 2 番目の項目でなければならない
(MUST)。@context が Array である場合、anyURI
https://www.w3.org/2022/wot/td/v1.1
の後に、型 anyURI または型
Map の要素を任意の順序で続けてもよい
(MAY)が、
@context Array 内のすべての name-value pair を含む
Map
は 1 つだけ含めることが推奨される
(RECOMMENDED)。@context Array に含まれる
Maps は、値が型
anyURI の名前空間識別子であり、
名前がその名前空間を表す
Term または接頭辞である
name-value pair を含んでもよい
(MAY)。@context Array に含まれる 1 つの
Map は、
Thing Description の既定言語を定義する name-value pair を含むべきである
(SHOULD)。ここで、名前は
Term @language であり、
値は [BCP47]
で定義される整形式の言語タグである
(例: en、de-AT、
gsw-CH、zh-Hans、
zh-Hant-HK、
sl-nedis)。Thing Description および Thing Model インスタンス内のすべての人間可読テキストの基底方向を決定するため、 この仕様は、基底方向メタデータを関連付ける組み込み機構が利用できない場合に、 [STRING-META] の 文字列固有の方向情報に関する指針に従うことを推奨する。
TD Processors は、双方向テキストを処理する際の特定の特殊ケースを 認識しておくべきである。TD Processors は、 ユーザーに文字列を提示するとき、特に周囲のテキストに埋め込む場合 (例: Web ユーザーインターフェイス)には、 bidi isolation を使用するよう注意すべきである (SHOULD)。 言語が適切に識別されている場合でも、混在方向テキストは任意の言語で発生し得る。
TD producers は、 素朴なユーザーエージェントでも正常に表示できる方法で 混在方向文字列を提供するよう試みるべきである (SHOULD)。 たとえば、RTL 文字列が LTR の並び(数字、ラテン文字のブランド名や商標名など)で始まる場合、 文字列の先頭に RLM 文字を含める、または反対方向の並びを bidi controls で 囲むことで、適切な表示を支援できる。
Strings on the Web: Language and Direction Metadata [string-meta] は、双方向テキストを使用する際の指針を提供し、多くの落とし穴を例示している。
properties、
actions、および events
Maps
内に明示的に提供される
Interaction
Affordances に加えて、Thing は
meta-interactions も提供できる。これは任意の
forms Array 内の
Form インスタンスによって示される。
Thing インスタンスの
forms Array が
Form インスタンスを含む場合、それは op メンバーを
含まなければならず(MUST)、
name op に割り当てられた文字列値は、直接または
Array 内のいずれかで、
次の operation
types のいずれかでなければならない
(MUST):
readallproperties、
writeallproperties、
readmultipleproperties、
writemultipleproperties、
observeallproperties、
unobserveallproperties、
queryallactions、
subscribeallevents、または
unsubscribeallevents。(Thing インスタンスにおける
form の使用例については、例を参照。)
各 property meta-interaction のデータスキーマは、
各 PropertyAffordance インスタンスのデータスキーマを
単一の ObjectSchema インスタンスに結合することで構築される。
ここで、ObjectSchema インスタンスの
properties Map は、
対応する PropertyAffordances インスタンスの名前によって識別される
各 PropertyAffordances のデータスキーマを含む。
別途指定されていない限り(例: TD Context
Extension を通じて)、
readmultipleproperties 操作のリクエストデータは、
意図された PropertyAffordances インスタンス名を含む
Array であり、
Form インスタンスによって指定される content type へ
シリアル化される。
Consumers に可能な選択肢を示し、 それによって Consumers が Thing とどのように相互作用できるかを 示唆する Thing のメタデータ。潜在的な affordance には多くの種類があるが、 W3C WoT は Interaction Affordances として Properties、Actions、Events の 3 種類を定義する。
| 語彙用語 | 説明 | 割り当て | 型 |
|---|---|---|---|
@type |
オブジェクトに semantic tags (または型)を付与する JSON-LD キーワード。 | 任意 |
string または Array of
string
|
title |
既定言語に基づく人間可読なタイトル (例: UI 表現用のテキストを表示)を提供する。 | 任意 |
string
|
titles |
複数言語の人間可読なタイトル (例: 異なる言語で UI 表現用のテキストを表示)を提供する。 MultiLanguage も参照。 | 任意 |
Map of MultiLanguage
|
description |
既定言語に基づく追加の(人間可読な) 情報を提供する。 | 任意 |
string
|
descriptions |
異なる言語による(人間可読な) 情報をサポートするために使用できる。 MultiLanguage も参照。 | 任意 |
Map of MultiLanguage
|
forms |
操作をどのように実行できるかを記述する form ハイパーメディア制御の集合。 Forms は Protocol Bindings のシリアル化である。 配列は空であってはならない。 | 必須 |
Array of Form
|
uriVariables |
[RFC6570] に従って、
DataSchema 宣言に基づく集合として URI テンプレート変数を定義する。
個々の変数 DataSchema は ObjectSchema または ArraySchema にすることはできない。
各変数は、操作の実行時に href 内で文字列へ
シリアル化される必要があるためである。同じ変数が
Thing level
uriVariables と Interaction
Affordance level の両方で宣言されている場合、Interaction Affordance
level の変数が優先される。
|
任意 |
Map of DataSchema
|
InteractionAffordance クラスは、次の
サブクラスを持つ:
Thing の状態を公開する Interaction Affordance。 この状態はその後、取得(read)および/または 更新(write)できる。Things は、変更後に新しい状態を プッシュすることで、Properties を observable にすることも 選択できる。
| 語彙用語 | 説明 | 割り当て | 型 |
|---|---|---|---|
observable |
Thing をホストする Servients および
Intermediaries が、この
Property に対する
observeproperty および
unobserveproperty 操作をサポートする
Protocol Binding を提供すべきかどうかを示す
ヒント。
|
デフォルトあり |
boolean
|
Property インスタンスは、
DataSchema クラスのインスタンスでもある。
したがって、とりわけ
type、unit、
readOnly、writeOnly
メンバーを含むことができる。
PropertyAffordance は、
InteractionAffordance Class および
DataSchema Class の
Subclass である。Form
インスタンスが PropertyAffordance
インスタンス内にある場合、op に割り当てられる値は
MUST
readproperty、writeproperty、
observeproperty、
unobserveproperty のいずれか、またはこれらの用語の組み合わせを含む
Array
でなければならない。
プロトコルが暗黙的な購読解除機構(例:
接続喪失を検出するハートビート)をサポートしている場合を除き、
各 observeproperty には対応する
unobserveproperty があることが
良い実践と見なされる。
Thing の関数を呼び出せるようにする Interaction Affordance であり、状態を操作する(例: ランプのオン/オフを切り替える)か、Thing 上で プロセスをトリガーする(例: 時間をかけてランプを暗くする)。
| 語彙用語 | 説明 | 割り当て | 型 |
|---|---|---|---|
input |
Action の入力データスキーマを定義するために 使用される。 | 任意 |
DataSchema
|
output |
Action の出力データスキーマを定義するために 使用される。 | 任意 |
DataSchema
|
safe |
Action が safe(=true)であるかどうかを示す。 Action を呼び出したときに内部状態(リソース状態を参照)が 変更されないかどうかを示すために使用される。 その場合、応答をキャッシュできる 例となる。 | デフォルトあり |
boolean
|
idempotent |
Action が idempotent(=true)であるかどうかを示す。 同じ入力に基づいて、存在する場合に同じ結果で Action を 繰り返し呼び出せるかどうかを通知する。 | デフォルトあり |
boolean
|
synchronous |
action が synchronous(=true)であるかどうかを示す。 同期 action とは、action の応答に action の結果に関する すべての情報が含まれ、action のステータスについて 追加の問い合わせが不要であることを意味する。 このキーワードがない場合、action の同期性について 何も主張できないことを意味する。 | 任意 |
boolean
|
ActionAffordance は、
InteractionAffordance Class の
Subclass である。Form
インスタンスが ActionAffordance
インスタンス内にある場合、op に割り当てられる値は
MUST
invokeaction、
queryaction、cancelaction のいずれか、または
これらの用語の組み合わせを含む
Array
でなければならない。
event データを Consumers に非同期にプッシュする event ソースを記述する Interaction Affordance (例: 過熱アラート)。
| 語彙用語 | 説明 | 割り当て | 型 |
|---|---|---|---|
subscription |
購読時に渡す必要があるデータを定義する。 例: Webhooks を設定するためのフィルターやメッセージ形式。 | 任意 |
DataSchema
|
data |
Thing によってプッシュされる Event インスタンス メッセージのデータスキーマを定義する。 | 任意 |
DataSchema
|
dataResponse |
data メッセージへの応答として consumer によって送信される Event 応答メッセージのデータスキーマを定義する。 | 任意 |
DataSchema
|
cancellation |
購読をキャンセルするために渡す必要がある任意のデータを定義する。 例: Webhook を削除するための特定のメッセージ。 | 任意 |
DataSchema
|
EventAffordance は、
InteractionAffordance Class の
Subclass である。Form
インスタンスが EventAffordance
インスタンス内にある場合、op に割り当てられる値は
MUST
subscribeevent、
unsubscribeevent のいずれか、または
Array 内の両方の用語でなければならない。
プロトコルが暗黙的な購読解除機構(例:
接続喪失を検出するハートビート)をサポートしている場合を除き、
各 subscribeevent には対応する
unsubscribeevent があることが
良い実践と見なされる。
EventAffordances は、Thing 自身が関心を持つ
Consumers に状態変化を通知するという意味で、observable
PropertyAffordances に似ている。
しかし、EventAffordances の主な違いは、
関連リソースのすべての変化が event メッセージの送出を
トリガーする必要はない点である。たとえば、数値の
重大なしきい値などである。さらに、
EventAffordances は、
subscription、dataResponse、および
cancellation DataSchema 定義によって、より複雑な購読および
購読解除機構を可能にする。ただし、すべての
プロトコルがこれらのより高度な機構をサポートするとは限らないため、
一部のシナリオでは、events は observable PropertyAffordances と
非常に似たものになる場合がある。このような場合、
Affordance をモデル化するために Property と Event のどちらを選択するかは、
基礎となるリソースの意味論に基づいて行うべきである。たとえば、
affordance の状態も Consumer によって読み取りまたは書き込みされることが
想定される場合、Property が最も適切な選択である可能性が高い。
TD 文書に関するバージョン情報を提供する Thing のメタデータ。必要に応じて、ファームウェアやハードウェアのバージョンなどの 追加のバージョン情報(TD 名前空間外の term 定義)は、TD Context Extension 機構を介して拡張できる。
| 語彙用語 | 説明 | 割り当て | 型 |
|---|---|---|---|
instance |
この TD のバージョン指標を提供する。 | 必須 |
string
|
model |
基礎となる TM のバージョン指標を提供する。 | 任意 |
string
|
VersionInfo Class の
instances および model 内の値は、
ドットで区切られた 3 つの数値の列が、それぞれ
メジャーバージョン、マイナーバージョン、パッチバージョンを示す
セマンティックバージョニングのパターンに従うことが推奨される。詳細は
[SEMVER] を参照。
[BCP47] に記述された 言語タグによって識別される、異なる言語の人間可読テキストの集合を提供する Map。 Thing Description インスタンス内でのこのコンテナーの使用例については、 6.3.2 人間可読 メタデータ を参照。
MultiLanguage Map の各名前は、
[BCP47] で定義される
言語タグでなければならない(MUST)。
MultiLanguage Map の各値は、
型 string でなければならない(MUST)。
データスキーマは、データ形式に含まれるデータの 抽象的な記法である。
データスキーマ語彙定義は、JSON Schema [JSON-SCHEMA] によって定義される用語の非常に一般的なサブセットを反映する。 JSON Schema draft 7 向けの JSON Schema [JSON-SCHEMA] プロセッサーは、データスキーマを利用できる。Thing Description インスタンス内のデータスキーマ定義は、この定義済みサブセットに限定されず、 7. TD Context Extensions で説明されるように、 追加用語に対して TD Context Extension を使用することで、 JSON Schema に見られる追加の用語を使用してもよい。そうでない場合、これらの 用語は TD Processors によって意味的に無視される (セマンティック処理の詳細については、 D. JSON-LD Context Usage および名前空間 IRI の下の文書、たとえば https://www.w3.org/2019/wot/td を参照)。
TD では、具体的なデータ形式は Forms
(5.3.4.2 Form を参照)
内で content
types を使用して指定される。Form のインスタンス内の content type の値が
application/json である場合、データスキーマは
JSON Schema プロセッサーによって直接処理できる。
それ以外の場合、Web of Things (WoT) Binding Registry
[WOT-BINDING-REGISTRY]
の項目が、データスキーマから XML [xml]
などの他の content types への利用可能なマッピングを定義する。
Form のインスタンス内の content type が
application/json ではなく、かつその content type に対する
マッピングが定義されていない場合、その content type に対して
データスキーマを指定することには意味がない。
次の表には、ペイロードの構造を記述するために データスキーマを使用してもよい(MAY) content types が含まれる。
| 形式 | Content Type |
|---|---|
| JSON/CBOR | application/jsonapplication/ld+jsonapplication/senml+jsonapplication/cborapplication/senml+cbor |
| XML/EXI | application/xmlapplication/senml+xmlapplication/exiapplication/senml-exi |
使用されるデータ形式を記述するメタデータ。 検証に使用できる。
| 語彙用語 | 説明 | 割り当て | 型 |
|---|---|---|---|
@type |
オブジェクトに semantic tags (または型)を付与する JSON-LD キーワード | 任意 |
string または Array of
string
|
title |
既定言語に基づく人間可読なタイトル (例: UI 表現用のテキストを表示)を提供する。 | 任意 |
string
|
titles |
複数言語の人間可読なタイトル (例: 異なる言語で UI 表現用のテキストを表示)を提供する。 MultiLanguage も参照。 | 任意 |
Map of MultiLanguage
|
description |
既定言語に基づく追加の(人間可読な) 情報を提供する。 | 任意 |
string
|
descriptions |
異なる言語による(人間可読な) 情報をサポートするために使用できる。 MultiLanguage も参照。 | 任意 |
Map of MultiLanguage
|
const |
定数値を提供する。 | 任意 | 任意の型 |
default |
デフォルト値を提供する。その値は、それが属する データスキーマに照らして検証されるべきである (SHOULD)。 | 任意 | 任意の型 |
unit |
たとえば国際的な科学、工学、およびビジネスで使用される 単位情報を提供する。一意性を保つため、 unit の値はセマンティック定義を指すことが推奨される (Semantic Annotations セクションも参照)。 | 任意 |
string
|
oneOf |
データが配列内で指定されたスキーマのいずれかに対して 妥当であることを保証するために使用される。これは複数の入力または出力 スキーマを記述するために使用できる。 | 任意 |
Array of DataSchema
|
enum |
配列として提供される制限された値の集合。 | 任意 | Array of 任意の型 |
readOnly |
property interaction / value が read only (=true)かどうか(=false)を示すヒントとなるブール値。 | デフォルトあり |
boolean
|
writeOnly |
property interaction / value が write only (=true)かどうか(=false)を示すヒントとなるブール値。 | デフォルトあり |
boolean
|
format |
"date-time"、"email"、"uri" などの format pattern に基づく検証を可能にする (下記も参照)。 | 任意 |
string
|
type |
JSON Schema と互換性のある JSON ベースのデータ型 (boolean、integer、number、string、object、array、null のいずれか)の割り当て。 | 任意 |
anyURI(
object、array、
string、number、
integer、boolean、または
null のいずれか)
|
DataSchema クラスは、次の
サブクラスを持つ:
format 文字列値は、固定された値の集合と、
[JSON-SCHEMA]
(特に Section 7.3 Defined Formats)で定義される対応する format rules から知られる。
Servients
は、format 値を使用して、
それに応じた追加の検証を実行してもよい
(MAY)。
既知の値の集合に見つからない値が
format に割り当てられた場合、そのような検証は
成功すべきである(SHOULD)。
any type として
型付けされた語彙用語(例:
const、default)は、
JSON Schema と互換性のあるデータ型(boolean、integer、
number、string、object、array、null)に従う。
format 用語は、
JSON Schema ツールによって広く実装されているわけではない。
さらに、format 用語は JSON
Schema 標準化コミュニティで議論されており、将来の JSON Schema
バージョンでは別の機構に置き換えられるか、削除される可能性がある。
Array
型のデータを記述するメタデータ。
この Subclass は、
DataSchema
インスタンス内の type に割り当てられる
値 array によって示される。
| 語彙用語 | 説明 | 割り当て | 型 |
|---|---|---|---|
items |
array の特性を定義するために使用される。 | 任意 |
DataSchema
または Array of DataSchema
|
minItems |
array に含まれなければならない item の最小数を 定義する。 | 任意 |
unsignedInt
|
maxItems |
array に含まれなければならない item の最大数を 定義する。 | 任意 |
unsignedInt
|
boolean 型のデータを記述するメタデータ。
この Subclass は、
DataSchema インスタンス内の type に
割り当てられる値 boolean によって示される。
number 型のデータを記述するメタデータ。
この Subclass は、
DataSchema インスタンス内の type に
割り当てられる値 number によって示される。
| 語彙用語 | 説明 | 割り当て | 型 |
|---|---|---|---|
minimum |
下限を含む下限値を表す最小数値を指定する。 関連する number または integer 型にのみ適用可能。 | 任意 |
double
|
exclusiveMinimum |
下限を含まない下限値を表す最小数値を指定する。 関連する number または integer 型にのみ適用可能。 | 任意 |
double
|
maximum |
上限を含む上限値を表す最大数値を指定する。 関連する number または integer 型にのみ適用可能。 | 任意 |
double
|
exclusiveMaximum |
上限を含まない上限値を表す最大数値を指定する。 関連する number または integer 型にのみ適用可能。 | 任意 |
double
|
multipleOf |
multipleOf 値の数値を指定する。 値は 0 より厳密に大きくなければならない。 関連する number または integer 型にのみ適用可能。 | 任意 |
double
|
integer 型のデータを記述するメタデータ。
この Subclass は、
DataSchema インスタンス内の type に
割り当てられる値 integer によって示される。
| 語彙用語 | 説明 | 割り当て | 型 |
|---|---|---|---|
minimum |
下限を含む下限値を表す最小数値を指定する。 関連する number または integer 型にのみ適用可能。 | 任意 |
integer
|
exclusiveMinimum |
下限を含まない下限値を表す最小数値を指定する。 関連する number または integer 型にのみ適用可能。 | 任意 |
integer
|
maximum |
上限を含む上限値を表す最大数値を指定する。 関連する number または integer 型にのみ適用可能。 | 任意 |
integer
|
exclusiveMaximum |
上限を含まない上限値を表す最大数値を指定する。 関連する number または integer 型にのみ適用可能。 | 任意 |
integer
|
multipleOf |
multipleOf 値の数値を指定する。 値は 0 より厳密に大きくなければならない。 関連する number または integer 型にのみ適用可能。 | 任意 |
integer
|
Object 型のデータを記述するメタデータ。
この Subclass は、
DataSchema
インスタンス内の type に割り当てられる
値 object によって示される。
| 語彙用語 | 説明 | 割り当て | 型 |
|---|---|---|---|
properties |
ネストされたデータスキーマ定義。 | 任意 |
Map of DataSchema
|
required |
object 型のどのメンバーが必須であるか、すなわち
送信されるペイロード内でどのメンバーが必須であるか
(例: invokeaction、
writeproperty の入力)、
および受信されるペイロード内でどのメンバーが
確実に配信されるか(例:
invokeaction、
readproperty の出力)を定義する
|
任意 |
Array of
string
|
string 型のデータを記述するメタデータ。
この Subclass は、
DataSchema インスタンス内の type に
割り当てられる値 string によって示される。
| 語彙用語 | 説明 | 割り当て | 型 |
|---|---|---|---|
minLength |
文字列の最小長を指定する。 関連する string 型にのみ適用可能。 | 任意 |
unsignedInt
|
maxLength |
文字列の最大長を指定する。 関連する string 型にのみ適用可能。 | 任意 |
unsignedInt
|
pattern |
文字列値の制約を表現するための正規表現を提供する。 正規表現は [ECMA-262] 方言に従わなければならない。 | 任意 |
string
|
contentEncoding |
[RFC2045] (Section 6.1)および [RFC4648] で指定される、内容を格納するために使用されるエンコーディングを指定する。 | 任意 |
string(例: 7bit、
8bit、binary、
quoted-printable、
base16、base32、または
base64)
|
contentMediaType |
[RFC2046] で記述される、文字列値の内容の MIME 型を指定する。 | 任意 |
string(例:
image/png、または
audio/mpeg)
|
文字列の長さ(すなわち
minLength および maxLength)は、
[RFC8259]
で定義される Unicode code points の数として定義される。
一部の ユーザーが知覚する文字 は、
複数の Unicode code points で構成されることに注意。
任意のインデックス値は、これらの grapheme
境界上にない可能性があるため、
maxLength に従った切り詰めは、文字列の見た目や
意味を変える可能性がある。
null 型のデータを記述するメタデータ。
この subclass は、DataSchema
インスタンス内の type に割り当てられる
値 null によって示される。この Subclass は、
許容される唯一の値、すなわち null のみを記述する。
null は値が存在しないことを意味しない点に
注意することが重要である。これは JavaScript の null、
Python の None、Java の
null、Ruby プログラミング言語の nil
に類似している。これは oneOf 宣言の一部として使用でき、
データが null にもなり得ることを示すために使用される。
この仕様は、W3C WoT の Protocol Bindings として適格なプロトコルに直接組み込まれている、 またはそれらのプロトコルとともに広く使用されている、確立された セキュリティ機構の選択肢を提供する。現在の HTTP セキュリティ スキームの集合は、部分的に OpenAPI 3.0.1 に基づいている([OPENAPI] も参照)。 しかし、この仕様で与えられる HTTP セキュリティスキーム、 Vocabulary、および構文は OpenAPI と多くの類似点を共有するものの、互換性はない。
一般に、セキュリティスキームが有効であるためには、 TLS や DTLS など、何らかの安全なトランスポートを必要とする。 安全なトランスポートの使用に関する要件は、この文書の 11. セキュリティの 考慮事項 および [wot-architecture11] の Security Considerations セクションで与えられる。
セキュリティ機構の構成を記述するメタデータ。
name
scheme に割り当てられる値は、
Thing Description に含まれる
Vocabulary 内で定義されなければならない
(MUST)。
それは § 5.
TD
Information Model で定義される標準
Vocabulary 内、または
TD Context
Extension 内のいずれかである。
すべてのセキュリティスキームについて、 アクセスを直接提供する鍵、パスワード、またはその他の機密情報は TD に保存してはならず(MUST NOT)、 代わりに他の機構を介して out-of-band に共有および保存されるべきである。 TD の目的は、Consumer がすでに認可を持っている場合に限り、 Thing にアクセスする方法を記述することであり、その認可を付与するために 使用されることを意図していない。
TD で使用される各 security scheme オブジェクトは、 アクセスが許可される前に満たされるべき要件の集合を定義する。 その要件がすべて満たされたとき、セキュリティスキームは satisfied であるという。場合によっては、アクセスが許可される前に 複数の security schemes からの要件を満たす必要がある。
セキュリティスキームは通常、パスワードや鍵などの追加の
認証パラメーターを要求する場合がある。この情報の場所は、
name in に関連付けられた値によって示され、
多くの場合 name に関連付けられた値と組み合わせて使用される。
in に関連付けられた値は、次の値のいずれかを取ることができる:
header:name の値によって提供される。query:name によって提供される。body:name によって提供される。
body
セキュリティ情報
場所の文脈で使用される場合、name の値は、
それが使用される各 interaction の入力
DataSchema のルートに相対的な JSON pointer
[RFC6901]
の形式でなければならない(MUST)。
この値は fragment identifier ではなく、TD のルートに対する相対でもなく、
セキュリティスキームが結び付けられている任意の data schemas に対する相対であるため、
この値は # で始まるべきではない。これは「純粋な」
JSON pointer である。この値は fragment identifier ではないため、
特殊文字を URL エンコードする必要もない。対象要素は、参照された object
または array schema 内の指定された場所にすでに存在していてもよいし、
存在していなくてもよい(したがってこの機構は simple types には適用できない)。
存在しない場合、それは挿入される。これにより、すべての interaction の
data schemas 内で定義を重複させる必要がなくなる。
body locator で示される
JSON pointer によって示される data schema の要素が、
示された schema 内にまだ存在しない場合、その pointer によって示される場所に
示された要素を挿入できなければならない
(MUST)。
body locator で使用される
JSON pointer は、既存の array の最後の要素の後に要素を挿入する必要がある場合、
存在しない array 要素を示すために "-"
文字を使用してもよい(MAY)。
body セキュリティ情報
場所によって参照(または作成)される要素は、
required であり、型 "string" でなければならない
(MUST)。
name が与えられていない場合、body 全体が
セキュリティパラメーターとして使用されると仮定される。
cookie:name の値によって識別される
cookie に保存される。uri:name の値によって定義される URI template variable を使用して
符号化される。これは query 機構より一般的だが、
より複雑である。
値
uri は、query が適用できない場合にのみ、
security scheme 内の name in に対して指定されるべきである
(SHOULD)。
in の値として uri を使用する security scheme の
interactions で提供される URI は、定義された変数を含む URI template
でなければならない(MUST)。
auto:SecurityScheme の
in フィールドに auto の値が設定されている場合、
name フィールドは設定されるべきではない
(SHOULD
NOT)。 この場合、SecurityScheme の適用は、
所定のプロトコルに対する各仕様に従う(例:
HTTP で BasicSecurityScheme を使用する場合の
[RFC8288])。
security scheme に複数のパラメーターが必要な場合、
各パラメーターについて security scheme 定義を繰り返し、
combo security scheme と allOf を使用して
それらを組み合わせる。場合によっては、パラメーターは実際には秘密ではないが、
ユーザーがプライバシー保護のために TD から除外したいことがある。
例として、一部のセキュリティ機構では client identifier と secret key の
両方が必要である。理論上、client identifier は公開情報であるが、
更新が難しく、追跡リスクをもたらす場合がある。このような場合、
それが TD に現れないように、追加のセキュリティパラメーターとして
提供できる。
SecurityScheme で宣言される URI 変数の名前は、
TD 内で宣言される他のすべての URI 変数と異なっていなければならない
(MUST)。
| 語彙用語 | 説明 | 割り当て | 型 |
|---|---|---|---|
@type |
オブジェクトに semantic tags (または型)を付与する JSON-LD キーワード。 | 任意 |
string または Array of
string
|
description |
既定言語に基づく追加の(人間可読な) 情報を提供する。 | 任意 |
string
|
descriptions |
異なる言語による(人間可読な) 情報をサポートするために使用できる。 MultiLanguage も参照。 | 任意 |
Map of MultiLanguage
|
proxy |
このセキュリティ構成がアクセスを提供する proxy server の URI。 与えられていない場合、対応するセキュリティ構成は endpoint 向けである。 | 任意 |
anyURI
|
scheme |
構成されるセキュリティ機構の識別。 | 必須 |
string(例:
nosec、combo、
basic、digest、
bearer、psk、
oauth2、apikey、または
auto)
|
SecurityScheme クラスは、次の
サブクラスを持つ:
Vocabulary Term
nosec(すなわち "scheme":
"nosec")によって識別されるセキュリティ構成であり、
リソースへアクセスするために認証やその他の機構が不要であることを示す。
用語 auto(すなわち
"scheme": "auto")によって識別される
自動認証セキュリティ構成。この scheme は、
セキュリティパラメーターが実行時に基礎となるプロトコルによって
交渉され、各プロトコルの仕様に従うことを示す
(例: HTTP 使用時の Basic Authentication については
[RFC8288])。
Vocabulary Term
combo(すなわち "scheme":
"combo")によって識別される、他のセキュリティスキームの組み合わせ。
この scheme の要素は、securityDefinitions で定義される
他の名前付き schemes(他の
ComboSecurityScheme
定義を含む)を組み合わせ、新しい scheme 定義を作成するさまざまな方法を定義する。
oneOf または
allOf vocabulary terms のいずれか一方だけが
含まれなければならない(MUST)。
一緒に使用できる security scheme 定義のみを
allOf と組み合わせることができる。たとえば、
一方が proxy に、もう一方が endpoint に適用される場合を除き、
異なる OAuth 2.0 flows を allOf を使用して
一般に組み合わせることはできない。security フィールドに
複数の名前付き security scheme 定義が列挙されている場合、
allOf 組み合わせと同じ意味論が適用される
(許可される組み合わせに関する同じ制限も適用される)ことに注意。
oneOf 組み合わせは、それ以外は同一の forms 上で
異なる security schemes を使用することと等価である。この意味では
oneOf scheme は本質的な機能ではないが、
そのような場合の冗長性を避けることができる。
| 語彙用語 | 説明 | 割り当て | 型 |
|---|---|---|---|
oneOf |
他の名前付き security scheme 定義を識別する 2 つ以上の文字列の配列。そのうちいずれか 1 つが満たされると アクセスが許可される。使用のために選択できるのは 1 つだけである。 | 必須 |
Array of
string
|
allOf |
他の名前付き security scheme 定義を識別する 2 つ以上の文字列の配列。それらすべてがアクセスのために 満たされなければならない。 | 必須 |
Array of
string
|
暗号化されていないユーザー名とパスワードを使用する、
Vocabulary Term
basic(すなわち "scheme":
"basic")によって識別される Basic Authentication
[RFC7617]
セキュリティ構成。
| 語彙用語 | 説明 | 割り当て | 型 |
|---|---|---|---|
name |
query、header、cookie、または uri パラメーターの名前。 | 任意 |
string
|
in |
セキュリティ認証情報の場所を指定する。 | デフォルトあり |
string(
header、query、
body、cookie、または
auto のいずれか)
|
Vocabulary Term
digest(すなわち "scheme":
"digest")によって識別される Digest Access Authentication
[RFC7616]
セキュリティ構成。この scheme は basic
authentication に似ているが、man-in-the-middle attacks を回避するための
追加機能を備えている。
| 語彙用語 | 説明 | 割り当て | 型 |
|---|---|---|---|
name |
query、header、cookie、または uri パラメーターの名前。 | 任意 |
string
|
in |
セキュリティ認証情報の場所を指定する。 | デフォルトあり |
string(
header、query、
body、cookie、または
auto のいずれか)
|
qop |
保護の品質。 | デフォルトあり |
string(
auth、または auth-int のいずれか)
|
Vocabulary Term
apikey(すなわち "scheme":
"apikey")によって識別される API key authentication
セキュリティ構成。この scheme は access token が opaque である場合、
たとえばクラウドサービスプロバイダーによって未知または独自形式の鍵が
提供される場合に使用される。その場合、その鍵は標準的な token 形式を
使用していない可能性がある。この scheme は、サービスプロバイダーによって
提供される鍵を、"in" フィールドで示される機構を使用して
サービスリクエストの一部として供給する必要があることを示す。
| 語彙用語 | 説明 | 割り当て | 型 |
|---|---|---|---|
name |
query、header、cookie、または uri パラメーターの名前。 | 任意 |
string
|
in |
セキュリティ認証情報の場所を指定する。 | デフォルトあり |
string(
header、query、
body、cookie、
uri、または auto のいずれか)
|
Bearer tokens が OAuth2 から独立して使用される状況向けに、
Vocabulary Term
bearer(すなわち "scheme":
"bearer")によって識別される Bearer Token
[RFC6750]
セキュリティ構成。oauth2
scheme が指定されている場合、それは暗黙に含まれるため、通常この scheme も
指定する必要はない。format について、
値 jwt は [RFC7519] への適合を示し、
jws は
[RFC7797]
への適合を示し、
cwt は
[RFC8392] への適合を示し、
jwe は
[RFC7516] への適合を示す。
alg の値は、これらの標準と一貫して解釈される。
Bearer token の
その他の形式およびアルゴリズムは、語彙拡張で指定してもよい
(MAY)。
| 語彙用語 | 説明 | 割り当て | 型 |
|---|---|---|---|
authorization |
authorization server の URI。 | 任意 |
anyURI
|
name |
query、header、cookie、または uri パラメーターの名前。 | 任意 |
string
|
in |
セキュリティ認証情報の場所を指定する。 | デフォルトあり |
string(
header、query、
body、cookie、または
auto のいずれか)
|
alg |
符号化、暗号化、または digest algorithm。 | デフォルトあり |
string(例:
ES256、または ES512-256)
|
format |
セキュリティ認証情報の形式を指定する。 | デフォルトあり |
string(例: jwt、
cwt、jwe、または
jws)
|
Vocabulary Term
psk(すなわち "scheme": "psk")によって
識別される pre-shared key authentication セキュリティ構成。
これは、TLS-PSK [RFC4279]
などの pre-shared keys に標準が使用されること、および keys に使用される
ciphersuite がプロトコル交渉中に確立されることを識別することを意図している。
| 語彙用語 | 説明 | 割り当て | 型 |
|---|---|---|---|
identity |
選択または確認に使用できる情報を提供する識別子。 | 任意 |
string
|
[RFC6749]
および [RFC8252]
に適合するシステム向けの OAuth 2.0 authentication セキュリティ構成であり、
Vocabulary Term
oauth2(すなわち "scheme":
"oauth2")によって識別される。
| 語彙用語 | 説明 | 割り当て | 型 |
|---|---|---|---|
authorization |
authorization server の URI。 | 任意 |
anyURI
|
token |
token server の URI。 | 任意 |
anyURI
|
refresh |
refresh server の URI。 | 任意 |
anyURI
|
scopes |
配列として提供される authorization scope identifiers の集合。
これらは authorization server によって返される tokens 内で提供され、
client がどの resources にどのようにアクセスできるかを識別するため、
forms に関連付けられる。form に関連付けられる値は、
その form 上で有効な OAuth2SecurityScheme で定義されるものから
選択されるべきである(SHOULD)。
|
任意 |
string または Array of
string
|
flow |
Authorization flow。 | 必須 |
string(例: code、
または client)
|
code
flow では、authorization および
token vocabulary terms の両方が
含まれなければならない(MUST)。
client flow では、token
vocabulary term
が含まれなければならない(MUST)。
client flow では、authorization
vocabulary term
を含めてはならない(MUST NOT)。
各 flow の必須要素は次の表に要約される:
| 要素 | code |
client |
|---|---|---|
authorization |
必須 | 省略 |
token |
必須 | 必須 |
refresh |
任意 | 任意 |
本モデルは、Thing によって公開される
(型付き)Web links および Web forms の表現を提供する。Link
クラス定義は、Web Linking [RFC8288] で定義される用語の
非常に一般的なサブセットを反映する。定義された用語は、
たとえば Lamp
Thing が Switch Thing によって制御されるような、
他の Thing
との関係を
記述するために使用できる。
Form クラスは、
Things
(および他の Web
resources)の状態を操作するために新たに導入された
hypermedia control の形式に対応する。
link は、 「link context は relation type の resource を link target に持つ」 という形式の文として見ることができ、 任意の target attributes が その resource をさらに記述してもよい。
| 語彙用語 | 説明 | 割り当て | 型 |
|---|---|---|---|
href |
link の target IRI、または form の submission target。 | 必須 |
anyURI
|
type |
link の参照解決結果の media type [RFC2046] が何であるべきかを示すヒントを提供する target attribute。 | 任意 |
string
|
rel |
link relation type は link の意味論を識別する。 | 任意 |
string
|
anchor |
link context(既定ではその id によって識別される
Thing 自体)を、与えられた URI または IRI で上書きする。 |
任意 |
anyURI
|
sizes |
参照される icon の 1 つ以上のサイズを指定する target attribute。relation type "icon" にのみ適用可能。 値の pattern は {Height}x{Width} に従う (例: "16x16"、"16x16 32x32")。 | 任意 |
string
|
hreflang |
hreflang attribute は linked document の言語を指定する。 この値は妥当な language tag [BCP47] でなければならない。 | 任意 |
string または Array of
string
|
hreflang attribute は、
この仕様のバージョンでは string または
array であることが許可されている。
[LINKSET-MEDIA-TYPES]
の結果に応じて、hrefLang の値は
array のみに制限される可能性がある。
Link relations は、他の Things との関係 (例: Switch Thing が Lamp Thing を制御する)、特定の種類の Thing Models との関係 (例: Thing Description が特定の Thing Model のインスタンスである)、 またはさらなる documentation 情報との関係 (例: Thing の device manual)などを記述するために使用できる。 既存かつ確立された IANA の Link Relation 定義を再利用することが推奨される。
以下では、WoT Thing Description または Thing Model インスタンス内で使用することが推奨される best practice relation type table を導入する。
| 値 | 出現 | 説明 | 値の由来 |
|---|---|---|---|
icon |
0..* | Thing に関連付けられた icon をインポートする(例: UI 用途)。 | IANA Link Relation |
service-doc |
0..* | (人間可読な)documentation または descriptions を提供する resource への関係。 | IANA Link Relation |
alternate |
0..* | Thing の代替表現 (すなわち RDF-Turtle、人間可読な HTML 文書、...)を指す。 | IANA Link Relation |
type |
0..1 | Thing が、たとえば Thing Model のような target resource のインスタンスであることを示す。 | IANA Link Relation |
tm:extends |
0..1 | Thing Model のような target resource の既存定義を拡張する。 Thing Model 定義にのみ適用可能。 | W3C WoT Thing Model |
tm:submodel |
0..* | 1 つまたは複数の Thing Models を合成するために使用される。 Thing Model 定義にのみ適用可能。 | W3C WoT Thing Model |
manifest |
0..* | たとえばユーザーが Thing と相互作用できる user interface を提供する Web application の web app manifest を指す ([APPMANIFEST] も参照)。 | IANA Link Relation |
proxy-to |
0..* |
Target resource は proxy のアドレスを提供する。
追加のセキュリティメタデータは、SecurityScheme の
proxy フィールドを使用して提供できる。
|
W3C WoT Security and WoT Binding Template |
collection |
0..1 | Things の collections を指す。 | IANA Link Relation |
item |
0..* | 現在の Thing collections の member である Thing を指す。 | IANA Link Relation |
predecessor-version |
0..1 | 以前の Thing Description または Thing Model version を指す。 | IANA Link Relation |
controlledBy |
0..* | context Thing を 制御する Thing を参照する。 | W3C Thing Description |
form は、「form context 上で operation type 操作を実行するには、 submission target に request method request を行う」という文として見ることができ、 任意の form fields が必要な request を さらに記述してもよい。Thing Descriptions では、 form context は周囲の Object であり、 Properties、Actions、Events、または meta-interactions のための Thing 自体などである。
| 語彙用語 | 説明 | 割り当て | 型 |
|---|---|---|---|
href |
link の Target IRI、または form の submission target。 | 必須 |
anyURI
|
contentType |
media type [RFC2046]
に対して、media type
(例: text/plain)および潜在的な
parameters(例: charset=utf-8)に基づく
content type を割り当てる。
|
任意 |
string
|
contentCoding |
Content coding 値は、representation に適用済み、または適用可能な encoding transformation を示す。Content codings は主に、 underlying media type の同一性を失うことなく、かつ情報を失うことなく、 representation を圧縮したり、その他有用な変換を行ったりできるようにするために使用される。 content coding の例には "gzip"、"deflate" などがある。 | 任意 |
string
|
security |
securityDefinitions で定義されたものから
選択される security definition names の集合。
resources へアクセスするには、これらすべてが満たされなければならない。 |
任意 |
string または Array of
string
|
scopes |
配列として提供される authorization scope identifiers の集合。
これらは authorization server によって返される tokens 内で提供され、
client がどの resources にどのようにアクセスできるかを識別するため、
forms に関連付けられる。form に関連付けられる値は、その form 上で
有効な OAuth2SecurityScheme で定義されるものから
選択されるべきである(SHOULD)。
|
任意 |
string または Array of
string
|
response |
この任意の用語は、たとえば出力 communication metadata が 入力 metadata と異なる場合(例: 出力 contentType が入力 contentType と異なる場合)に 使用できる。response name には、primary response messages に対してのみ妥当な metadata が含まれる。 | 任意 |
ExpectedResponse
|
additionalResponses |
この任意の用語は、たとえば error reporting のために 追加の expected responses が可能な場合に使用できる。 各 additional response は、何らかの方法 (たとえば protocol-specific error code を指定すること)で 他のものと区別される必要があり、独自の data schema を持ってもよい。 | 任意 |
Array of AdditionalExpectedResponse
|
subprotocol |
複数の選択肢がある場合に、所定の protocol に対して
interaction が達成される正確な機構を示す。たとえば
HTTP と Events では、long polling(longpoll)、
WebSub [websub]
(websub)、Server-Sent Events
(sse)[html](EventSource としても知られる)
など、非同期通知のために使用すべき利用可能な複数の機構のいずれかを示す。
subprotocol の選択には制限がなく、この subprotocol term によって
他の機構も告知できることに注意。 |
任意 |
string(例:
longpoll、websub、または
sse)
|
op |
form によって記述される operation(s) を実行する意味的意図を示す。 たとえば、Property interaction は get および set operations を許可する。protocol binding は get operation 用の form と、set operation 用の異なる form を 含む場合がある。op attribute は、どの form がどちら用であるかを示し、 client が必要な operation に対して正しい form を選択できるようにする。 op には、operation の意味的意図をそれぞれ表す 1 つ以上の interaction verb(s) を割り当てることができる。 | デフォルトあり |
string または Array of
string(次のいずれか:
readproperty、
writeproperty、
observeproperty、
unobserveproperty、
invokeaction、
queryaction、
cancelaction、
subscribeevent、
unsubscribeevent、
readallproperties、
writeallproperties、
readmultipleproperties、
writemultipleproperties、
observeallproperties、
unobserveallproperties、
subscribeallevents、
unsubscribeallevents、または
queryallactions)
|
contentCoding
property の可能な値は、たとえば
IANA HTTP content coding registry に見つけることができる。
form の可能な operation types のリストは固定されている。 このバージョンの仕様では、 [wot-architecture11] で記述される WoT interaction model を実装するために必要な well-known types のみを含む。 標準の将来バージョンではこのリストを拡張する可能性があるが、 operation types は 下表の値に制限されなければならない (MUST)。
| Operation Type | 説明 |
|---|---|
| readproperty | 対応する data を取得するための、 Property Affordances 上の read operation を識別する。 |
| writeproperty | 対応する data を更新するための、 Property Affordances 上の write operation を識別する。 |
| observeproperty | Property が更新されたときに新しい data で通知されるための、 Property Affordances 上の observe operation を識別する。 |
| unobserveproperty | 対応する通知を停止するための、 Property Affordances 上の unobserve operation を識別する。 |
| invokeaction | 対応する action を実行するための、 Action Affordances 上の invoke operation を識別する。 |
| queryaction | 対応する action の status を取得するための、 Action Affordances 上の querying operation を識別する。 |
| cancelaction | 進行中の対応する action をキャンセルするための、 Action Affordances 上の cancel operation を識別する。 |
| subscribeevent | event が発生したときに Thing によって通知されるための、 Event Affordances 上の subscribe operation を識別する。 |
| unsubscribeevent | 対応する通知を停止するための、 Event Affordances 上の unsubscribe operation を識別する。 |
| readallproperties | すべての Properties の data を単一の interaction で 取得するための、Thing 上の readallproperties operation を識別する。 |
| writeallproperties | すべての writable Properties の data を単一の interaction で 更新するための、Thing 上の writeallproperties operation を識別する。 |
| readmultipleproperties | 選択された Properties の data を単一の interaction で 取得するための、Thing 上の readmultipleproperties operation を識別する。 |
| writemultipleproperties | 選択された writable Properties の data を単一の interaction で更新するための、Thing 上の writemultipleproperties operation を識別する。 |
| observeallproperties | 任意の Property が更新されたときに新しい data で通知されるための、 Properties 上の observeallproperties operation を識別する。 |
| unobserveallproperties | 単一の interaction ですべての Properties からの通知を停止するための、 Properties 上の unobserveallproperties operation を識別する。 |
| queryallactions | すべての Actions の status を単一の interaction で取得するための、Thing 上の queryallactions operation を識別する。 |
| subscribeallevents | 単一の interaction ですべての Events からの通知を購読するための、 Events 上の subscribeallevents operation を識別する。 |
| unsubscribeallevents | 単一の interaction ですべての Events からの通知を購読解除するための、 Events 上の unsubscribeallevents operation を識別する。 |
WoT producer の Thing Description は、たとえば異なる protocol および/または content types 宣言を持つ複数の forms entries を持ってもよく、 それらを Consumer が サポートできる可能性がある。その場合、Consumer は自分にとって動作する 任意の form entry(例: protocol と content type がサポートされている)を 選択してよい。1 つの form が選択された場合、 Consumer は、可能な限り長く、 WoT producer との すべての新しい interaction に対してそれを使用し続けることが期待される。
このセクションは非規範的である。
TD とともに使用できる protocols は、
request-response または eventing mechanisms に従う。
affordance の Data
Schema は、通常 forms で使用される
op keywords と相関する。
下表は、利用可能な data schema 関連用語と
op keywords を情報提供的に要約する。
| Operation Type | Consumer to Thing DataSchema の相関 | Thing to Consumer DataSchema の相関 |
|---|---|---|
| readproperty | 相関なし。 | "writeOnly":true を持たない
Property Affordance 内のすべてのフィールド。
|
| writeproperty | "readOnly":true を持たない
Property Affordance 内のすべてのフィールド。
|
相関なし。
additionalResponses は
form level で使用できる。
|
| observeproperty | 相関なし。 | "writeOnly":true を持たない
Property Affordance 内のすべてのフィールド。
|
| unobserveproperty | 相関なし。 | 相関なし。 |
| invokeaction | input key の値。 |
output key の値。 |
| queryaction | 相関なし。 | 相関なし。
additionalResponses は
form level で使用できる。
|
| cancelaction | 相関なし。 | 相関なし。
additionalResponses は
form level で使用できる。
|
| subscribeevent | "readOnly":true を持たない
すべてのフィールドを含む subscription key の値
|
"writeOnly":true を持たない
すべてのフィールドを含む subscription key の値
|
| unsubscribeevent | "readOnly":true を持たない
すべてのフィールドを含む subscription key の値
|
"writeOnly":true を持たない
すべてのフィールドを含む subscription key の値
|
property への書き込みは、 property を観測している Consumer に新しい値が送信されることを 必ずしも意味しない。それは protocol と implementation に依存する。
operations を data schemas にマッピングする方法のさらなる仕様、
および readallproperties などの meta
operations のマッピングは、
[WOT-BINDING-TEMPLATES]
の各 protocol specification に見つけることができる。
任意の response name-value pair は、
期待される response message のための metadata を提供するために使用できる。
core vocabulary では、content type 情報のみを含めることができるが、
TD Context
Extensions を適用できる。
response name-value pair が提供されていない場合、
response の content type は Form instance に割り当てられた
content type と等しいと仮定されなければならない
(MUST)。
ExpectedResponse Class 内の
contentType には
Default Value がないことに注意。
場合によっては additional responses が可能なことがある。
その一例は error responses だが、場合によっては追加の successful
responses も存在する。この場合、response
name-value pair は依然として primary response に使用されるが、
additionalResponses も提供でき、その値は
AdditionalExpectedResponse objects の配列である。
各 additional response は、contentType または
error code header values などの protocol-specific
settings によって、何らかの方法で primary response と区別されなければならない。
各 additional response は、interaction の通常の output data schema と
異なる可能性のある data schema も持ってよい。
一部のユースケースでは、入力データと出力データが
異なる形式で表されることがある。たとえば JSON を受け入れるが、
image を返す Action である。そのような場合、任意の
response key-value pair は、
期待される response の content type を記述できる。
default value が定義されていないため、次の assertions が適用される:
response object に
contentType 値が定義されていない場合、
Consumer は、対応する
response が payload を含まないと期待しなければならない
(MUST)。response
object に content type が定義されている場合、
Consumer は、
たとえば image/jpeg の場合の image のように、
対応する形式の payload を含む response を期待しなければならない
(MUST)。同様の考慮事項は additional responses にも適用される:
Form instance は、name
additionalResponses に関連付けられた
array 内に entry を含まなければならない
(MUST)。contentType 値が定義されていない場合、
Consumer
は、対応する response が payload を含まないと期待しなければならない
(MUST)。Form は、name additionalResponses に
関連付けられた array 内に、name schema の値を含む
entry を含まなければならない(MUST)。contentType が存在しない場合、
additional expected response object の schema は
定義されてはならない(MUST NOT)。request と response の variation に関するさまざまなケースは 上で説明した。C. Thing Descriptions における contentType usage の表は、 これらのケースを簡潔に要約している。
primary response の expected response message を記述する communication metadata。
| 語彙用語 | 説明 | 割り当て | 型 |
|---|---|---|---|
contentType |
media type [RFC2046]
に対して、media type
(例: text/plain)および潜在的な
parameters(例: charset=utf-8)に基づく
content type を割り当てる。
|
任意 |
string
|
additional responses の expected response message を記述する communication metadata。
| 語彙用語 | 説明 | 割り当て | 型 |
|---|---|---|---|
success |
additional response を error と見なすべきでないかどうかを示す。 | デフォルトあり |
boolean
|
schema |
additional response の output data schema が
default output data schema と異なる場合に、それを定義するために使用される。
DataSchema object ではなく、
schemaDefinitions map で与えられた
以前の定義の名前を使用しなければならない。
|
任意 |
string
|
contentType |
media type [RFC2046]
に対して、media type
(例: text/plain)および潜在的な
parameters(例: charset=utf-8)に基づく
content type を割り当てる。
|
任意 |
string
|
TD 内の割り当てが 欠落している場合、TD Processor は、デフォルト値 定義の表に示された デフォルト 値の割り当てに従わなければならない (MUST)。
次の表は、TD Information Model で定義されるすべての デフォルト値を示す。
| クラス | 語彙用語 | デフォルト値 | コメント |
|---|---|---|---|
PropertyAffordance |
readOnly |
false |
この語彙用語のデフォルト値は、
PropertyAffordance レベルの定義にのみ
適用される。DataSchema 定義などの
他の文脈では、この語彙用語は任意である。
|
PropertyAffordance |
writeOnly |
false |
この語彙用語のデフォルト値は、
PropertyAffordance レベルの定義にのみ
適用される。DataSchema 定義などの
他の文脈では、この語彙用語は任意である。
|
PropertyAffordance |
observable |
false |
|
ActionAffordance |
safe |
false |
|
ActionAffordance |
idempotent |
false |
|
AdditionalExpectedResponse |
success |
false |
|
Form |
contentType |
application/json |
|
Form |
op |
readOnly および
writeOnly が false に
設定されている場合は、要素
readproperty および
writeproperty を持つ
string の
Array、または
readOnly が true に
設定されている場合は、要素
readproperty を持つ
string の
Array、または
writeOnly が
true に設定されている場合は、要素
writeproperty を持つ
string の
Array。 |
PropertyAffordance
のインスタンス内で定義されている場合
|
Form |
op |
invokeaction |
ActionAffordance
のインスタンス内で定義されている場合
|
Form |
op |
要素
subscribeevent および
unsubscribeevent を持つ
string の
Array
|
EventAffordance
のインスタンス内で定義されている場合
|
BasicSecurityScheme |
in |
header |
|
DigestSecurityScheme |
in |
header |
|
DigestSecurityScheme |
qop |
auth |
|
APIKeySecurityScheme |
in |
query |
|
BearerSecurityScheme |
in |
header |
|
BearerSecurityScheme |
alg |
ES256 |
|
BearerSecurityScheme |
format |
jwt |
さらに、デフォルト値の使用には次の考慮事項が適用される:
forms entry が
複数の op 値を持つ場合、その form は Consumer によって
送信可能な messages を 1 つの operation のみに制限してはならない
(MUST NOT)。 たとえば、
"op":["readproperty",
"writeproperty"] を持つ form は
htv:methodName を含むことができない。通常、
TD Processor
は内部的に複数の op 値を個別の
forms entries に展開し、
デフォルトの仮定を使用して各 operation を具体的な protocol
request に関連付ける。address
情報(例: href)および他の metadata は、
展開後のバージョンに引き継がれる。HTTP Binding の
例を参照。
@context で定義されていない接頭辞を持つ items を
含む場合にセマンティック処理を可能にするため、
TD Processor
は、[WOT-BINDING-REGISTRY]
で定義された bindings に従って、それらの接頭辞の定義を追加することで
@context を展開すべきである
(SHOULD)。
これには、TD Processor が TD 内で使用される
接頭辞を認識している必要がある。これは通常、
TD Processor が特定の protocol および
data formats の集合をサポートするよう実装されている場合に該当する。
例 4
も参照。
デフォルト値と展開機構は、順番に適用できることに注意。
たとえば、"readOnly" および
"writeOnly" が欠落していることは、
表 31 に従い、
デフォルト値 false が両方に適用されることを意味し、
その結果、"op" のデフォルト値が
["readproperty", "writeproperty"] であることを意味する。
protocol binding のデフォルト methods を使用すると、これは
"GET" および "PUT" がそれぞれ
"readproperty" および "writeproperty" に
対応することを意味する。しかし、
multiple
operations mechanism の展開に従い、内部的に 2 つの個別の forms が作成され、
各 operation に 1 つずつ対応し、デフォルト method を示す。
その後、default context expansion
機構が適用され、@context に
htv 接頭辞の定義が追加される。
次の例は、初期 TD と、すべてのデフォルト値および展開機構を適用した後の
完全に展開された TD を示す。
WoT Thing Descriptions は Things を表し、
5. TD
情報モデルに基づいてモデル化および構造化される。
このセクションでは、TD
Information Model によって定義される
Class
Thing のインスタンスのシリアル化である、
Things のための
JSON ベースの表現形式を定義する。
TD Processor は、 6.1 JSON 型へのマッピング および 6.3 情報モデルの シリアル化に記載された規則に従って、 Thing Descriptions を JSON 形式 [RFC8259] にシリアル化し、かつ/またはその形式から Thing Descriptions を デシリアル化できなければならない(MUST)。
TD Information Model の JSON シリアル化は、 セマンティック評価を簡素化するため、JSON-LD 1.1 [json-ld11] の構文と整合している。 したがって、TD 表現形式は、生の JSON として処理することも、 JSON-LD 1.1 プロセッサーで処理することもできる (セマンティック処理の詳細については、 D. JSON-LD Context Usage および 名前空間 IRI の下の文書、たとえば https://www.w3.org/2019/wot/td を参照)。
相互運用可能な国際化をサポートするため、 TD は、 open ecosystems 向けに RFC8259 [RFC8259] の Section 8.1 で定義される要件に従って シリアル化されなければならない(MUST)。 要約すると、これは次を要求する:
TD Information Model は、モデルの Objects と JSON 型との間に 容易なマッピングが存在するように構築されている。すべての Class インスタンスは JSON object にマップされ、Class インスタンスの各 name-value pair は JSON object のメンバーとなる。
5.3
Class Definitions
で言及されるすべての Simple
Type
(すなわち string、anyURI、
dateTime、integer、
unsignedInt、double、および
boolean)は、以下に列挙する規則に従って、
primitive JSON type(string、number、boolean)にマップされる。
これらの規則は name-value pair 内の値に適用される:
string または anyURI 型の値は、
JSON strings としてシリアル化されなければならない
(MUST)。dateTime 型の値は、
[RFC3339]
で指定される "date-time" 形式に従う JSON strings として
シリアル化されなければならない(MUST)。
例としては 2019-05-24T13:12:45Z
および 2015-07-11T09:32:26+08:00 がある。
dateTime 型の値は、
offset ではなく、UTC time zone を表す literal Z を
使用すべきである(SHOULD)。
integer または unsignedInt 型の値は、
fraction または exponent part を持たない JSON numbers として
シリアル化されなければならない(MUST)。double 型の値は、JSON number として
シリアル化されなければならない(MUST)。boolean 型の値は、JSON boolean として
シリアル化されなければならない(MUST)。TD Information Model のすべての complex type (すなわち、 Arrays、Maps、および Class インスタンス)は、 以下に列挙する規則に従って、structured JSON type(array および object)にマップされる:
Thing Description シリアル化は、5.4 デフォルト値定義で与えられた表に列挙されるように、 Default Values が 定義されている Vocabulary Term を 省略してもよい。
次の例は、例 1 の TD インスタンスを、 Default Values を持つメンバーも含めるための checkbox (= checkbox checked)とともに示す。これらのメンバーは、 TD シリアル化を簡略化するために省略できる(= checkbox unchecked)。TD Processor は、これらの省略されたメンバーを、所定の Default Value で 明示的に存在している場合と同一に解釈することに注意。
使用される Protocol Binding によっては、追加の protocol-specific Vocabulary Terms が 適用される場合があることに注意。それらには関連付けられた Default Values も あり得るため、このサブセクションで説明したように省略することもできる。 詳細については、8.1.1 Protocol Bindings を参照。
Thing Description は、型
Thing の
Object
をルートとするデータ構造である。さらに、Thing Description の JSON
シリアル化は JSON object であり、
TD
Information Model から構築される構文木のルートである。
TD Serialization のルート
要素は、@context という名前のメンバーを含み、
その値が文字列型、または
https://www.w3.org/ns/wot-next/td と等しい、もしくはそれを含む
array 型である JSON object でなければならない(MUST)。
一般に、この URI は、この仕様によって定義される TD
表現形式のバージョンを識別するために使用される。
JSON-LD 処理 [json-ld11] では、この URI は
Thing Description context file を指定する。
array 型の @context は
TD Context Extensions
を示す(詳細は 7. TD Context
Extensions を参照)。
{
"@context": "https://www.w3.org/ns/wot-next/td",
// ...
}
Thing の Signature 内の
Vocabulary Term を名前とする、
Thing のインスタンスのすべての name-value pairs は、
ルートオブジェクトの JSON members としてシリアル化されなければならない
(MUST)。
すべての必須および任意のメンバーを含む、 シリアル化されたルートオブジェクトの TD snippet を以下に示す:
{
"@context": "https://www.w3.org/ns/wot-next/td",
"@type": "Thing",
"id": "urn:uuid:1b37933b-3212-4dad-9c2c-74c6042c3e2b",
"title": "MyThing",
"titles": {/*...*/},
"description": "Human readable information.",
"descriptions": {/*...*/},
"support": "mailto:support@example.com",
"version": {/*...*/},
"created": "2018-11-14T19:10:23.824Z",
"modified": "2019-06-01T09:12:43.124Z",
"securityDefinitions": {/*...*/},
"security": /*...*/,
"base": "https://servient.example.com/",
"properties": {/*...*/},
"actions": {/*...*/},
"events": {/*...*/},
"links": [...],
"forms": [...]
}
Class
Thing のインスタンス内で
version、
securityDefinitions、
descriptions、schemaDefinitions、
uriVariables、properties、
actions、および events に割り当てられる
すべての値は、JSON objects としてシリアル化されなければならない
(MUST)。
Class Thing
のインスタンス内で links および
forms に割り当てられるすべての値は、それぞれ
6.3.8
links および
6.3.9
forms で定義される JSON objects を含む
JSON arrays としてシリアル化されなければならない
(MUST)。
Class Thing
のインスタンス内で security に割り当てられる値は、
JSON string または、その要素が JSON strings である JSON array として
シリアル化されなければならない(MUST)。
title および
description という名前の JSON members は、
TD 文書内で人間可読メタデータを提供するために使用される。
これらは、TD 文書を調べる開発者向けのコメントとして、または
user interface 向けの display texts として使用できる。
5.3.1.1
Thing で定義されているように、
人間可読メタデータの表示に使用される base text direction は、
first-strong rule などの heuristics を使用して推定することも、
言語情報から推論することもできる。TD 文書では、default
language は @context 内の
@language に割り当てられた値によって定義され、
必要に応じて script subtag とともに、base text direction を決定するために
使用できる。ただし、
人間可読テキストを解釈する際、各人間可読な
string value は独立して処理されなければならない
(MUST)。 言い換えると、
TD Processor
は、ある string から別の string へ方向の変更を引き継いだり、
TD 内の別の場所にある他の string から、ある string の方向を
推論したりすることはできない。
title および
description を使用する TD snippet を以下に示す。default
language は、@context array 内の JSON object の
@language member の定義を通じて en に設定されている。
{
"@context": [
"https://www.w3.org/ns/wot-next/td",
{ "@language": "en" }
],
"title": "MyThing",
"description": "Human readable information.",
// ...
"properties": {
"on": {
"title": "On/Off",
"type": "boolean",
"forms": [...]
},
"status": {
"title": "Status",
"type": "object",
// ...
"forms": [...]
}
},
// ...
}
Strings on the Web [STRING-META]
は、string values の base
direction を決定するために metadata を使用することを推奨している。
Thing Description 形式は
JSON-LD 1.1
[json-ld11] に基づいているため、
@direction は、string values
"ltr"、"rtl" および null value
null とともに、TD 文書全体の人間可読 strings の
default text direction を示すために @context 内で
使用してもよい(MAY)。
@direction などの metadata が存在しない場合、
TD Consumers は fallback として
first-strong detection を使用すべきである
(SHOULD)。
MultiLanguage
Map
について、
TD Consumers は、個々の strings の language tag から
base
direction を推論してもよい(MAY)。
これらは、TD で提供される情報に基づいて TD Consumers が実装できる
次の手順に要約できる。
@context に見つかる
@direction の値を使用する。
@language の値を使用し、その後テキストの方向を推測する
dir=auto を使用することと等価である。現在の仕様バージョンでは、string 固有の direction metadata は不可能であることに注意。Working Group はそれを可能にする 機構に取り組んでいる。その後は、それが TD Consumers にとって text direction を扱う推奨方法となる。
さらに、以下の例は
@direction および @language
terms の使用を示している。より詳細な情報については
[json-ld11] および [string-meta]
を参照。
{
"@context": [
"https://www.w3.org/ns/wot-next/td",
{
"@language": "ar-EG",
"@direction": "rtl"
}
],
"title": "شيء يخصني يقيس درجة الحرارة",
"description": "شيء يقيس درجة الحرارة و يظهر حالته",
// ...
"properties": {
"temp": {
"title": "درجة الحرارة",
"type": "boolean",
"forms": [...]
},
"status": {
"title": "حالة",
"type": "object",
// ...
"forms": [...]
}
},
// ...
}
titles および
descriptions という名前の JSON members は、
単一の TD 文書内で複数言語の人間可読メタデータを提供するために
TD 文書内で使用される。
MultiLanguage Map のすべての name-value
pairs は JSON object の members としてシリアル化されなければならず
(MUST)、その name は
[BCP47]
で定義される妥当な language tag(
W3C I18N Glossary も参照)であり、value はその
tag によって示される言語の人間可読 string である。
詳細は 5.3.1.7
MultiLanguage を参照。TD 文書内のすべての
MultiLanguage object は、同じ language members の集合を
含むべきである(SHOULD)。
異なるレベルで titles および
descriptions を使用する TD snippet を以下に示す:
{
"@context": "https://www.w3.org/ns/wot-next/td",
"title": "MyThing",
"titles": {
"en": "MyThing",
"de": "MeinDing",
"ja": "私の物",
"zh-Hans": "我的东西",
"zh-Hant": "我的東西"
},
"descriptions": {
"en": "Human readable information.",
"de": "Menschenlesbare Informationen.",
"ja": "人間が読むことができる情報",
"zh-Hans": "人们可阅读的信息",
"zh-Hant": "人們可閱讀的資訊"
},
// ...
"properties": {
"on": {
"titles": {
"en": "On/Off",
"de": "An/Aus",
"ja": "オンオフ",
"zh-Hans": "开关",
"zh-Hant": "開關" },
"type": "boolean",
"forms": [...]
},
"status": {
"titles": {
"en": "Status",
"de": "Zustand",
"ja": "状態",
"zh-Hans": "状态",
"zh-Hant": "狀態" },
"type": "object",
// ...
"forms": [...]
}
},
// ...
}
TD instances は、
title および description の使用を、
titles および descriptions と
組み合わせることもできる。
title と
titles、または description と
descriptions が同じ JSON object 内に存在する場合、
title および
description の値は default text と見なしてもよい
(MAY)。
title と titles、または
description と descriptions が
TD 文書内に存在する場合、各 title および
description member には、それぞれ対応する
titles および descriptions member が
あるべきである(SHOULD)。
default text の言語は default language によって示され、
これは通常 Thing Description instance の作成者によって設定される。
{
"@context": [
"https://www.w3.org/ns/wot-next/td",
{ "@language": "de" }
],
"title": "MeinDing",
"titles": {
"en": "MyThing",
"de": "MeinDing",
"ja": "私の物",
"zh-Hans": "我的东西",
"zh-Hant": "我的東西"
},
"description": "Menschenlesbare Informationen.",
"descriptions": {
"en": "Human readable information.",
"de": "Menschenlesbare Informationen.",
"ja": "人間が読むことができる情報",
"zh-Hans": "人们可阅读的信息",
"zh-Hant": "人們可閱讀的資訊"
},
// ...
"properties": {
"on": {
"title": "An/Aus",
"titles": {
"en": "On/Off",
"de": "An/Aus",
"ja": "オンオフ",
"zh-Hans": "开关",
"zh-Hant": "開關" },
"type": "boolean",
"forms": [...]
},
"status": {
"title": "Zustand",
"titles": {
"en": "Status",
"de": "Zustand",
"ja": "状態",
"zh-Hans": "状态",
"zh-Hant": "狀態" },
"type": "object",
// ...
"forms": [...]
}
},
// ...
}
default language を設定する別の可能性は、
HTTP の Accept-Language header field などの
language negotiation mechanism を通じることである。
default language が交渉された場合、
negotiation の結果と、返された content の対応する default language を
示すために、@language member が存在しなければならない
(MUST)。
default
language が正常に
交渉された場合、TD documents は、
titles および descriptions
members 内の MultiLanguage objects よりも優先して、
members title および description に対する
適切に一致する値を含むべきである(SHOULD)。
ただし、
Things はそのような動的に生成される TDs をサポートしないこと、または
language negotiation をサポートしないことを選択してもよい
(たとえば resource constraints のため)(MAY)。
TDs 内の strings が HTML rendering context で表示される保証はない。 実際、11.5 Script Injection で記述される XSS security risk を軽減するため、 TDs から取得された strings に埋め込まれた HTML tags は、これらの strings を web pages または web applications に埋め込む applications で sanitize されるべきである (したがって HTML として解釈されない)。したがって、strings に埋め込まれた HTML は、text rendering direction を指定するための適切な機構ではない。
VersionInfo のインスタンスのすべての
name-value pairs のうち、その name が
VersionInfo の
Signature に含まれる
Vocabulary Term
であるものは、Vocabulary Term を
name とする JSON members としてシリアル化されなければならない
(MUST)。
version information object の TD snippet を以下に示す:
{
// ...
"version": { "instance": "1.2.1" },
// ...
}
version member は、
TD Context Extensions に基づく、
application 固有および/または device 固有の追加 version
information のための container として意図されている。詳細は
7.1 Semantic
Annotations を参照。
Thing インスタンスでは、
securityDefinitions に割り当てられる値は、
SecurityScheme のインスタンスの
Map
である。
SecurityScheme インスタンスの
Map
のすべての name-value pairs は、
Map を
シリアル化した結果の JSON object の members として
シリアル化されなければならず(MUST)、
pair の name は JSON string としてシリアル化されなければならず
(MUST)、
pair の value、すなわち
SecurityScheme のインスタンスは JSON object として
シリアル化されなければならない(MUST)。
SecurityScheme の
Subclasses の 1 つの
インスタンスのすべての name-value pairs のうち、その name が、その
Subclass の
Signature または
SecurityScheme の
Signature に含まれる
Vocabulary Term であるものは、
SecurityScheme
Subclass のインスタンスを
シリアル化した結果の JSON object の members として、
Vocabulary Term を
name としてシリアル化されなければならない
(MUST)。
次の TD snippet は、header 内で basic username/password
authentication を指定する単純な security
configuration を示す。in に与えられている値は、実際には
Default Value
(header)であり、省略できる。
named security configuration(basic_sc)は
securityDefinitions map 内で与えられる。この例では、
その定義は、その JSON name を security
member に含めることによって有効化される。
{
// ...
"securityDefinitions": {
"basic_sc": {
"scheme": "basic",
"in": "header"
}
},
"security": "basic_sc",
// ...
}
TD 内の security configuration は必須である。
少なくとも 1 つの security definition は、
Thing level
(すなわち TD root object)で security member を通じて
有効化されなければならない(MUST)。
この configuration は、Thing と interaction するために必要な
default security mechanism と見なすことができる。
Security definitions は、
form objects 内に security member を含めることによって
form elements のレベルでも有効化してもよく
(MAY)、これは
Thing
level で有効化されたすべての定義を上書きする
(すなわち完全に置き換える)。
nosec security scheme は、security が不要な場合のために
提供される。Thing の最小 security
configuration は、次の例に示すように、
Thing level での
nosec security scheme の有効化である:
{
"@context": "https://www.w3.org/ns/wot-next/td",
"id": "urn:uuid:e9ecb6ad-cd4c-481b-96ce-5b4c57ddb844",
"title": "MyThing",
"description": "Human readable information.",
"support": "https://servient.example.com/contact",
"securityDefinitions": { "nosec_sc": { "scheme": "nosec" }},
"security": "nosec_sc",
"properties": {/*...*/},
"actions": {/*...*/},
"events": {/*...*/},
"links": [/*...*/]
}
より複雑な例として、すべての
Interaction
Affordances が basic authentication を必要とするが、
1 つだけ authentication が不要な
Thing があるとする。
status Property と toggle
Action では、basic authentication が必要であり、
Thing level で定義される。
しかし overheating Event では authentication は不要であり、
したがって security configuration は form level で上書きされる。
{
// ...
"securityDefinitions": {
"basic_sc": {"scheme": "basic"},
"nosec_sc": {"scheme": "nosec"}
},
"security": "basic_sc",
// ...
"properties": {
"status": {
// ...
"forms": [{
"href": "https://mylamp.example.com/status"
}]
}
},
"actions": {
"toggle": {
// ...
"forms": [{
"href": "https://mylamp.example.com/toggle"
}]
}
},
"events": {
"overheating": {
// ...
"forms": [{
"href": "https://mylamp.example.com/oh",
"security": "nosec_sc"
}]
}
}
}
TDs は security schemes の組み合わせも指定できる。
以下は、proxy 上の digest authentication と、
Thing 上の bearer token
authentication を組み合わせた TD snippet である。
digest scheme では、in の
Default Value
(すなわち header)は省略されているが、依然として適用される。
username/password や tokens などの対応する private security
configuration は、正常に interaction するために
Consumer 内で
構成する必要があることに注意。複数の security definitions を
有効化する場合、security member は array になる。
{
// ...
"securityDefinitions": {
"proxy_sc": {
"scheme": "digest",
"proxy": "https://portal.example.com/"
},
"bearer_sc": {
"scheme": "bearer",
"in": "header",
"format": "jwt",
"alg": "ES256",
"authorization": "https://servient.example.com:8443/"
}
},
"security": ["proxy_sc", "bearer_sc"],
// ...
}
ただし、
security element 内で security schemes を組み合わせるために
複数要素の array を使用することは現在 deprecated であり、
代わりに ComboSecurityScheme
を使用すべきである(SHOULD)。
次の例は上記と完全に等価であり、これを示している:
{
// ...
"securityDefinitions": {
"proxy_sc": {
"scheme": "digest",
"proxy": "https://portal.example.com/"
},
"bearer_sc": {
"scheme": "bearer",
"in": "header",
"format": "jwt",
"alg": "ES256",
"authorization": "https://servient.example.com:8443/"
},
"combo_sc": {
"scheme": "combo",
"allOf": ["proxy_sc", "bearer_sc"]
}
},
"security": "combo_sc",
// ...
}
Security configurations は、同じ
Interaction
Affordance 内の異なる forms に対しても指定できる。
これは、HTTP と CoAP
[RFC7252]
など、異なる security mechanisms をサポートする複数の protocols を
サポートする devices で必要となる場合がある。これは、代替の
authentication mechanisms が許可されている場合にも有用である。
ここでは、HTTPS with basic authentication、digest
authentication、bearer token authentication という 3 つの可能な方法で
Property affordance を有効化する TD snippet を示す。
言い換えると、複数の forms 内で異なる security configurations を
使用することは、security mechanisms を "OR" 方式で組み合わせる方法を
提供する。対照的に、同じ security member に複数の
security configurations を置くことは、それらを "AND" 方式で組み合わせる。
なぜならその場合、
Interaction
Affordance の有効化を許可するために、それらすべてを満たす必要があるからである。
1 つの(default)configuration を
Thing level で有効化することは
依然として必須であることに注意。
{
// ...
"securityDefinitions": {
"basic_sc": { "scheme": "basic" },
"digest_sc": { "scheme": "digest" },
"bearer_sc": { "scheme": "bearer" }
},
"security": "basic_sc",
// ...
"properties": {
"status": {
// ...
"forms": [{
"href": "https://mylamp.example.com/status"
}, {
"href": "https://mylamp.example.com/status",
"security": "digest_sc"
}, {
"href": "https://mylamp.example.com/status",
"security": "bearer_sc"
}]
}
},
// ...
}
この場合の冗長性、たとえば form elements の詳細の繰り返しを
避けるために、代わりに oneOf を持つ
ComboSecurityScheme
を使用できる。
{
// ...
"securityDefinitions": {
"basic_sc": { "scheme": "basic" },
"digest_sc": { "scheme": "digest" },
"bearer_sc": { "scheme": "bearer" },
"combo_sc": {
"scheme": "combo",
"oneOf": [ "basic_sc", "digest_sc", "bearer_sc" ]
}
},
"security": "combo_sc",
// ...
"properties": {
"status": {
// ...
"forms": [{
"href": "https://mylamp.example.com/status"
}]
}
},
// ...
}
別のより複雑な例として、OAuth 2.0 は scopes を使用する。
これらは tokens 内に現れることがある identifiers であり、その resource
(または W3C WoT の場合は
Interaction
Affordance)へのアクセスを許可するために、
resource 内の対応する identifiers と一致しなければならない。
たとえば以下では、status Property は、
scope limited を含む bearer
tokens を使用する Consumers によって
read できるが、configure Action は
special scope を含む token によってのみ invoke できる。
Scopes は roles と同一ではないが、多くの場合それらに関連付けられる。
たとえば、administrative role の者だけが "special"
interactions を実行する認可を持つかもしれない。Tokens は複数の scope を
持つことができ、dedicated web services によって users に発行される。
この例では、administrator は limited と
special の両方の scopes を持つ tokens を発行され得る一方で、
ordinary users には limited scope を持つ tokens が
提供され得る。
{
// ...
"securityDefinitions": {
"oauth2_sc": {
"scheme": "oauth2",
"flow": "client",
"token": "https://example.com/token",
"scopes": ["limited", "special"]
}
},
"security": "oauth2_sc",
// ...
"properties": {
"status": {
// ...
"forms": [{
"href": "https://scopes.example.com/status",
"scopes": ["limited"]
}]
}
},
"actions": {
"configure": {
// ...
"forms": [{
"href": "https://scopes.example.com/configure",
"scopes": ["special"]
}]
}
},
// ...
}
Thing は onboarding process を必要とすることがあり、その結果、 Consumer が Thing と interaction するために API key を必要とする。 この API key は、API key scheme が指定するように、異なる方法で Thing への request に含めることができる。以下は、 HTTPS request を送信するときに Consumer によって URI 内の API key が 置き換えられるべき URI template として、これを使用する方法の例である。
{
// ...
"securityDefinitions": {
"apikey_key": {
"scheme": "apikey",
"in": "uri",
"name": "adminKey"
}
},
"security": "apikey_key",
"properties": {
"status": {
// ...
"forms": [{
"href": "https://example.com/{adminKey}/status",
// ...
}]
}
},
// ...
}
上に示した URI templates の例の使用に加えて、
ComboSecurityScheme
の使用の別の例を挙げると、cloud service
provider によって提供される client ID と "secret" key の両方を
URL に埋め込まなければならない security scheme があるとする。
技術的には、実際に secret であり out-of-band で扱わなければならないのは
key のみであり、secret ではない client ID は TD に埋め込むことができる。
しかし、client ID を容易に rotate できない場合、privacy を高めるために
それを TD に埋め込むことを避けたい場合がある。この場合、
2 つの APIKeySecurityScheme
インスタンスを組み合わせることができ、どちらも in
location specifier に uri 値を使用して、
2 つの URI variables を宣言する。これらは、security scheme が有効な
Form 内の href で使用できる
(実際には、使用しなければならない)。例は次のとおり:
{
// ...
"securityDefinitions": {
"apikey_key": {
"scheme": "apikey",
"in": "uri",
"name": "secKey"
},
"apikey_id": {
"scheme": "apikey",
"in": "uri",
"name": "secClientID"
},
"apikey_combo": {
"scheme": "combo",
"allOf": ["apikey_key","apikey_id"]
}
},
"security": "apikey_combo",
// ...
"properties": {
"status": {
// ...
"forms": [{
"href": "https://example.com/{secClientID}/status/{secKey}",
// ...
}]
}
},
// ...
}
この例には示されていないが、uriVariables を使用して
追加の URI template variables を宣言し、それらを同じ URI template に
含めることは合法である。ただし、その names は security schemes で宣言されたものと
衝突してはならない。上の例のように、security schemes で宣言される
URI variables に特定の prefix を使用すると、name
conflicts を避けやすくなる。
Body 内の API Key: 一部のシステムでは、security parameters が
payload とともに含まれる場合もある。たとえば、あるシステムがすべての
payload に対して、auth という名前の member を含む
JSON object であることを要求し、その value が access key を含む
key という member を持つ object であるとする。
ただし、interaction によっては、JSON object の他の elements が異なることがある。
この状況は、body security information location を使用して扱うことができる。
この location では、name parameter は実際には、それが結び付けられた
各 interaction の DataSchema のルートを基準に評価される
JSON pointer であり、他の点で異なる payloads とともに使用できることに注意。
例として、brightness と color を設定する property と、オンおよびオフにする
2 つの別々の actions を持つ light がある。これらの actions の JSON
payloads は異なるが、/auth/key element は同じ相対位置に
現れるため、単一の JSON pointer を使用できる。注記: security key が
一貫しない異なる locations に現れる場合は、複数の security scheme definitions を
使用する必要がある。
{
// ...
"securityDefinitions": {
"apikey_body": {
"scheme": "apikey",
"in": "body",
"name": "/auth/key"
}
},
"security": "apikey_body",
// ...
"properties": {
"color": {
// ...
"type": "object",
"properties": {
"brightness": {
"type": "number",
// ...
},
"rgb": {
"type": "array",
// ...
},
"auth": {
"type": "object",
"properties": {
"key": {
"type": "string"
}
},
"required": ["key"]
}
},
"required": ["brightness", "rgb", "auth"],
"forms": [{
"href": "https://example.com/color",
// ...
}]
}
},
"action": {
"on": {
// ...
"input": {
"auth": {
"type": "object",
"properties": {
"key": {
"type": "string"
}
},
"required": ["key"]
}
},
"required": ["auth"],
"forms": [{
"href": "https://example.com/on",
// ...
}]
},
"off": {
// ...
"input": {
"auth": {
"type": "object",
"properties": {
"key": {
"type": "string"
}
},
"required": ["key"]
}
},
"required": ["auth"],
"forms": [{
"href": "https://example.com/off",
// ...
}]
}
},
// ...
}
body location 内の JSON pointer によって参照される location は、
それが存在しない場合に自動的に挿入されるという機能を使用することで、
この例を簡略化することができる。この場合、上記の例は
次のように簡略化できる。実際には、actions on および
off について、security information だけを保持する
data schema が実質的に作成されることに注意。
{
// ...
"securityDefinitions": {
"apikey_body": {
"scheme": "apikey",
"in": "body",
"name": "/auth/key"
}
},
"security": "apikey_body",
// ...
"properties": {
"color": {
// ...
"type": "object",
"properties": {
"brightness": {
"type": "number",
// ...
},
"rgb": {
"type": "array",
// ...
}
},
"required": ["brightness", "rgb"],
"forms": [{
"href": "https://example.com/color",
// ...
}]
}
},
"action": {
"on": {
// ...
"required": ["auth"],
"forms": [{
"href": "https://example.com/on",
// ...
}]
},
"off": {
// ...
"forms": [{
"href": "https://example.com/off",
// ...
}]
}
},
// ...
}
Thing インスタンス内で
properties に割り当てられる値は、
PropertyAffordance のインスタンスの
Map
である。すべての name-value
pairs
of a Map
of
PropertyAffordance instances は、
Map
をシリアル化した結果の
JSON object の members としてシリアル化されなければならず
(MUST)、pair の name は JSON string として
シリアル化されなければならず(MUST)、
pair の value、すなわち
PropertyAffordance のインスタンスは JSON
object としてシリアル化されなければならない(MUST)。
PropertyAffordance のインスタンスのすべての name-value pairs のうち、
その name が
PropertyAffordance、
InteractionAffordance、または
DataSchema の
Signatures の(いずれかに)含まれる
Vocabulary Term であるものは、
PropertyAffordance インスタンスをシリアル化した結果の
JSON object の members として、Vocabulary Term を
name としてシリアル化されなければならない(MUST)。
DataSchema
インスタンスのシリアル化の詳細については、6.3.10 Data
Schemas を参照。
PropertyAffordance のインスタンス内で
forms に割り当てられる値は、6.3.9
forms で定義される 1 つ以上の JSON object
serializations を含む JSON array としてシリアル化されなければならない
(MUST)。
2 つの Property affordances の snippet を 以下に示す:
Thing インスタンス内で
actions に割り当てられる値は、
ActionAffordance のインスタンスの
Map
である。
ActionAffordance インスタンスの
Map の
すべての name-value pairs は、
Map
をシリアル化した結果の
JSON object の members としてシリアル化されなければならず
(MUST)、pair の name は JSON string として
シリアル化されなければならず(MUST)、
pair の value、すなわち
ActionAffordance のインスタンスは JSON
object としてシリアル化されなければならない(MUST)。
ActionAffordance のインスタンスのすべての
name-value pairs のうち、その name が
ActionAffordance または
InteractionAffordance の
Signatures の(いずれかに)含まれる
Vocabulary Term であるものは、
ActionAffordance インスタンスをシリアル化した結果の JSON
object の members として、Vocabulary Term を
name としてシリアル化されなければならない(MUST)。
ActionAffordance のインスタンス内で
input および output に割り当てられる値は、
JSON objects としてシリアル化されなければならない(MUST)。
それらは Class
DataSchema に依存し、そのシリアル化は
6.3.10 Data
Schemas で定義される。
ActionAffordance のインスタンス内で forms に
割り当てられる値は、6.3.9
forms で定義される 1 つ以上の JSON object
serializations を含む JSON array としてシリアル化されなければならない
(MUST)。
Action affordance の TD snippet を以下に示す:
Thing インスタンス内で
events に割り当てられる値は、
EventAffordance のインスタンスの map である。
EventAffordance インスタンスの
Map の
すべての name-value pairs は、
Map
をシリアル化した結果の
JSON object の members としてシリアル化されなければならず
(MUST)、pair の name は JSON string として
シリアル化されなければならず(MUST)、
pair の value、すなわち
EventAffordance のインスタンスは JSON object として
シリアル化されなければならない(MUST)。
EventAffordance のインスタンスのすべての
name-value pairs のうち、その name が
EventAffordance または
InteractionAffordance の
Signatures の(いずれかに)含まれる
Vocabulary Term であるものは、
EventAffordance インスタンスをシリアル化した結果の
JSON object の members として、Vocabulary Term を
name としてシリアル化されなければならない(MUST)。
EventAffordance のインスタンス内で
subscription、data、および
cancellation に割り当てられる値は、
JSON objects としてシリアル化されなければならない(MUST)。
それらは
Class DataSchema に依存し、
そのシリアル化は 6.3.10
Data
Schemas で定義される。
EventAffordance のインスタンス内で
forms に割り当てられる値は、6.3.9 forms で定義される
1 つ以上の JSON object serializations を含む JSON array として
シリアル化されなければならない(MUST)。
Event object の TD snippet を以下に示す:
Event affordances は、既存の(例: WebSub
[websub])または
customer-oriented event mechanisms(例: Webhooks)を採用するために、
柔軟な方法で定義されている。このため、
subscription および
cancellation は、望ましい mechanism に従って定義できる。
さらなる詳細は
[WOT-BINDING-TEMPLATES]
を参照。
例 A.3 Webhook Event
Example は、Events が
Webhooks を記述するために subscription および
cancellation をどのように使用できるかを示している。
Link のインスタンスのすべての
name-value pairs のうち、その name が
Link の
Signature に含まれる
Vocabulary Term であるものは、
Link インスタンスをシリアル化した結果の JSON object の
members として、Vocabulary Term を
name としてシリアル化されなければならない(MUST)。
5.3.4.1
Link で提供されている link relation values に従うことが
推奨される。以下に示す例は、異なる link relation types の使用を示す。
基礎となる unit(例: ランプ)を制御する
Thing(例:
controller)を
指す reference を提供できる。このためには
controlledBy を使用できる:
Thing の
developer documentation を
指すには、値
service-doc を使用できる:
{
// ...
"links": [{
"rel": "service-doc",
"href": "https://example.com/howTo",
"type": "application/pdf",
"hreflang": "en"
}]
// ...
}
上位の Thing は Things の group を収集し、
item 値を使用してそれらを参照できる:
{
"title": "Electric Drive",
// ...
"links": [{
"rel": "item",
"href": "coaps://motor1.example.com",
"type": " application/td+json"
},
{
"rel": "item",
"href": "coaps://motor2.example.com",
"type": " application/td+json"
}]
// ...
}
Thing は、それが収集されている group を
collection 値で参照する:
{
"title": "Electric Motor 1",
"base": "coaps://motor1.example.com",
// ...
"links": [{
"rel": "collection",
"href": "coaps://drive.example.com",
"type": " application/td+json"
}]
// ...
}
Form のインスタンスのすべての
name-value pairs のうち、その name が
Form の
Signature に含まれる
Vocabulary Term であるものは、
Form インスタンスをシリアル化した結果の JSON object の
members として、Vocabulary Term を
name としてシリアル化されなければならない(MUST)。
必要に応じて、form objects は、 prefix で識別される protocol-specific Vocabulary Terms で補足してもよい (MAY)。 8.1.1 Protocol Bindings も参照。
forms
array 内の form object の TD snippet を以下に示す:
href は、
http://example.org/weather/?lat=35&lon=139
の lat や
lon のような動的変数を含む URI を
持つこともある。
その場合、URI は [RFC6570] で定義される template として
定義できる:
http://example.org/weather/{?lat,long}。
そのような場合、URI Template
variables は、JSON-object ベースの uriVariables member に、
Thing level または
Interaction Affordance level のいずれかで、関連する(一意の)
variable names を JSON names として集められなければならない
(MUST)。
Form のインスタンス内で
uriVariables に割り当てられる map 内の各 value の
シリアル化は、Class DataSchema に依拠しなければならず
(MUST)、そのシリアル化は
6.3.10
Data
Schemas で定義される。
query parameters 用の URI Template と
Interaction Affordance level の uriVariables を使用する
TD snippet を以下に示す:
{
"@context": ["https://www.w3.org/ns/wot-next/td", {
"htv": "http://www.w3.org/2011/http#"
}],
// ...
"properties": {
"weather": {
// ...
"uriVariables": {
"lat": {
"type": "number",
"minimum": 0,
"maximum": 90,
"description": "Latitude for the desired location in the world" },
"long": {
"type": "number",
"minimum": -180,
"maximum": 180,
"description": "Longitude for the desired location in the world" }
},
"forms": [{
"href": "http://example.org/weather/{?lat,long}",
"htv:methodName": "GET"
}]
},
// ...
},
// ...
}
あるいは、[RFC6570] で定義されるように、
uriVariables は
href 構造を置き換えるために使用できる。
以下に、有効な Colombia の Bogota の forecast を取得する request が
http://example.org/weather/bogota への HTTP GET request となる
example TD を示す:
{
"@context": ["https://www.w3.org/ns/wot-next/td", {
"htv": "http://www.w3.org/2011/http#"
}],
// ...
"properties": {
"weather": {
// ...
"uriVariables": {
"city": {
"type": "string",
"description": "City name to find the weather information for"
}
},
"forms": [{
"href": "http://example.org/weather/{city}",
"htv:methodName": "GET"
}]
},
// ...
},
// ...
}
以下の 2 つの例は、同じ
uriVariables 機能を使用しながら組み合わせることもできる。
http://example.org/weather/bogota/?unit=Celsius
への HTTP GET request は、次のように記述できる:
{
"@context": ["https://www.w3.org/ns/wot-next/td", {
"htv": "http://www.w3.org/2011/http#"
}],
// ...
"properties": {
"weather": {
// ...
"uriVariables": {
"city": {
"type": "string",
"description": "City name to find the weather information for"
},
"unit": {
"type": "string",
"enum": ["fahrenheit_value","celsius_value"],
"description": "Desired unit for the temperature value"
}
},
"forms": [{
"href": "http://example.org/weather/{city}/{?unit}",
"htv:methodName": "GET"
}]
},
// ...
},
// ...
}
uriVariables は主に properties
および events のためのものである。既存システムを後付けする場合、
actions に uriVariables を使用する必要がある場合がある。
一般に、新しい WoT-based system を設計する場合は、
uriVariables の使用を可能な限り避けることが推奨される。
contentType member は、media type
[RFC2046]
を割り当てるために使用され、; 文字で区切られた
attribute-value pairs として media type parameters を含む。
例:
{
// ...
"contentType": "text/plain; charset=utf-8",
// ...
}
一部のユースケースでは、Interaction
Affordance の form metadata は request を記述するだけでなく、
expected response の metadata も提供する。たとえば、Action
takePhoto は、camera の parameter settings
(aperture priority、timer など)を request payload に JSON を使用して
submit するための input schema を定義する
(すなわち "contentType":
"application/json")。この action の output は
撮影された photo であり、たとえば JPEG format で利用可能である。
そのような場合、response member は
response payload の representation format を示すために使用される
(例: "contentType":
"image/jpeg")。ここでは output schema は
必要ない。content type が representation format を完全に指定するためである。
上記で説明した takePhoto Action に基づき、
response member を持つ
form snippet を以下に示す:
{
// ...
"actions": {
"takePhoto": {
// ...
"forms": [{
"op": "invokeaction",
"href": "http://camera.example.com/api/snapshot",
"contentType": "application/json",
"response": {
"contentType": "image/jpeg"
}
}]
}
},
// ...
}
responses が payload を含むことを期待されず、したがって
contentType も持たない場合、
空の response object を使用してこの情報を
伝えることができる。
{
// ...
"actions": {
"brewCoffee": {
"description": "Invoking this action does not return a payload.",
"input": {
"type": "object",
"properties": {
"coffeeType": {
"enum": [
"espresso",
"americano",
"cappuccino",
"latte"
]
},
"useOatMilk": {
"type": "boolean",
"default": false
}
},
"required": [
"coffeeType"
]
},
"forms": [{
"op": "invokeaction",
"href": "http://coffee-maker.example.com/brew-coffee",
"contentType": "application/json",
"response": {}
}]
}
},
// ...
}
場合によっては、Interaction
Affordance の一部として Thing から受信される message が、
異なる理由によって異なることがある。そのような理由には、
error cases または有効な response に対する alternative responses があり得る。
これらの場合、additionalResponses terms を使用して
この振る舞いを記述できる。
たとえば、car engine を起動する Action Affordance は、 悪天候の場合や engine が maintenance を必要とする場合には 動作しないことがある。そのような場合、Thing は通常使用されない payloads で応答する必要がある。
Action Affordance 内に
additionalResponses member を持つ
TD snippet を以下に示す。その最初の element は、
output で記述されているものとは異なる payload で
error response を送信できる、上記のケースを示している。
value false を持つ success は、
この payload が error case を指すという事実を示し、
schema は schemaDefinitions で使用される
payload description へのリンクを可能にする。
additionalResponses 内の 2 番目の element も
error response を記述するが、この場合 response は payload を持たない。
{
// ...
"schemaDefinitions": {
"actionErrorPayload": {
"type": "object",
"properties": {
"reason": {
"type": "string",
"enum": ["cold","hot","maintenance"]
},
"timeStamp": {
"description": "UNIX time in numbers indicating when the error happened",
"type": "number"
}
}
}
},
// ...
"actions": {
"startEngine": {
"output": {
"type": "string"
},
"forms": [{
"op": "invokeaction",
"href": "http://mycar.example.com/api/engine",
"contentType": "application/json",
"additionalResponses": [
{
"success": false,
"contentType": "application/json",
"schema": "actionErrorPayload"
},
{
"success": false
},
]
}]
}
},
// ...
}
additionalResponses term は、
non-error cases でも使用できる。その場合、
success は true に設定され、
payload を記述するために別の schema を使用できる。
場合によっては、binary data が text-based
values に埋め込まれることがある。たとえば、JSON string-based value が
base64 encoded image を埋め込む場合である。
contentMediaType および
contentEncoding terms は、そのような name-value pairs の
context と encoding format を明確にするために使用できる。
contentMediaType および
contentEncoding の sample usage を以下に示す:
{
// ...
"properties": {
"image": {
"description": "Provides latest image",
"type": "string",
"contentMediaType": "image/png",
"contentEncoding": "base64",
"forms": [{
"op": "readproperty",
"href": "coaps://mylamp.example.com/lastPicture",
"cov:methodName": "GET",
"contentType": "application/json"
}]
}
},
// ...
}
forms が top level に存在する場合、
Thing によって提供される meta interactions を
記述するために使用できる。たとえば、operation types
readallproperties および
writeallproperties は、
Consumers が一度にすべての properties を
read、write、または observe できるようにする、
Thing との meta interactions のためのものである。
下の例では、forms member が TD root
object に含まれ、
Consumer は submission target
https://mylamp.example.com/properties を使用して、
単一の protocol transaction で
Thing のすべての Properties
(すなわち on、
brightness、および timer)を
read または write できる。
{
// ...
"properties": {
"on": {
"type": "boolean",
"forms": [...]
},
"brightness": {
"type": "number",
"forms": [...]
},
"timer": {
"type": "integer",
"forms": [...]
}
},
// ...
"forms": [{
"op": "readallproperties",
"href": "https://mylamp.example.com/properties",
"contentType": "application/json",
"htv:methodName": "GET"
},
{
"op": "writeallproperties",
"href": "https://mylamp.example.com/properties",
"contentType": "application/json",
"htv:methodName": "PUT"
}]
}
Thing-level uriVariables は、operation に
さらなる variables を供給するため、または
readmultipleproperties operation のための
Property Affordance names のリストを指定するために使用できる。
下の例では、properties の unit はそのような variable を介して設定でき、
目的の properties のリストも設定できる:
{
// ...
"properties": {
"temperature": {
"type": "number",
"forms": [...]
},
"brightness": {
"type": "number",
"forms": [...]
},
"humidity": {
"type": "integer",
"forms": [...]
}
},
"uriVariables": {
"propertyNames": {
"type": "string",
"description": "Comma separated list of property names to select."
},
"unitSystem": {
"type": "string",
"enum": ["metric","imperial","uscustomary"],
"description": "System of Measurement that will be used for the values"
}
},
"forms": [{
"op": "readallproperties",
"href": "https://mything.example.com/properties{?unitSystem}",
"contentType": "application/json",
"htv:methodName": "GET"
},
{
"op": "readmultipleproperties",
"href": "https://mylamp.example.com/properties{?propertyNames,unitSystem}",
"contentType": "application/json",
"htv:methodName": "GET"
}]
}
readmultipleproperties operation では、
URI
https://mylamp.example.com/properties?propertyNames=humidity,temperature&unitSystem=metric
への example HTTP GET request は、
metric System of Measurement を用いて、
humidity および
temperature Property Affordances の値を返す。
operation type
writeallproperties の場合、
Consumer は、すべての
writable(non readOnly)properties と
(新しい)割り当て値(例: payload 内)を提供することが期待される。
同様に、writemultipleproperties operation
type では、Consumer が writable
(non readOnly)properties を提供することが期待される。
Thing 側では、
Thing は、
readmultipleproperties および
readallproperties operation types の場合に
readable(non writeOnly)properties を返すことが期待される。
DataSchema
Class
を通じて定義される
WoT Thing Description の data schemas は、
JSON Schema terms
[JSON-SCHEMA]
のサブセットに基づく。
したがって、TD data schemas の serializations は、
Things
と交換される data を
validate するために、JSON Schema validator implementations に直接渡すことができる。
Data schema serialization は、
PropertyAffordance instances、
ActionAffordance instances 内で
input および output に割り当てられる values、
EventAffordance instances 内で
subscription、data、
cancellation に割り当てられる values、および
(form object が URI
Template を使用する場合)
InteractionAffordance の
Subclasses のインスタンス内で
uriVariables に割り当てられる value に適用される。
DataSchema の
Subclasses の 1 つの
インスタンスのすべての name-value pairs のうち、その name が、その
Subclass の
Signature または
DataSchema の
Signature に含まれる
Vocabulary Term であるものは、
DataSchema
Subclass のインスタンスを
シリアル化した結果の JSON object の members として、
Vocabulary Term を
name としてシリアル化されなければならない(MUST)。
ObjectSchema のインスタンス内で
properties に割り当てられる値は、
JSON object としてシリアル化されなければならない(MUST)。
DataSchema のインスタンス内で
enum、required、および
oneOf に割り当てられる values は、
JSON array としてシリアル化されなければならない(MUST)。
ArraySchema のインスタンス内で
items に割り当てられる値は、
JSON object または JSON objects を含む JSON array として
シリアル化されなければならない(MUST)。
data schema members の TD snippet を以下に示す。
surrounding object は data schema object
(例: input および output のため)または
追加の members を含む Property object である可能性があることに注意。
readOnly および
writeOnly terms は、read interactions
(すなわち Property を読み取るとき)でどの data
items が交換され、write interactions
(すなわち Property を書き込むとき)でどの data
items が交換されるかを示すために使用できる。これは、
unconventional な Thing の Properties が
読み取りと書き込みで異なる data を示す場合に workaround として使用できる。
これは既存の device または service を Thing Description で拡張する場合に
起こり得る。
readOnly および
writeOnly の使用を含む TD snippet を以下に示す:
{
// ...
"properties": {
"status": {
"description": "Read or write On/Off status.",
"type": "object",
"properties": {
"latestStatus": {
"type": "string",
"enum": ["on_value", "off_value"],
"readOnly": true
},
"newStatusValue": {
"type": "string",
"enum": ["on_value", "off_value"],
"writeOnly": true
}
},
"forms": [...]
}
}
// ...
}
status Property が読み取られるとき、
status data は payload 内の latestStatus
member を使用して返される。status
Property を更新するには、新しい値を payload 内の
newStatusValue member を通じて提供しなければならない。
追加機能として、Thing Description instance は
data schemas 内で unit member の使用を許可する。
これは data item に unit of measure を関連付けるために使用できる。
その string value は自由に選択できる。
ただし、well-known Vocabularies で定義された units を選択することが
推奨される。例については 7. TD
Context Extensions を参照。
Thing Descriptions の JSON ベースのシリアル化は、
media type application/td+json
または CoAP Content-Format ID 432 によって識別される(13.
IANA Considerations を参照)。
いくつかの文脈では、Thing Description の JSON ベースの シリアル化を自動検証することが有用である。形式的には、 valid TD はこの仕様内のすべての assertions を満たすが、 すべての assertions が JSON シリアル化だけを与えられて 検証できるわけではない。たとえば、 TD とそれが記述する Thing の behavior とを関連付ける 9. Behavioral Assertions の下に 列挙された assertions である。Extensions も問題を伴う。 extension を検証するための formal metadata が与えられていても、 deployment 内でこの metadata を動的に取得することは privacy risk を生じさせる可能性があるためである。したがって、 このセクションでは、異なる文脈に適したさまざまなレベルの validation を命名し定義する。
このレベルの validation には、この文書内の規範的な tables によって含意されるすべての assertions と、TD 自体だけを 見ることで確認できる assertions が含まれる。
Minimal Validation は、validation が自己完結的である必要がある場合 (例: isolated networks 上の devices)に適している。 context extensions および vocabularies を検証しようとはしない。
実際には、これらの assertions は JSON Schema といくつかの spot checks を 組み合わせて検証できる。たとえば security schema names が対応する definitions を持つことを確認する場合である。
このレベルの validation には、 6.5.1 Minimal Validation で扱われるすべてのものに加えて、semantic definitions の basic validation が含まれる。
Basic validation は、network access が可能で privacy risk をもたらさず、かつ computing requirements が比較的制約されていない 状況に適している。たとえば gateways には適しているが、 semantic processing が必要であるため endpoints には適していない。 extensions の basic validation、具体的には使用される vocabulary が 定義されていることを検証できる。
この場合、context definition files および SHACL definitions を使用して、追加の assertions を検証し、 TDs の semantic consistency を確認できる。さらに、 extension vocabularies の context definitions および SHACL constraints を 取得できる場合、それらを使用して extensions を検証できる。
Full validation は、この文書内のすべての assertions が満たされていることを 確認する。これには、TD がそれが記述する Thing と一貫していることを 確認する 9. Behavioral Assertions で 与えられる assertions も含まれる。
このレベルの validation は、development 中、release 前、 および場合によっては installation 後に適している。 development 中の validation は test Things 上で行う必要がある。 そのような Things の instances の実際の installation には、 適切な per-instance identifiers および URLs で TD を更新することが 必要であるため、最大限の assurance のためには、in-field validation は installation 後に行われる必要がある。
このセクションは非規範的である。
5. TD Information Model における標準の Vocabulary 定義に加えて、 WoT Thing Description は追加の名前空間から context knowledge を追加する可能性を提供する。この mechanism は、 Thing Description instances を追加の(例: domain-specific) semantics で拡張するために使用できる。また、将来的に追加の Protocol Bindings または新しい security schemes を import するためにも使用できる。
そのような TD
Context
Extensions のために、Thing Descriptions は JSON-LD
[json-ld11] で知られる
@context mechanism を使用する。
TD
Context
Extensions を使用する場合、
Class
Thing の @context の値は、
JSON-LD context files を識別する anyURI
型の追加要素、または
5.3.1.1 Thing
で定義される namespace IRIs を含む
Map を持つ Array である。
6.1 Mapping to JSON Types における
complex types の
serialization rules は、拡張された @context
name-value pair の serialization を定義する。
TD
Context Extensions を持つ snippet を
以下に示す:
{
"@context": [
"https://www.w3.org/ns/wot-next/td",
{
"eg": "http://example.org/iot#",
"cov": "http://www.example.org/coap-binding#"
},
"https://schema.org/"
],
// ...
}
TD
Context Extensions は、Thing Description instance 内で追加の
Vocabulary Terms の使用を可能にする。
含まれる namespaces が RDF Schema または OWL によって提供されるものなどの
Class
definitions に基づく場合、それらは Thing
Description の任意の Class instance を、
その instance をそのような外部
Class
definition に関連付けることによって、semantic に annotate するために使用できる。
これは、@type name-value pair に
Class name
を割り当てるか、複数の
associations/annotations のために、その
Array value
に
Class name
を含めることで行われる。
6.1 Mapping to JSON
Types の serialization rules に従い、@type は JSON
string または JSON array としてシリアル化される。@type は、
node の type を設定するために使用される JSON-LD
keyword [json-ld11] である。
TD Context Extensions は、Thing Description の任意の Class instance 内に、 追加の name-value pairs および well-defined values を含めることも可能にする。 これらの pairs および values は、含まれる Vocabulary Terms を通じて定義され、 対応する JSON objects 内の追加 members、または既存 members の values として、それぞれシリアル化される。例としては、 Thing の追加 version metadata や、 data items の units of measure がある。
次の subsections は、Thing Descriptions における異なる種類の ontologies の sample usage を示す。
以下の sample TD snippet は、@context で提供される
different external context files からの追加 metadata
terms を提供する。version information container は、使用される software
に関する追加 version information(s:softwareVersion)を
追加することによって拡張される。schema.org は、
Thing の
company name など、
serial number および organisation information を提供するために使用される。
SAREF
ontology は、Thing
(saref:TemperatureSensor)の semantic context を提供するために使用され、
temperature property の unit assignment には
Ontology of Units of Measure (OM) が使用される。
これらの Vocabularies および ontologies は例として使用されていることに注意。application domain および use case に 基づいて、他のものも使用できる。
{
"@context": [
"https://www.w3.org/ns/wot-next/td",
{
"saref": "https://w3id.org/saref#",
"om": "http://www.ontology-of-units-of-measure.org/resource/om-2/",
"schema": "https://schema.org"
}
],
"version": {
"instance": "1.2.1",
"schema:softwareVersion": "1.0.1"
},
"schema:serialNumber": "4CE0460D0G",
"schema:manufacturer": {"name": "CompanyName"},
// ...
"@type": "saref:TemperatureSensor",
"properties": {
"temperature": {
"description": "Temperature value of the weather station",
"type": "number",
"minimum": -32.5,
"maximum": 55.2,
"unit": "om:degreeCelsius",
"forms": [...]
},
// ...
},
// ...
}
多くの場合、TD Context Extensions は、 data schema の一部を annotate するために使用できる。これにより、 interaction 中に交換される data(例: response の payload 内)によって 表される physical world object の state information を semantic に 処理できる。たとえば、この state information の RDF による semantic description を TD Document に埋め込み、 data schema の一部を、その RDF-modeled state of the physical world object の特定部分を参照するものとして個別に annotate できる。
以下の TD snippet は、lamp の state を記述するために SAREF を使用する。
SSN、すなわち Semantic
Sensor Network Ontology [VOCAB-SSN] から取られた
外部 Vocabulary Term
ssn:forProperty が、
status Property の data schema を
physical world object の実際の on/off state に link するために使用されている。
{
"@context": [
"https://www.w3.org/ns/wot-next/td",
{
"saref": "https://w3id.org/saref#",
"ssn": "http://www.w3.org/ns/ssn/"
}
],
"id": "urn:uuid:67c9122b-2680-4e1a-b41c-5af07edba1f4",
"@type": "saref:LightSwitch",
"saref:hasState": {
"@id": "urn:uuid:67c9122b-2680-4e1a-b41c-5af07edba1f4/state",
"@type": "saref:OnOffState"
},
// ...
"properties": {
"status": {
"ssn:forProperty": "urn:uuid:67c9122b-2680-4e1a-b41c-5af07edba1f4/state",
"type": "string",
"forms": [{"href": "https://mylamp.example.com/status"}]
},
"fullStatus": {
"ssn:forProperty": "urn:uuid:67c9122b-2680-4e1a-b41c-5af07edba1f4/state",
"type": "object",
"properties": {
"statusString": { "type": "string" },
"statusCode": { "type": "number" },
"statusDescription": { "type": "string" }
},
"forms": [{"href": "https://mylamp.example.com/status?full=true"}]
},
// ...
},
// ...
}
例 2 では、
Thing の
state は status affordance 自体によって与えられ、
可能な state changes は toggle affordance によって与えられる。
言い換えると、physical world object の state は、
Thing の
Interaction
Affordances を直接提供する。この設計は
simple cases には十分である。しかし、より精巧な cases では、
同じ physical state に対して複数の affordances が利用可能である場合がある。
上の例では、
fullStatus Property が、lamp の state に対する
alternative でより verbose な representation を提供する。
building、agriculture、smart city のような多くの use cases では、 location based data が必要である。この information は Thing Description 内で異なる方法で提供でき、purpose(例: indoor、outdoor)に応じて、 異なる種類の location ontologies(例: [w3c-basic-geo]、 schema.org)に依拠できる。[sdw-bp] も参照。
以下の TD snippet は、Thing の top level で static latitude および longitude metadata
を提供するために、[w3c-basic-geo]
ontology の lat および
long を使用する。
{
"@context": [
"https://www.w3.org/ns/wot-next/td",
{
"geo": "http://www.w3.org/2003/01/geo/wgs84_pos#"
}
],
"@type": "Thing",
"geo:lat": "26.58",
"geo:long": "297.83",
// ...
"properties": {
// ...
}
}
一部の use cases では、location based metadata を interaction level で
提供しなければならない。たとえば、schema.org に基づく最新の
longitude、latitude、
および elevation values を返す
Property として提供される場合である:
{
"@context": [
"https://www.w3.org/ns/wot-next/td",
{
"schema": "https://schema.org#"
}
],
// ...
"properties": {
"position": {
"type": "object",
"@type": "schema:GeoCoordinates",
"properties": {
"longitude": { "type": "number" },
"latitude": { "type": "number" },
"elevation": { "type": "number" }
},
"forms": [{"href": "https://robot.example.com/position"}]
},
// ...
},
// ...
}
data model 内の longitude、latitude、
および elevation などについて異なる name が望まれる場合、
jsonld:context を使用して、terms を ontology からの
specific vocabulary に link できる([JSON-SCHEMA-ONTOLOGY]、
Section 3.3 Defining a JSON-LD context for data
instances も参照):
{
"@context": [
"https://www.w3.org/ns/wot-next/td",
{
"schema": "https://schema.org#"
}
],
// ...
"properties": {
"position": {
"jsonld:context": {
"schema": "https://schema.org/",
"long": "schema:longitude",
"lat": "schema:latitude",
"height": "schema:elevation"
},
"type": "object",
"properties": {
"long": { "type": "number" },
"lat": { "type": "number" },
"height": { "type": "number" }
}
}
},
// ...
}
Thing Description 内の TD
Context Extensions により、communication metadata は WoT Binding Registry
[WOT-BINDING-REGISTRY]
からの Binding
Specifications を介して補足できる。
これは、Form instance を表す JSON objects に
シリアル化される追加の Vocabulary Terms を通じて追加される。
さらなる information については 8. Bindings
を参照。
最後に、
5.3.3 Security
Vocabulary
Definitions に含まれていない新しい security schemes は、
TD
Context Extension
mechanism を使用して import できる。この例では、[RFC9200]
に基づく架空の ACE security scheme を使用しており、この例では
http://www.example.org/ace-security# の namespace によって定義される。
Additional security schemes は、
SecurityScheme
Class の
Subclasses でなければならない
(MUST)。
{
"@context": [
"https://www.w3.org/ns/wot-next/td",
{
"cov": "http://www.example.org/coap-binding#",
"ace": "http://www.example.org/ace-security#"
}
],
// ...
"securityDefinitions": {
"ace_sc": {
"scheme": "ace:ACESecurityScheme",
// ...
"ace:as": "coaps://as.example.com/token",
"ace:audience": "coaps://rs.example.com",
"ace:scopes": ["limited", "special"],
"ace:cnonce": true
}
},
"security": ["ace_sc"],
"properties": {
"status": {
// ...
"forms": [{
"op": "readproperty",
"href": "coaps://rs.example.com/status",
"contentType": "application/cbor",
"cov:methodName": "GET",
"ace:scopes": ["limited"]
}]
}
},
"actions": {
"configure": {
// ...
"forms": [{
"op": "invokeaction",
"href": "coaps://rs.example.com/configure",
"contentType": "application/cbor",
"cov:methodName": "POST",
"ace:scopes": ["special"]
}]
}
},
// ...
}
5.3.3 Security Vocabulary Definitions で定義されるすべての security schemes は、 すでに TD context の一部であり、 TD Context Extension を通じて 含める必要はないことに注意。
WoT によって提供される Property–Action–Event 抽象化にもかかわらず、
Consumer から Thing へ、そして Thing から戻って送信されるすべての message は、
network protocol 上を移動する必要がある。Forms level の
operations は、その message が network 上でどのように見えるべきかに
bind される必要がある。したがって、WoT Thing Description 内のすべての form は、
Form で示されているように、href member によって与えられる
submission target を持つ必要がある。たとえば、target が
http または https で始まる場合、Consumer は、
Thing が
HTTP に基づく Protocol Binding を実装していると推論でき、
この form の instance 内で HTTP-specific terms を期待すべきである。
詳細な説明と例については 8.1.1 Protocol Bindings
を参照。
さらに、Affordance
Level の Data Schema によって記述される payloads は、
data format にシリアル化され、network protocol 上で送信される必要がある。
operations が protocol messages に bind される方法と同様に、
Data
Schema は、
Form で提供される contentType または
protocol-specific terms によって示される data
format に bind される。これらの terms から、Consumer
は必要な serialization method を推論し、application-level data を
network protocol 上で送信される data に変換できる。同様に、
Thing から来る
messages については、Consumer が data をデシリアル化し、
application level に提示できる。たとえば、Python で実装された
Consumer
は、contentType の値として application/json を読み取り、
Python dictionary data structure を JSON object にシリアル化できる。
詳細な説明と例については 8.1.2 Payload Bindings
を参照。
上記の mechanism は Web of Things では Bindings と呼ばれ、
具体例は、HTTP および JSON Bindings を持つ robot arm の TD 抜粋とともに、
図 5 に示されている。
ここで Consumer は、x が 12、y が 100 に等しい position へ移動させるために、
robot arm の action(goTo)を invoke しようとしている。
そのために、正しい payload を作成し、それをシリアル化し、正しい protocol
options を使用して送信する。Thing は network 経由で message を受け取り、
その TD に対応する message で応答する。他の protocols、payload formats、
および/またはそれらの組み合わせも可能であり、
8.1 Binding
Mechanisms で説明される。
要約すると、Bindings は、Thing Description を特定の protocol、 data payload formats、またはその両方に、特定の方法で 適応させることを可能にする。これは、URI Schemes、追加の記述 vocabulary、 Thing Models、および Things と Consumers の implementors の双方を導くことを目的とする examples を通じて行われる。このセクションでは、全体的な mechanism を説明し、 新しい Bindings を作成するための基本的な guidance を示す。 [WOT-BINDING-REGISTRY] には、既存の Bindings の registry(list)と、 registry に新しい entries を登録するために従うべき requirements が含まれる。
特定の IoT device の TD を生成する場合、 対応する Binding を使用して、Thing Description で提供すべき communication metadata を調べることができる。 図 6 は、Bindings がどのように使用されるかを示す。 protocol または media type に基づいて、TD が作成される。 TD を処理している Consumer は、対応する protocol stack と media type encoder/decoder を 含め、TD に存在する required Bindings を実装する。このとき、 messages の serialization format や header options など、TD で与えられた information に従って stack(またはその messages)を構成する。
この仕様の editors は、 [WOT-ARCHITECTURE] 内の関連 chapters も読むことを推奨している。たとえば、 WoT Binding Templates Building Block、 Hypermedia Controls、 Protocol Bindings、および Media Types である。
[WOT-THING-DESCRIPTION]
は、readproperty、invokeaction、
subscribeevent などの abstract operations を定義しており、
それらは Thing Description 内の form によって記述される
operation を実行する意図された semantics を記述する。
operations が affordance 上で実行されるためには、operation を protocol に
bind する必要がある。言い換えると、form は、Consumer がたとえば property を
form 内の protocol で read するためのすべての information を含む必要がある。
ほとんどの protocols は、message type、すなわち message の semantic intention を
定義する比較的小さな methods の集合を持つ。REST および PubSub
architecture patterns は、異なる methods を持つ異なる protocols を生じさせる。
各 target protocol は、類似 operations に対して異なる method names を指定する場合があり、
異なる protocols の類似 method names の間には semantic differences がある場合がある。
さらに、
Things
は特定の WoT operation を実行するために異なる methods を使用する場合がある。
たとえば、ある Thing では writeproperty operation に HTTP POST
request が使用される一方、別の Thing では HTTP PUT が使用されることがある。
これらの理由により、Thing Descriptions には operation ごとにどの method を使用するかを
指定する能力が必要である。
REST および PubSub protocols に見られる一般的な methods は
GET、PUT、POST、DELETE、PUBLISH、SUBSCRIBE である。
Binding specifications は、これらの既存の methods と関連 vocabularies を
Thing Description 内で
WoT operations に bind するためにどのように使用できるかを記述する。
これは、protocol の URI scheme を定義し、protocol methods を
readproperty、invokeaction、
subscribeevent などの abstract WoT operations に
mapping することで行われる。場合によっては、protocol
usage の異なる cases で vocabulary terms をどのように使用すべきかを説明するために、
追加の instructions が提供される。
以下の例は、HTTP および Modbus protocols に対する
readproperty operation の binding instances を示す。
これらは examples であり、関連する vocabulary terms とその values について知るには、
常に対応する binding specification を参照することに注意。
|
例 53: readproperty operation
から HTTP への binding instance
|
例 54: readproperty operation
から Modbus への binding instance
|
上の例の form elements は、次の statements を伝える:
readproperty を行うには、
host example.com の port
80 にある resource props/temperature に対して
HTTP GET request を実行する(Port 80 は
[RFC2616] に従って
仮定される)。
127.0.0.1、unitID
1、port 60000 の device の coil
4 に対して、Modbus の
readCoil function を使用して subject Property Affordance の
readproperty を行う。
これらの binding instances とその statements は、
他の operations および protocols に対しても可能である。以下は
invokeaction および
subscribeevent の例である:
|
例 55:
invokeaction operation から HTTP への binding instance
|
例 56: subscribeevent operation
から MQTT への binding instance
|
上の例の form elements は、次の statements を伝える:
192.168.1.32 の port
8081 にある resource example/levelaction に対して
HTTP POST request を実行することにより、subject Action Affordance の
invokeaction を行う。
iot.platform.com の port
8088 にある MQTT broker に接続し、その後 topic
thing1/events/overheating を subscribe することにより、
subject Event Affordance の subscribeevent を行う。
場合によっては、protocols の header options またはその他の parameters を
含める必要がある。これらは protocol に大きく依存するため、
Web of
Things (WoT) Binding Registry に listed された bindings を参照。
さらに、protocols は一部の interaction types に使用できる Subprotocols を
定義している場合がある。たとえば、HTTP を使用して asynchronous notifications を
受け取るために、一部の servers は long polling(longpoll)、
WebSub
[WebSub]
(websub)および Server-Sent Events
[eventsource]
(sse)をサポートすることがある。
[WOT-ARCHITECTURE]
で定義されるように、subprotocol は protocol に対する extension mechanism である。
subprotocol は、一連の protocol messages または message payloads の特定の構造を
要求でき、その subprotocol 内で独自の semantics を持つことができる。
subprotocol の使用は、
[WOT-THING-DESCRIPTION]
で定義される subprotocol field で表現される。
これは form instance 内で、たとえば HTTP の特別な使用を伴う long polling など、
これらの protocols の 1 つの使用を示すために使用できる:
{
"op": "subscribeevent",
"href": "https://mylamp.example.com/overheating",
"subprotocol": "longpoll"
}
subprotocol term が取ることのできる values は、
[WOT-THING-DESCRIPTION]
によって制約されていない。異なる protocols は異なる subprotocols を
持つことができるためである。対応して、subprotocols はそれらが拡張する
protocol に link され、forms の href(または base)で
示される protocol とともに理解されるべきである。WebSockets については、
IANA-registered Websocket Subprotocols
[iana-web-socket-registry]
を使用できる。CoAP については、
[RFC6741]
によって定義される asynchronous observation operations を記述するために
"subprotocol":"cov:observe" を使用できる。
subprotocols は、protocol binding
specification の一部として定義および説明できる。
Protocol Binding Specifications は、 [WOT-THING-DESCRIPTION] に見られる vocabulary を拡張する vocabularies を含む。 これは、TD がどのように consume されるか、および Thing との interactions が どのように発生するかが、そのような vocabularies に適応されることを意味する。 以下の steps は、この process が通常どのように見えるかを説明する。
href member と base
(存在する場合)を見て、protocol を識別すべきである
(SHOULD)。
subprotocol や protocol binding によって導入される
他の vocabulary terms など、異なる form terms を使用して指定される。
Thing と交換される interaction affordance data は、TD 内に存在する
Data Schema および
Content Type に従うべきである
(SHOULD)。operation に対応する Data Schema は
Table 表 28 に見つけられる。
したがって、次の requirements が Things および Consumers に適用される:
href member の URI scheme
[RFC3986]
によって示される Protocol Binding の
requirements に従わなければならない(MUST)。[WOT-THING-DESCRIPTION]
は、任意の protocol 上の message の payload がどのように見えるかを記述するための
2 つの mechanisms を定義する。第一に、media
types [IANA-MEDIA-TYPES] は、protocol で data を送受信するために
使用される serialization を記述する。これらは TD の Forms 内の
contentType に表され、これは各 Interaction Affordance に必須である。
第二に、messages の構造を記述するための Data Schema concept を定義し、
これは media types とともに使用される。この 2 つの組み合わせにより、
任意の message を TD 内で記述でき、Thing および Consumers による
messages の正しい serialization と deserialization が可能になる。
このセクションの残りの 8.1.2.1 Content Types および 8.1.2.2 Data Schemas では、payload bindings がどのように見えるかの例を見つけられる。
Content type は media type と media type の potential parameters を含み、serialized documents の proper processing を可能にする。このようにして、messages は任意の format で交換でき、 application の upper layers が異なる formats に適応できるようにする。 images、videos、または任意の unstructured data などの場合には、 content type だけで payload を記述するのに十分だが、JSON ([RFC8259]) のような場合には、通常、 8.1.2.2 Data Schemas で説明されるように Data Schema が提供される。
たとえば、number payload は JSON または XML としてシリアル化でき、
forms の contentType 内で、それぞれ
application/json または
application/xml によって示すことができる。さらに、
plus(+)または semicolon(;)notations によって
parametrization が可能である。
以下の例では、JSON および追加 parameters を持つ plain text の
content types を含む form elements を見つけられる。この特定の case では、
forms は、この property を http または
coap で reading すると、異なる content types になることを記述する。
structured media types では、一般に affordance level で Data Schema が提供される。
これは 8.1.2.2 Data
Schemas および 5.3.2 Data Schema
Vocabulary Definitions で説明されるとおりである。
しかし、images や videos などの unstructured
data では、Data Schema は通常利用できない。
{
"forms":[
{
"href": "http://example.com/properties/temperature",
"op": "readproperty",
"contentType": "application/json"
},
{
"href": "coap://example.com/properties/temperature",
"op": "readproperty",
"contentType": "text/plain;charset=utf-8"
}]
}
他の content types も TDs 内で表現できる。 下の list では、異なる content type variations の例を見つけられる。 これらの content types は 例 58 のものを置き換えることができる。
image/jpeg: JPEG imagevideo/mp4: MP4 Videoapplication/octet-stream: Generic
binary stream5.3.2 Data Schema Vocabulary Definitions で説明されるように、Data Schema は、 media types とともに使用される messages の構造を記述する。 JSON Schema [json-schema] に大きく触発されているものの、 [XML]、 string-encoded images、integers の bit representations など、 他の payload types を記述するためにも使用できる。 Data Schema は media types に加えて使用すべきである (SHOULD)。
case によって、messages の構造は単純な number から、 multiple levels of nesting を持つ arrays または objects まで、何でもあり得る。 既存の IoT Platforms および Standards は、data がどのように構造化されるかに variations を持つ特定の payload formats を持っている。 5.3.2 Data Schema Vocabulary Definitions で説明されるように、Data Schema は TD 内で 次のいずれかの場所に使用できる:
input および
output vocabulary terms は、Action Affordance を input
parameters で invoke し、status information を受け取る場合など、
data が双方向で交換されるときに 2 つの異なる schemas を提供するために使用される。
data、
dataResponse、subscription
および cancellation は、それぞれ Exposed
Thing によって event data が delivery されるときの payload、
event deliveries に reply するための payload、event を subscribe するために必要な
payload、および Exposed Thing から event data を受け取ることを cancel するために
必要な payload を記述するために使用される。
uriVariables は request URI 内に string として
supplied される必要がある data を記述できる。以下は、対応する Data Schema を持つ simple JSON object payload の例である。 さまざまな IoT Platforms および Standards からの例は E. Examples of Payloads and Data Schemas from IoT Platforms and Standards に見つけられる。
|
例
59: Simple JSON Object
Payload
|
例 60: Simple JSON
Object Payload の DataSchema
|
IoT platforms や OPC-UA、BACnet のような standards では、 protocol、media type、および data structure を指定できる。 これらの場合、その binding specification は、一連の 8.1.1 Protocol Bindings および 8.1.2 Payload Bindings に 依存することも、protocol、media type、および data structure を同時に 指定することもできる。
IoT platforms では、HTTP を特定の JSON payload structures とともに 使用することについての requirement が存在する場合がある。 したがって、対応する binding specification は、multiple bindings の semantic grouping を可能にする Thing Models および TDs の examples を提供する。 これには、まず HTTP および JSON のための binding specification があることが必要である。
OPC-UA や BACnet のような standards では、 binding specification は protocol および media type に関する requirements を含み、 場合によっては data structure に関する requirements も含む。 したがって、 binding specification それ自体で、 binding instance がどのように見えるべきかを指定するのに十分である。
Web of Things は、implementation effort の削減を可能にする profiling mechanism も定義する。Profiles は、TDs の flexibility を制約することによって、 既存の Bindings の上に構築される。そのような constraints には、 bindings、semantic contexts、link relations、security schemes、 discovery mechanisms があり得る。これらの constraints により、 bindings を超える追加の interoperability guarantees を提供する。
[WOT-PROFILES] で現在指定されている profiling mechanism は、上記の mechanism に正確には従っていない。 しかし、profiling mechanism の将来については合意がある。 profiling mechanism が更新されると、このセクションもそれに応じて更新される。
たとえば、profile は readproperty operations に対する HTTP GET
Method の使用を制約し、payloads が常に JSON でシリアル化されることを要求できる。
profile の使用は TD 内の profile term によって示され、
これは profile definition を指す URI である。
Consumer が profile をどのように使用できるかは、
[WOT-PROFILES]
specification の Profiling
Mechanism セクションで説明される。
以下のアサーションは、TD の表現または情報モデルとは対照的に、 WoT system の components の振る舞いに関係する。 ただし、TDs は記述的なものであり、特に既存の network interfaces を記述するために使用される場合があることに注意。 そのような場合、そのような既存 interfaces の振る舞いを制約する アサーションを行うことはできない。代わりに、これらのアサーションは、 そのような interfaces を正確に表すための TD に対する制約として 解釈される。
安全な相互運用を可能にするため、security configurations は Thing の要件を正確に反映する 必要がある:
一部の security protocols は、必要な encoding または encryption schemes を含む authentication information を動的に要求する場合がある。 上記の帰結の 1 つとして、protocol が Thing Description 内で宣言されていない security credentials の形式、または encoding もしくは encryption scheme を 要求する場合、その Thing Description は無効と見なされる。
TD で提供される data schemas は、TD で指定された interactions において、 記述された Thing によって返され、受け入れられる data payloads を正確に表すべきである。一般に、Consumers は data schemas に厳密に従うべきであり、WoT Thing Description に与えられていないものを 生成すべきではないが、WoT Thing Description に明示的に与えられていない Thing からの追加 data は受け入れるべきである。 一般に、Things は WoT Thing Descriptions によって記述されるが、 Consumers は Things と interaction するとき、 WoT Thing Descriptions に従うよう制約される。
ObjectSchema および
ArraySchema(items が
DataSchema の Array である場合)に適用され、
返される data に追加 properties または items が存在し得る。
これは [JSON-SCHEMA]
で定義される "additionalProperties":true または
"additionalItems":true であるかのように振る舞う。
ObjectSchema および ArraySchema
(items が DataSchema の Array である場合)に適用され、
返される data に追加 properties または items が存在し得る。これは
[JSON-SCHEMA]
で定義される "additionalProperties":true または
"additionalItems":true であるかのように振る舞う。
下の図は、Thing Model と Thing Description の関係を示している。Thing Model は主に、 Properties、Actions、および Events などの interaction affordances と共通 metadata を記述する。 Thing Descriptions が Thing Model に依拠して instantiate される場合、 その Thing Model に従って valid であるべきである(SHOULD)。 この paradigm は、objects(~Thing Descriptions)を作成するための object-oriented programming における abstract class または interface definition (~Thing Model)と比較できる。
Thing Model は、interface と、Thing の Properties、Actions、および Events との 可能な interaction の logical description であるが、concrete protocol usage(例: IP address)、serial number、GPS location などの Thing instance-specific information は含まない。ただし、 Thing Models は、たとえば model が記述する instances の class 全体に適用される場合には、 security schemes を含めることを許可する。それらは URLs(例: token servers のようなもの)を 持つことがあり、それらは omit または(templates によって)parameterized される必要があるかもしれないが、 多くの場合は与えられてもよい。
Thing
Model は Thing Description と同じ JSON-based format でシリアル化でき、
JSON-LD processing も可能にする。
mandatory terms が一部欠けているため、Thing
Model は Thing
Description instances と同じ方法では validate できないことに注意。
これは、placeholder type を使用していない任意の term は、依然として
TD Information
Model で宣言された types を使用することを意味する。
たとえば、minimum の値は、placeholder が使用されない限り、
integer である必要がある。
JSON としてシリアル化された TM instances を validate するために、 JSON Schema を使用できる。
Thing
Model は top level の @type によって認識される。
Thing Model definitions は、
top level で keyword @type を使用し、
string 型の値、または tm:ThingModel と等しい、またはそれぞれ含む
array 型の値を使用しなければならない(MUST)。
さらに、
JSON-LD document として識別するために、Thing Model definitions は
Thing Description と同じ rules で、top level に keyword
@context を使用しなければならない(MUST)。
prefix tm は、
Thing Descriptions の context 内で定義され、
4. Namespaces で定義される
Thing Model namespace を指す。
tm context からの vocabulary は、
Thing
Model definitions でのみ使用され、Thing Descriptions が
generated されるときに削除または置換されることが意図されている
(10.4
Thing Description Instances の導出 も参照)。
Thing Model は、 endpoint addresses などの instance specific Protocol Binding および security information を含まなくてもよい(MAY NOT)。 したがって、 Thing Model definitions は、 forms、base、securityDefinitions、 および security のような JSON members がない場合でも valid となる。 Thing Models は、これらの JSON members が (例: template として)使用されている場合でも valid であるが、 href のような nested mandatory members は省略される。
例 3 は、protocol および security information を一切含まない valid sample lamp Thing Model を示す。
Thing Model definitions の文脈では、 Thing modelling に使用できる specific features が導入される。
Thing Model
definitions が時間とともに変化する場合、これは version container に
反映されるべきである(SHOULD)。
string-based term model は、
[SEMVER] のような
versioning information を提供するために、version container 内で使用される。
次の snippet は Thing Model instance 内での model の使用を示す。
{
// ...
"@type": "tm:ThingModel",
"title": "Lamp Thing Model",
"description": "Lamp Thing Description Model",
"version" : {"model": "1.0.0"},
// ...
}
Thing Model の定義により、
term instance は version
container 内で省略されなければならない(MUST)。
Thing Models が更新され、新しい version を持つ場合、これは extension および import features を使用する他の Thing Models に影響する場合がある(Section 10.3.2 Extension and Import を参照)。場合によっては、version を識別するために、 new version を file name および/または対応する URL に反映することも有用である。
Thing
Model は、links definition で示される
tm:extends mechanism を使用して、既存の
Thing Model を
extend できる: Thing Model が
別の Thing Model を extend する場合、extended される
Thing Model を target とする
"rel":
"tm:extends" を持つ links entry を少なくとも 1 つ
使用しなければならない(MUST)。
Thing
Model は、extended
Thing
Model からすべての definitions を inherit する。
既存の TD information model
(5. TD Information
Model)からさらに JSON name-value pairs を提供すること、または context extension concept
(7. TD Context
Extensions)を使用することにより、
既存の definition をさらなる metadata で extend する機会がある。
Thing Model は、
title(s) や maximum などの既存 definitions を
overwrite することもできる。これには 2 つの limitations が存在する:
Thing
Model は、extended Thing Model の
properties、actions、および/または
events Map 内で定義される
JSON names を overwrite すべきではない(SHOULD NOT)。
Definitions は、可能な
instance values が origin extended definitions と比較して valid でなくなるような形で
overwritten されるべきではない(SHOULD NOT)。
これらのアサーションは、extended
Thing Model 全体の
semantics を保持する。たとえば、extended
Thing
Model からの "minimum":2 を
"minimum":0 で overwrite することは許可されない。
一方で、"minimum":5 で overwrite することは機能する。
すべての instance values が extended
Thing Model の restrictions を
常に満たすからである(さらなる説明については
Figure 図
8 も参照)。
次の例で提供されるような basic model description があると仮定する:
{
"@context": ["https://www.w3.org/ns/wot-next/td"],
"@type": "tm:ThingModel",
"title": "Basic On/Off Thing Model",
"properties": {
"onOff": {
"type": "boolean"
}
}
}
ここで、TD instances を作成するための template として使用される
'Smart Lamp Control' という新しい device class model が設計されている。
この model は、'Basic On/Off Thing Model' の既存 definition を reuse し、
dim property で extend する:
{
"@context": ["https://www.w3.org/ns/wot-next/td"],
"@type": "tm:ThingModel",
"title": "Smart Lamp Control with Dimming",
"links" : [{
"rel": "tm:extends",
"href": "http://example.com/BasicOnOffTM",
"type": "application/tm+json"
}],
"properties" : {
"dim" : {
"title": "Dimming level",
"type": "integer",
"minimum": 0,
"maximum": 100
}
}
}
title は overwritten され、TD instances が作成されるときに
使用されることに注意(次の subsection 10.4 Thing Description Instances の導出 も参照)。
tm:extends feature は、1 つの
Thing Model のすべての
definitions を inherit することのみを許可する。しかし、多くの
use cases では、1 つ以上の既存の
Thing Models の
definitions の一部のみを import することが望まれる。
1 つ以上の既存の
Thing
Models の definitions の一部を import するために、
reuse すべき既存の(sub-)definition の location を提供する
tm:ref term が導入される(SHOULD)。
tm:ref value は、
URI [RFC3986](Section
4.1)としての file location で始まり、# character が続き、
JSON Pointer [RFC6901]
definition が続く pattern に従わなければならない(MUST)。
URI は空でもよく、same-document reference
[RFC3986](Section
4.4)を示すことに注意。この場合、tm:ref は
relative reference として解釈されることが想定される。
tm:ref が使用されるたびに、
referenced pre-definition とその dependencies(例: context extension によるもの)は、
新しく定義された definition において仮定されなければならない(MUST)。
tm:ref value の一部には、使用前に URL
("percent") encoding を必要とする non-ASCII characters が含まれる可能性がある。
tm:ref value に escapes を適用する前に、
implementations は value がすでに encoded されていないことを確認すべきである。
次の例は、例
62 から property
onOff の既存 definition を新しい property definition
switch に import する、新しい TM definition を示す。
{
"@context": ["https://www.w3.org/ns/wot-next/td"],
"@type": "tm:ThingModel",
"title": "Smart Lamp Control",
"properties" : {
"switch" : {
"tm:ref": "http://example.com/BasicOnOffTM.tm.jsonld#/properties/onOff"
}
}
}
tm:ref を使用した relative imports の例として、
次の Thing Model は genericTemperature property を
2 つのより specific な properties で再利用および augment(下記参照)する。
それぞれ inner temperature value と outer temperature value を記述する。
{
"@context": "https://www.w3.org/ns/wot-next/td",
"@type": "tm:ThingModel",
"title": "Multi Sensor",
"properties": {
"genericTemperature": {
"type": "number",
"unit": "C"
},
"innerTemperature": {
"tm:ref": "#/properties/genericTemperature",
"title": "The inner temperature",
"minimum": 10
},
"outerTemperature": {
"tm:ref": "#/properties/genericTemperature",
"title": "The outer temperature",
"description": "The outer temperature is measured in Kelvin",
"unit": "K"
}
},
"tm:optional": [
"/properties/genericTemperature"
]
}
"tm:ref" が定義されている場所では、追加の name-value pairs を追加できる。
referenced definition からの name-value pairs を override することも許可される。
tm:ref から
既存の JSON name-value pair definition を override する意図がある場合、
新しい value を提供する tm:ref declaration と同じ level で、
同じ JSON name を使用しなければならない(MUST)。
overwrite する process は、
referenced definition の content が新しく提供された JSON
name-value pairs で patched される、[RFC7396] で定義される
JSON Merge Patch algorithm に従わなければならない
(MUST)。
values は JSON object または array に基づくこともでき、
単に null value であることもできることに注意。
null は target 内の既存の JSON name-value pair の削除を
もたらす。
tm:extends
と同様に、
semantic meaning を保つために、definitions は、可能な instance values が
origin referenced definition と比較して valid でなくなるような形で
overwritten されるべきではない(SHOULD NOT)。
次の例は、例
63 からの既存 definitions を
overwrite(maximum)、enhance
(unit)、および remove(title)する
新しい TM definition を示す。
{
"@context": ["https://www.w3.org/ns/wot-next/td"],
"@type": "tm:ThingModel",
"title": "Smart Lamp Control",
"properties" : {
"dimming" : {
"tm:ref": "http://example.com/SmartLampControlwithDimming.tm.jsonld#/properties/dim",
"title": null,
"maximum": 80,
"unit": "%"
}
}
}
JSON Merge Patch algorithm に基づき、
{"title": null,"maximum": 80,"unit": "%"} は
referenced origin content
{"title": "Dimming level", "type": "integer",
"minimum": 0, "maximum": 100} に対する patch として作用する。
tm:extends と tm:ref に基づく
import mechanism は、TM definition 内で同時に使用することもできる。
次の例は、例 62 の
TM を extend し、それぞれ 例
3 と 例
63 から
status および dim definitions を import する。
{
"@context": ["https://www.w3.org/ns/wot-next/td"],
"@type": "tm:ThingModel",
"title": "Smart Lamp Control",
"links" : [{
"rel": "extends",
"href": "http://example.com/BasicOnOffTM",
"type": "application/tm+json"
}],
"properties" : {
"status" : {
"tm:ref": "http://example.com/LampTM.tm.jsonld#/properties/status"
},
"dimming" : {
"tm:ref": "http://example.com/LampWithDimmingTM.tm.jsonld#/properties/dim"
}
}
}
tm:extends と tm:ref に基づく import mechanism は、
transitive extension(extensions の hierarchy)を明示的にサポートする。
たとえば、3 つの TMs があると仮定する:
TM "B" の tm:extends を定義する "A"、
そして "B" 自身が TM "C" の tm:extends を定義している。
したがって、"A" TM は "B" と "C" の両方のすべての definitions を extend する。
infinite loop に至る
recursive extensions は定義されてはならない(MUST NOT)。
次の図は、このセクションで提示された extension および imports TM functions の
許可される override behaviour を要約する。3 つの
Thing Models は、
Smart Lamp Control Thing Model の TM definitions を
reuse するために、tm:ref または tm:extends feature を使用する。
最初の Thing
Model は、dimmer property 内で
maximum value を 120 に import し overwrite する。
しかし、これは runtime での possible instance values が、Smart Lamp
Control Thing Model の dim definition の 0 から
100 の間の original dim definition の範囲に
入らない可能性をもたらす。したがって、そのような
Thing Model definition は
許可されない。2 番目の model は property
type value を number で overwrite する。
これも、Smart Lamp Control
Thing
Model の origin dim type definition(integer)によって
受け入れられない numeric dim values をもたらす可能性がある。
最後の model は正しい方法で定義されている。
dim の新しい ranges は、original
dim definition によっても満たされる potential instance
values を生成する。
一部の applications では、既存の
Thing
Model definitions を reuse し、それらを新しい IoT system に compose することが
有益である。例として、新しい Smart Ventilator が、
on/off および adjustRpm
capabilities を提供する Ventilation
Thing Model と、
dimmable および RGB
capabilities を提供する LED Thing Model という
2 つの sub/child Thing Model definitions から
構成されるように設計される場合がある。
このような composition は、links container の使用によって
導入できる。Thing Model が
1 つ以上の(sub-)Thing Models から構成されるという
information を提供することが望まれる場合、
links entries は、(sub-)Thing
Models を target とする "rel": "tm:submodel" を
使用しなければならない(MUST)。
任意で、
composed(sub-)Thing
Model に個別の name を関連付けるために、
instanceName を提供してもよい(MAY)。
これは、複数の類似した
Thing
Model definitions が composed され、区別する必要がある場合に有用である。
composed Thing Model definitions から
Thing Descriptions を
generate するために、異なる strategies に従うことができる。
default recommendation は、各 parent および sub/child
Thing Model から、
対応する Thing Descriptions を
generate することである
(10.4
Thing Description Instances の導出 も参照)。
composition relation は、Thing Descriptions の
links container 内の collection および
item relation types によって反映できる。
Smart Ventilation に基づく例をここに示す:
top level/parent Thing Model の interaction definitions と、すべての sub/child Thing Models の すべての interaction definitions を含む単一の TD も generate できる。 その際、generation process は possible name collisions を避けなければならない(MUST)。 次の例は、Smart Ventilator Thing Model の potential generated(self-contained) Thing Description を示す。
{
"@context": "https://www.w3.org/ns/wot-next/td",
"title": "Smart Ventilator",
"securityDefinitions": {
"basic_sc": {
"scheme": "basic",
"in": "header"
}
},
"security": "basic_sc",
"links": [
{
"rel": "type",
"href": "./SmartVentilator.tm.jsonld",
"type": "application/tm+json"
}
],
"properties": {
"status": {
"type": "string",
"enum": [
"on_value",
"off_value",
"error_value"
],
"forms": [
{
"href": "http://127.0.13.232:4563/status"
}
]
},
"switch": {
"type": "boolean",
"description": "True=On; False=Off",
"forms": [
{
"href": "http://127.0.13.212:4563/switch"
}
]
},
"adjustRpm": {
"type": "number",
"minimum": 200,
"maximum": 1200,
"forms": [
{
"href": "http://127.0.13.212:4563/adjustRpm"
}
]
},
"R": {
"type": "number",
"description": "Red color",
"forms": [
{
"href": "http://127.0.13.211:4563/R"
}
]
},
"G": {
"type": "number",
"description": "Green color",
"forms": [
{
"href": "http://127.0.13.211:4563/G"
}
]
},
"B": {
"type": "number",
"description": "Blue color",
"forms": [
{
"href": "http://127.0.13.211:4563/B"
}
]
}
},
"actions": {
"fadeIn": {
"title": "fadeIn",
"input": {
"type": "number",
"description": "fadeIn in ms"
},
"forms": [
{
"href": "http://127.0.13.211:4563/fadeIn"
}
]
},
"fadeOut": {
"title": "fadeOut",
"input": {
"type": "number",
"description": "fadeOut in ms"
},
"forms": [
{
"href": "http://127.0.13.211:4563/fadeOut"
}
]
}
}
}
場合によっては、どの interaction affordances が mandatory であり、
Thing Description
instance で必ず実装される必要があるかを強制しないことが望ましい。
interaction models が
Thing Description
instance で実装されることが mandatory ではない場合、
Thing
Model definitions は JSON member name
tm:optional を使用しなければならない
(MUST)。
tm:optional は top
level の JSON array でなければならない(MUST)。
tm:optional の値は、
required interaction model definitions への JSON Pointer
[RFC6901]
references を提供しなければならない(MUST)。
tm:optional の
JSON Pointers は、entire interaction affordance Map definition に
resolve しなければならない(MUST)。
次の sample は、Event interaction
overheating に対する tm:optional の使用を示す。
{
"@context": ["https://www.w3.org/ns/wot-next/td"],
"@type": "tm:ThingModel",
"title": "Lamp Thing Model",
"description": "Lamp Thing Model Description",
"tm:optional": [
"/events/overheating"
],
"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"}
}
}
}
Event
overheating は mandatory ではないため、
Thing Description
instance で利用可能でない場合がある。
Thing Model definition 内の
optional definition は、tm:ref の使用を通じて別の
Thing
Model によって extended される場合に overwritten できることに注意:
{
"@context": ["https://www.w3.org/ns/wot-next/td"],
"@type": "tm:ThingModel",
"title": "Lamp Thing Model (All Mandatory)",
"description": "Lamp Thing Model description expects all interaction affordances (status, toggle, and overheating)",
"links": [
{
"rel": "tm:extends",
"href": "./lampThingModel.tm.jsonld",
"type": "application/tm+json"
}
],
"events": {
"overheating": {
"tm:ref": "./lampThingModel.tm.jsonld#/events/overheating"
}
}
}
Thing
Model は、TD instance でどの terms を使用すべきかを指定できるが、
それらの values は不特定であり、TD instantiation 時に初めて知られる。
TD instance terms は事前に
分かっているが、その values は分かっていない場合、placeholder labeling を
Thing Model で使用してもよい(MAY)。
Thing Model から TD
instance が作成されるとき、placeholder labeling は concrete value
(例: JSON number、JSON string、JSON object などとして)で置換されなければならない
(MUST)。
placeholder の string-based pattern は、
regular expression {{2}[
-~]+}{2} に基づく valid
pattern に従わなければならない(MUST)
(例:
{{PLACEHOLDER_IDENTIFIER}})。
{{ と }} の間の characters は、
placeholder の identifier name として使用される。
identifier name は substitution process のために placeholder を識別するために使用できる。
placeholder は JSON
name-value pair の value 内に適用されなければならない(MUST)。
JSON name-value pair の non
string-based value が placeholder を持つ場合、その value は
(一時的に)string として typed されなければならない
(MUST)。 placeholder の置換後、
たとえば Thing Description instance を作成するときに、
corresponding replaced value とともに original type が適用される。
次の Thing Model example は、異なる placeholders を定義する。 placeholder map は replacement を適用し、intended value type に変換するために使用される。
Thing Models は、Sections 5. TD Information Model および 6. TD Representation Format で定義された restrictions に基づいて Thing Description を generate するための templates として使用できる。 この process 中、valid Thing Description instances を作成するために、communication および security metadata などの missing data を補完しなければならない。 Thing Model は、 Section 5. TD Information Model および 6. TD Representation Format で記述される requirements を満たすことのできない Thing Description をもたらす inconsistencies が存在しないように 定義されなければならない(MUST)。 Thing Model から Thing Description instance を derive する TM-to-TD generator は、 次の steps を使用してそれを Partial TD に transform する:
"rel":"tm:extends" を持つ
links element entry は現在の
Partial TD から削除されなければならない
(MUST)。@type の tm:ThingModel value は、
Partial
TD instance 内で削除されなければならない(MUST)。tm:optional に listed されていないもの)は、
Partial TD
instance に取り込まれなければならない(MUST)。tm:optional に listed されているもの)は、
Partial TD
instance に取り込んでもよい(MAY)。最後に、TM-to-TD generator は resulting Partial TD を取得し、 この最後の step によって、それを Thing Description に transform する
securityDefinitions and
security および/または 6.3.9 forms に基づいて
Thing Description
instance 内で completed されなければならない(MUST)。Thing
Model の id value は、
TD generation process のために
"id":
"urn:example:{{RANDOM_ID_PATTERN}}"
のような placeholder を提供することが推奨される。
id pattern に metadata を含めることは避けること。
Thing Description
instances は、どの type の Thing Model が derived されたかに関する
information を運ぶことができる。この文脈では、
linking concept は、次の example に示すように
"rel": "type" とともに使用できる
(Section 5.3.4.1
Link も参照):
TD は一度に 1 つの TM の instance にのみなれることに注意。
これは Thing Descriptions について次を意味する:
links array は、
"rel": "type" を持つ entry を最大 1 回だけ使用しなければならない
(MUST)。
Thing Description 内で他の Things とのすべての relationships を反映することが望まれる場合、
TMs の composition mechanism を検討できる
(Section 10.3.3
Composition を参照)。
次の Thing Model は、
例
63 に示される model を extend し、
dim property の maximum value を overwrite する
{
"@context": ["https://www.w3.org/ns/wot-next/td"],
"@type": "tm:ThingModel",
"links" : [{
"rel": "tm:extends",
"href": "http://example.com/SmartControlLampTM",
"type": "application/tm+json"
}],
"properties" : {
"dim" : {
"maximum": 200
}
}
}
この Thing Model から derived される expected Thing Description は (HTTP Binding と basic security が適用された状態で)次のようになる:
{
"@context": ["https://www.w3.org/ns/wot-next/td"],
"@type": "Thing",
"title": "Smart Lamp Control",
"securityDefinitions": {
"basic_sc": {"scheme": "basic", "in": "header"}
},
"security": "basic_sc",
"links" : [{
"rel": "type",
"href": "url/to/SmartLampControlModifiedDimTM",
"type": "application/tm+json"
}
],
"properties" : {
"onOff": {
"type": "boolean",
"forms": [{"href": "https://smartlamp.example.com/onoff"}]
},
"dim" : {
"type": "integer",
"minimum": 0,
"maximum": 200,
"forms": [{"href": "https://smartlamp.example.com/dim"}]
}
}
}
一般に、WoT system を保護するために取られる security measures は、その system が直面し得る threats および attackers、ならびに保護する必要がある assets の価値に依存する。 Web of Things に関する security(および privacy)considerations の詳細な議論は、 さまざまな状況に適応できる threat model を含め、informative document [WOT-SECURITY-GUIDELINES] に示されている。 多くの WoT Things は web services と類似しており、同じ technologies を使用する。 以下の specific security considerations に加えて、web services 向けの OWASP Top 10 [OWASP-Top-10] などの guides で 議論されている security risks および mitigations を評価し、該当する場合は対処すべきである。 このセクションでは、WoT Thing Description に直接関連する security risks と possible mitigations のみを議論する。
WoT Thing Description は、secure な network interfaces と insecure な network interfaces の両方を記述できる。Thing Description が 既存の network interface に retro-fitted される場合、その network interface の security status に変更があることは期待されない。
WoT Thing Description の使用は、以下のセクションで示す security risks を導入する。各 risk の後に、いくつかの possible mitigations を示す。
TDs を傍受し改ざんすることは、たとえば TDs 内の URLs を書き換えて、 data を捕捉または操作できる悪意ある intermediary に accesses を redirect することにより、 man-in-the-middle attacks を開始するために使用できる。
context definition files を傍受し改ざんすることは、 vocabulary の interpretation を変更することによって attacks を容易にするために使用できる。 HTTP などの non-secure connections を介して Web から読み込まれる Context extensions(7. TD Context Extensions を参照)は、attacker によって変更される risk があり、security を損なう可能性のある方法で TD Information Model を変更する場合がある。
12.1 Context Fetching で推奨されるように、 constrained implementations では、context definition files は pre-installed され、 secure software update process を使用して管理されるべきであり、context URLs は既知の contexts を識別するためにのみ使用され、それらを fetch するためには使用されない。 したがって、この consideration は、context definition files を動的に fetching することが それ以外では避けられない場合、たとえば general semantic processing をサポートする directory service においてのみ適用される。
一部の scenarios では、ある users による Things の集合への access の scope および duration を制限することが望ましい場合がある。たとえば、A が B の家を訪問している場合、 B は A が使用できるように garage door opener および car charger への temporary and limited access を A に提供したい場合がある。ただし、scope は、A がこれらの Things の 特定の administrative functions に access できないように制限される場合がある (たとえば、garage door を開いたままにできる時間を変更すること、または charging rate を 変更すること)。さらに、access は A が去ったと予想される後、たとえば 1 週間後に expire すべきである。
WoT Discovery によって返されるものなど、TDs の集合に access できる attacker は、 この information を使用して vulnerable devices を識別し、それらへの attacks を計画できる場合がある。
auto security scheme を使用してもよい
(MAY)。
TDs で与えられる多くの strings、特に title/titles および
description/descriptions に含まれる values は、
human-readable であることを意図している。application はそのような strings を取り、
たとえば利用可能な Things の集合をその titles および descriptions とともに一覧表示する
web dashboard など、user interface を generate するために使用する場合がある。
そのような interface が string substitution を使用して naively に生成される場合、
たとえばこれらの strings の values を HTML template 内の marked places に挿入して
final HTML を作成すると、original string 内の HTML markup は dashboard を表示する
browser の context で interpreted される。attacker がさまざまな方法で HTML に scripts を
embed し、user interaction 時または automatic に(例: page load 時、または error 時。これは
意図的に行うことができる)これらの scripts を executed させることが可能である。
string は TD producer によって生成され、
dashboard は別の origin によって生成されるため、これは cross-site-scripting (XSS) attack の
一形態である。
RFC 8259,
section 12 を参照: JSON は
eval() を使用して JavaScript として parsed されるべきではない。
WoT Thing Description は、executable content を保持するためではなく、
Thing
metadata のための pure data exchange format であることを
意図している。ただし、(invalid な)TD は JavaScript code を含む場合があり、
それが executed されると、system の security を損なう side effects を持つ可能性がある。
eval() function などの
code execution mechanism に渡されてはならない
(MUST NOT)。[WOT-DISCOVERY] では、
additional code injection risks が議論されている。
TDs 内の他の strings、たとえば title および
description に与えられる values は、SQL、HTML、または
other executable contexts の templates で使用される前に sanitized されるべきである。
ただし、この risk は specifically、JSON を parsing する際の Javascript injection risk に
関するものである。
JSON-LD processing には通常、short terms をより長い IRIs [RFC3987] に置き換えることが含まれる。このため、WoT Thing Descriptions は JSON-LD 1.1 processor を使用して processing されるとかなり expand する場合があり、最悪の場合、resulting data が recipient の resources をすべて consume したり、exploitable buffer overflow を引き起こしたりする可能性がある。
Privacy risks は、Things と identifiable people との association、およびそのような association から 利用可能な direct information と inferred information の両方に依存する。 Web of Things に関する privacy(および security)considerations の詳細な議論は、 さまざまな circumstances に適応できる threat model を含め、informative document [WOT-SECURITY-GUIDELINES] に示されている。このセクションでは、WoT Thing Description に直接関連する privacy risks と possible mitigations のみを議論する。
WoT Thing Description の使用は、以下のセクションで示す privacy risks を導入する。各 risk の後に、いくつかの possible mitigations を示す。
WoT Thing Descriptions は JSON-LD 1.1 processor [json-ld11] によって評価できる。 これは通常、remote contexts(すなわち TD context extensions、 7. TD Context Extensions を参照)への links を automatically に辿り、 各 file について Consumer の explicit request なしに files の transfer を result する。remote contexts が third parties によって served される場合、 それらが usage patterns または similar information を収集することを可能にし、 private information の disclosure、または private information を infer するために使用できる information につながる場合がある。WoT の場合、attacker はそのような fetches によって 生じる network traffic も observe でき、fetch の metadata、たとえば destination IP address を 使用して、特に domain-specific vocabularies が使用されている場合に device に関する information を infer できる。これは connection が encrypted されている場合でも risk であり、 DNS privacy leaks に関連する。関連する security risk であり、以下の mitigations によって 回避することもできる 11.2 Context Interception and Tampering も参照。
identifier(id)を含む Thing Description は、
identifiable person に関連付けられた Thing を記述する場合がある。
そのような identifiers は tracking を含むさまざまな risks をもたらす。
ただし、その identifier も immutable である場合、device が売却されたり別の person に譲渡されたりし、
known ID がその person を track するために使用される可能性があるため、tracking risk は増幅される。
TD で使用されるすべての
identifiers は mutable であるべきであり、特に必要に応じて
Thing の id を
update する mechanism があるべきである
(SHOULD)。
Specifically、Thing の id は
hardware に固定されるべきではない。しかしこれは、identifiers が fixed URIs であるという
Linked Data ideal と conflict する。ただし、policy として、deployments は
configuration または reinitialization の major changes の際に identifiers を update することが
強く推奨される。configuration の major changes の examples には、Thing を新しい
local area network に移動すること、新しい domain name を割り当てること、または Thing を
ある hub から unregister して新しい hub に register することが含まれる。一般に、
ownership の potential change を示す configuration changes は、新しい identifier が作成される
結果となるべきである。device の operational phase 中により頻繁な changes が望まれる場合、
identifier の change が行われたときに authorized users のみに change を notify する
mechanism を導入できる。ただし、medical devices など一部の classes of devices では、
一部の jurisdictions において law により immutable IDs が required される場合があることに注意。
理想的には、required immutable identifiers は、appropriate authentication and
authorization の後にのみ value を取得できる property などの affordances を通じてのみ
利用可能にされ、TD identifier とは別に managed されるべきである。immutable identifier を
TD identifier として使用する必要がある場合、そのような immutable identifiers を含む
Thing Descriptions などの files への secure access に特別な注意を払うべきである。
上で述べたように、TD 内の id member は privacy risk をもたらす可能性がある。
しかし、id がその tracking risk を軽減するために記述されたように
updated されたとしても、fingerprinting を通じて、TD を特定の physical device と関連付け、
そこから identifiable person と関連付けることがなお可能な場合がある。
specific device instance が fingerprinting によって識別できない場合でも、 interactions の集合など TD 内の information から device の type を infer し、 この type を使用して identifiable person に関する private information、たとえば medical condition を infer できる場合がある。
id を omit できる。Consumer がその use case に対して特定の interactions を
必要としない場合、それらを omit できる。Consumer が特定の interactions を使用する権限を
持たない場合も、同様に omit できる。
TD の id field の value は、full TD への access を持たない entities に
利用可能になる場合がある。id の value が device の type または owner などの
embedded metadata を含む場合、これは personal information を infer するために使用される可能性がある。
id の value は、
Thing を記述する metadata または TD 自体からの metadata を含むべきではない
(SHOULD NOT)。 TDs を
管理するために生成される any temporary ID、たとえば database または
directory service のための ID は、Thing を記述する metadata または TD 自体からの
metadata を含むべきではない(SHOULD NOT)。
12.5
Globally
Unique Identifiers で推奨される random UUIDs の使用もこの risk を軽減する。
Globally unique identifiers は、それらを作成し distribution するために centralized authority が必要な場合、third party が identifiers を知ることになるため、privacy risk をもたらす。
id field は意図的に globally unique であることを required されていない。
central registry を必要とせず、distributed fashion で suitable IDs を generate するために利用可能な
cryptographic mechanisms(例: random UUIDs)がいくつか存在する。これらの mechanisms は通常、
duplicate identifiers を生成する確率が非常に低く、これは system design において考慮に入れる必要がある。
たとえば、duplicates を detecting し、必要に応じて IDs を regenerating することによってである。
IDs の scope も global である必要はない。home または factory 内など、特定の context 内でのみ
Things を distinguish する identifiers を使用することは許容される。TD
identifiers は、UUIDs など、高い uniqueness probability を提供する distributed
mechanism を使用して generated されるべきである(SHOULD)。
TD
identifiers は centralized authority を使用して generated されるべきではない
(SHOULD NOT)。
多くの locales では、users の privacy を保護するために、personally identifiable information、すなわち particular person と関連付けることができる information の handling に関する legal requirements が存在する。そのような information はもちろん IoT devices によって直接 generated され得る。しかし、IoT devices の existence および metadata (Thing Description に格納される種類の data)も、personally identifiable information を含む、 またはそれを infer するために使用される可能性がある。この information は、特定の person が特定の type of device を所有しているという fact のように単純なものであり得、それがその person に関する additional inferences につながる可能性がある。
conforming content と non-conforming content の両方を processing するための rules は、 この仕様で定義される。
current IANA registration を参照すること。将来的には .td.json および .td.jsonld も許可される可能性がある。
conforming content と non-conforming content の両方を processing するための rules は、 この仕様で定義される。
IANA は、 CoAP Content-Formats subregistry 内で、media types に compact CoAP Content-Format IDs を assign する。この subregistry は Constrained RESTful Environments (CoRE) Parameters registry [RFC7252] 内にある。 WoT Thing Description の Content-Format ID は 432 であり、 WoT Thing Model のものは - (tbd) である。
このセクションは非規範的である。
以下の TD example は、HTTP、CoAP、および MQTT Protocol
Bindings を使用する。これらの TDs は Context Extensions を持ち、
[HTTP-in-RDF10] と同様の
CoAP-in-RDF および MQTT-in-RDF vocabularies が存在し、それぞれ
http://www.example.org/coap-binding# および
http://www.example.org/mqtt-binding# の namespaces から
access 可能であることを仮定している。
"https://www.w3.org/2022/wot/td/v1.1" にある TD context にはすでに
[HTTP-in-RDF10] が含まれているため、
HTTP context extensions は直接使用できることに注意。
各 Binding Specification
には、最新の vocabulary terms と examples が含まれていることに注意。
以下に示す context extensions は、TD Consumer に対して次の instructions を持つ:
"htv:methodName" member は、
どの HTTP method を適用する必要があるかを Consumer に指示する
(例: resource を取得するための "GET"、
または resource に data を送信するための
"POST")。
"cov:method" member は、どの CoAP method を
適用する必要があるかを Consumer に指示する
(例: CoAP Method Code 0.01 の "GET"、
CoAP Method Code 0.02 の "POST"、または CoAP Method
Code 0.07 の iPATCH)。"mqv:controlPacket" member は、
どの MQTT command を適用する必要があるかを Consumer に指示する
(例: topic を subscribe するための
"subscribe" および
unsubscribe するための "unsubscribe")。
まず、single protocol を持つ TDs を示す。次に、各 interaction affordance が 1 つの protocol を持つ 1 つの form を持つ、 multiple protocols を持つ TDs を紹介する。
Thing の feature list:
Thing の feature list:
192.168.1.187:1883 の背後で動作している MQTT broker により、
topic /illuminance に illuminance data
(number は text format で serialized される)を頻繁に publish する。
MQTT Binding も参照。
Thing の feature list:
temperature を提供し、Webhook
mechanism を使用して latest temperature value を
periodically に Consumer に push する。
この mechanism では、Thing は
Consumer が提供した callback URI に POST requests を送信する。
これを記述するために、subscription member は write-only
parameter callbackURL を定義し、これは
subscribeevent form を通じて submit されなければならない。
read-only parameter subscriptionID は
subscription によって返される。
TemperatureSensor はその後、この callback URI に対して
data によって定義される payload を付けて periodically POST する。
unsubscribe するには、Consumer は
cancellation に記述されるように、
subscriptionID を伴う unsubscribeevent form を submit する必要がある。
代替として、delete method で呼び出す必要がある URIs に
subscriptionID string を含めるよう
Consumer に通知する
uriVariables approach(tab 'With
uriVariables' を参照)を使用できる。そのような setup では、
cancellation container は省略できる。
一般に、この example は、
proper semantic
annotations を含めるために
TD
Context Extension を使用することで、さらに automated にできる。
Thing への periodic POST request の代わりに、
Consumer は、次の POST request がいつ
Thing によって提供されるべきかについての information を含む response
data を提供してもよい。これは
dataResponse field を使用して記述される。
Thing の feature list:
{
"@context": [
"https://www.w3.org/ns/wot-next/td",
{
"cov": "http://www.example.org/coap-binding#",
"mqv": "http://www.example.org/mqtt-binding#",
"htv": "http://www.w3.org/2011/http#"
}
],
"title": "LampThing",
"id": "urn:dev:ops:32473-WoTLamp-1234",
"securityDefinitions": {
"nosec_sc": {
"scheme": "nosec"
}
},
"security": ["nosec_sc"],
"properties": {
"switchState": {
"type": "boolean",
"readOnly": true,
"observable": false,
"forms": [
{
"href": "http://example.com/light/switchstate",
"op": "readproperty",
"contentType": "application/json",
"htv:methodName":"GET"
}
]
},
"brightness": {
"type": "number",
"readOnly": true,
"observable": false,
"forms": [
{
"href": "coap://example.com/light/brightness",
"op": "readproperty",
"contentType": "application/json",
"cov:method": "GET"
}
]
}
},
"actions": {
"switchLight": {
"input": {
"type": "boolean"
},
"forms": [
{
"href": "http://example.com/switch/state",
"op": "invokeaction",
"contentType": "application/json",
"htv:methodName":"POST"
}
]
},
"setBrightness": {
"input": {
"type": "number",
"maximum":255
},
"forms": [
{
"href": "coap://example.com/light/brightness",
"op": "invokeaction",
"contentType": "application/json",
"cov:method": "POST"
}
]
}
},
"events":{
"concentration": {
"title": "Gas Concentration Event Stream",
"data":{
"type": "integer",
"minimum": -1,
"maximum": 65535
},
"forms": [
{
"href": "mqtt://broker.com",
"contentType": "application/json",
"op": "subscribeevent",
"mqv:filter": "application/deviceid/sensor/concentration",
"mqv:controlPacket": "subscribe"
}
]
}
}
}
Thing の feature list:
brightness property は HTTP
および CoAP 経由で read でき、MQTT 経由で observed できる。
concentration event は CoAP および MQTT 経由で subscribe できる。
この場合、Consumer は、たとえば CoAP protocol stack を持っているかどうかなど、
internal implementation に基づいて、support できる form を選択する。
HTTP Binding、
CoAP Binding、および
MQTT Binding も参照。
{
"@context": [
"https://www.w3.org/ns/wot-next/td",
{
"cov": "http://www.example.org/coap-binding#",
"mqv": "http://www.example.org/mqtt-binding#",
"htv": "http://www.w3.org/2011/http#"
}
],
"title": "Lamp",
"id": "urn:dev:ops:32473-WoTLamp-5678",
"securityDefinitions": {
"nosec_sc": {
"scheme": "nosec"
}
},
"security": ["nosec_sc"],
"properties": {
"switchState": {
"type": "boolean",
"readOnly": true,
"observable": false,
"forms": [
{
"href": "http://example.com/light/switchstate",
"op": "readproperty",
"contentType": "application/json",
"htv:methodName":"GET"
},
{
"href": "coap://example.com/light/switchstate",
"op": "readproperty",
"contentType": "application/json",
"cov:method": "GET"
}
]
},
"brightness": {
"type": "number",
"readOnly": true,
"observable": true,
"forms": [
{
"href": "http://example.com/light/switchstate",
"op": "readproperty",
"contentType": "application/json",
"htv:methodName":"GET"
},
{
"href": "coap://example.com/light/switchstate",
"op": "readproperty",
"contentType": "application/json",
"cov:method": "GET"
},
{
"href": "mqtt://broker.com",
"mqv:filter": "application/deviceid/sensor/brightness",
"op": "observeproperty",
"mqv:controlPacket": "subscribe"
}
]
}
},
"actions": {
"switchLight": {
"input": {
"type": "boolean"
},
"forms": [
{
"href": "http://example.com/switch/state",
"op": "invokeaction",
"contentType": "application/json",
"htv:methodName":"POST"
}
]
},
"setBrightness": {
"input": {
"type": "number",
"maximum":255
},
"forms": [
{
"href": "coap://example.com/light/brightness",
"op": "invokeaction",
"contentType": "application/json",
"cov:method": "POST"
}
]
}
},
"events":{
"concentration": {
"title": "Gas Concentration Event Stream",
"data":{
"type": "integer",
"minimum": -1,
"maximum": 65535
},
"forms": [
{
"href": "mqtt://broker.com",
"contentType": "application/json",
"op": "subscribeevent",
"mqv:filter": "application/deviceid/sensor/concentration",
"mqv:controlPacket": "subscribe"
},
{
"cov:method": "GET",
"href": "coap://example.com/sensor/gasconcentration",
"contentType": "application/json",
"op": "subscribeevent",
"subprotocol": "cov:observe"
}
]
}
}
}
このセクションは非規範的である。
JSON based format で serialized された Thing Description instances を構文的に validating するための JSON Schema [JSON-SCHEMA] document は、 https://www.w3.org/ns/wot-next/td-schema で利用可能である。 この JSON Schema は、Default Values を持つ terms が present であることを要求しない。したがって、Default Values を持つ terms は optional である。 (5.4 Default Value Definitions も参照)
この document で定義される Thing Description は、
JSON-LD [json-ld11]
で知られる @context mechanism を使用して external vocabularies を追加することを
許可し、それらの external vocabularies の terms は、
5. TD Information
Model で定義される terms に
加えて使用できる。この理由により、以下の JSON schema はこの点に関して意図的に non-strict である。
external vocabularies が使用されない場合に stricter validation を実行するために、
異なる scopes/levels で additionalProperties schema property の value
true を false に置き換えることができる。
このセクションは非規範的である。
request および response の variation に関するさまざまな cases は、
5.3.4.2.2
Response-related
Terms Usage で説明されている。以下の tables は、これらの cases を
concise な形で要約する。tables は、single contentType などの
simpler cases から始まり、multiple contentTypes などの
more complex cases へ進む。すべての tables において、
messages は Thing の視点から見られ、input は Consumer から Thing へ送信される messages
(例: request)を意味し、output は Thing から Consumer へ送信される messages
(例: response)を意味する。
cases には番号が付けられており、tables の後の examples と関連付けるために使用できる。
| Case | 必要な Terms | 説明 | Consumer Behavior | Thing Behavior |
|---|---|---|---|---|
| Case 1A: Input present、output not present | form 内の contentType |
contentType は
input のみを指す |
|
|
| Case 1B: Input not present、output present。 | form 内の contentType。 |
contentType は
output のみを指す。 |
|
|
Case 1C: Input と output present、messages に対して同じ
contentType。
|
form 内の contentType。 |
contentType は input と
output の両方を指す。 |
|
|
次の table は、operation input が異なる
contentTypes を受け入れられる場合、または output が異なる
contentTypes を返せる場合に relevant なさらなる variations を考慮する。
Interaction Affordance が multiple forms を持つ cases があり得る。
multiple forms を伴うそのような cases は、上および下の table の cases の
combination として扱われるべきである。
| Case | 必要な Terms | 説明 | Consumer Behavior | Thing Behavior |
|---|---|---|---|---|
Case 2A: Single input と single output present、
messages に対して異なる contentType。 |
form 内の contentType および response。
response は異なる value の
contentType を持つ。
|
form level の contentType は
input を指し、response(response-level)内の
contentType は output を指す
|
|
|
Case 2B: Input と multiple possible outputs present、
messages に対して同じ contentType |
form 内の contentType および
additionalResponses。
additionalResponses array items 内の
schema が必要になる場合がある。
|
form level の contentType は
input と normal output を指す。
default value rule が適用されるため、
additionalResponses は
contentType を必要としない。
これは実際には single contentType であるため、
同じ case(Case 1C)である。ただし、output で deliver される異なる
Data Schemas が存在し得るため、form に
additionalResponses および schema terms が必要になる。
|
Case 1C を参照 | Case 1C を参照 |
Case 2C: Input と multiple possible outputs present、
output messages に対して異なる contentType |
form 内の contentType、
additionalResponses、および場合によっては
response。
additionalResponses は、
different contentTypes を持つ output messages のために
contentType を必要とする。
|
これは、TD で記述する different ways を持ち得る
most complicated case である。
form level の contentType は、
output が同じ contentType である場合(case 1C のように)、
input および expected output を指す。
response 内の contentType は、
output が異なる contentType である場合(case 2A のように)
expected output を指す。
additionalResponses 内の
contentType は他の possible outputs を指す。
|
|
|
このセクションは非規範的である。
本仕様は、異なる Vocabularies、すなわち
Vocabulary
Terms の集合に対する constraints の集合として、
TD
Information Model を導入する。
このセクションでは、TD document の mandatory @context を利用することによって、
これらの constraints の machine-readable definition を client applications に統合する方法を
簡潔に説明する。
TD document から TD Information Model に access することは 2 つの steps で行われる。 まず、clients は JSON strings から IRIs への mapping を retrieve しなければならない。 この mapping は、後で説明するように JSON-LD context として定義される。 次に、clients はそれらを dereferencing することで、これらの IRIs に定義された constraints に access できる。Constraints は RDF format の logical axioms として定義され、client programs によって readily interpretable である。
5.
TD Information
Model で参照されるすべての Vocabulary
Terms は、TD document 内で(compact な)JSON strings として serialized される。
しかし、これらの terms はそれぞれ、first Linked Data principle
[LINKED-DATA] に従って、
full IRI によって unambiguously identified される。
JSON keys から IRIs への mappings が、TD の @context value が指すものである。
たとえば、次の場所の file は
https://www.w3.org/ns/wot-next/td
以下の mappings(ほかにもある)を含む:
properties |
→ |
https://www.w3.org/2019/wot/td#hasPropertyAffordance
|
object |
→ |
https://www.w3.org/2019/wot/json-schema#ObjectSchema
|
basic |
→ |
https://www.w3.org/2019/wot/security#BasicSecurityScheme
|
href |
→ |
https://www.w3.org/2019/wot/hypermedia#hasTarget
|
| ... | ||
この JSON file は JSON-LD 1.1 syntax
[JSON-LD11] に従う。
多数の JSON-LD libraries は、TD の @context を automatically に process し、
それに含まれるすべての JSON strings を expand できる。
TD のすべての Vocabulary Term が IRI に expand されると、second step は、 その Vocabulary Term を参照する TD Information Model の fragments を取得するために、 この IRI を dereference することで構成される。たとえば、IRI を dereferencing すると
https://www.w3.org/2019/wot/json-schema#ObjectSchema
term ObjectSchema が Class であり、より正確には
DataSchema の sub-class であることを述べる RDF document が得られる。
このような logical axioms は、さまざまな complexity の formalisms を使用して RDF で表現される。
ここでは、sub-class relations は RDF Schema axioms
[RDF-SCHEMA] として表現される。さらに、これらの axioms は
various formats で serialized され得る。ここでは、Turtle format
[TURTLE] で serialized されている:
<https://www.w3.org/2019/wot/json-schema#ObjectSchema>
a rdfs:Class .
<https://www.w3.org/2019/wot/json-schema#ObjectSchema>
rdfs:subClassOf <https://www.w3.org/2019/wot/json-schema#DataSchema> .
default では、user agent が content negotiation を実行しない場合、
RDF document ではなく human-readable HTML documentation が返される。
content を negotiate するために、clients は request に HTTP header
Accept: text/turtle を含めなければならない。
このセクションは非規範的である。
8.1.2.2
Data Schemas の extension として、
このセクションは different payloads とそれらに対応する
DataSchema の examples を収集する。これらは
well-known IoT Platforms and Standards からのものであり、payload がどのような見た目になり得るか、
そして Data Schema でそれをどのように記述できるかの various ways を示すことを目的とする。
SenML [RFC8428] は 次の construct を使用する場合がある:
|
例
82:
SenML Payload Example
|
例
83: SenML Payload Example の
Data Schema
|
OCF[OCF] に従う Batch Collection は、 次のように structured される場合がある:
|
例
84: OCF
Batch Example
|
例 85: OCF Batch
Payload
Example の Data Schema
|
また、LWM2M [LWM2M] 上の IPSO Smart Object は、 次のように見える場合がある:
|
例
86:
IPSO/LWM2M Payload Example
|
例 87: IPSO/LWM2M
Payload Example の Data Schema
|
contentType を defaults なしの optional にした。editors は、contributions、guidance、および expertise を提供してくれた Cristiano Aguzzi、 Thomas Jäckle、Jan Romann、Elodie Thiéblin、Michael Koster、 Michael Lagally、Kazuyuki Ashimura、Daniel Peintner、Toru Kawaguchi、María Poveda、Dave Raggett、Kunihiko Toumura、 Takeshi Yamada、Ben Francis、Manu Sporny、Klaus Hartke、Addison Phillips、Jose M. Cantera、Tomoaki Mizushima、Soumya Kanti Datta、および Benjamin Klotz に特別な謝意を表したい。
また、W3C staff および W3C Web of Things Interest Group (WoT IG) and Working Group (WoT WG) の現在および過去のすべての active Participants に、 この document の改善につながった support、technical input、および suggestions について深く感謝する。
最後に、WoT IG を inception から 2 年間 lead し、Thing Description を含む WoT building blocks の concept をまとめるよう group を導いた Joerg Heuer に特別な謝意を表する。
non-listed references に関する Temporary ReSpec fix: [RFC6068], [RFC3966], [html], [RFC6750], [RFC7519], [RFC7797], [RFC8392], [RFC7516], [LDML], [SEMVER], [RFC7617], [RFC7616]
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in: