Author: Jaime Jiménez
@due(27-03-17 15:28)
Consider other Work Section(19-07-2016)
Figures 4 , 5 and 6 should say the format they are in: Link-Format example from RFC6690
, Derived JSON format example from Figure 4
and Derived CBOR diagnostic format example from Figure 4
or similar for readability.
When converting between a bespoke syntax such as that defined by CoRE Link Format [RFC6690]
Representing CoRE Formats in JSON and CBOR
The draft defines a format for representing and translating Web links RFC5988 from CoRE link format RFC6690 to JSON (generic in use) and CBOR (used in the constrained space over CoAP)
Both formats are defined on their respective RFCs: JavaScript Object Notation (JSON) RFC7159 and Concise Binary Object Representation (CBOR) RFC7049.
A link-format document is a collection of web links link-value
, each of which is a collection of attributes link-param
applied to a URI-Reference
. The Information Model mapping is straightforward for the collection of links and attributes, requiring CBOR an extra mapping to the encoded values, its CDDL being:
+ +
links = [* link] | |
link = { | JSON |
href: tstr ; resource URI | |
* label => tstr / true | |
} | |
href =1 + |
label = tstr / &( | CBOR
rel: 2, anchor: 3, |
rev: 4, hreflang: 5, media: 6, |
title: 7, type: 8, rt: 9, |
if: 10, sz: 11, ct: 12, |
obs: 13, |
) +
There is one example of mapping, answer to the following request to the CoAP Server:
REQ: GET /.well-known/core?anchor=/sensors/temp
Response form in CoRE Link Format:
</sensors>;ct=40;title="Sensor Index",
</sensors/temp>;rt="temperature-c";if="sensor",
</sensors/light>;rt="light-lux";if="sensor",
<http://www.example.com/sensors/t123>;anchor="/sensors/temp"
;rel="describedby",
</t>;anchor="/sensors/temp";rel="alternate"
Same response in JSON:
"[{"href":"/sensors","ct":"40","title":"Sensor
Index"},{"href":"/sensors/temp","rt":"temperature-
c","if":"sensor"},{"href":"/sensors/light","rt":"light-
lux","if":"sensor"},{"href":"http://www.example.com/sensors/
t123","anchor":"/sensors/
temp","rel":"describedby"},{"href":"/t","anchor":"/sensors/
temp","rel":"alternate"}]"
Same response in CBOR diagnostic format, in which there is a substitution of the common attribute names:
[{1: "/sensors", 12: "40", 7: "Sensor Index"},
{1: "/sensors/temp", 9: "temperature-c", 10: "sensor"},
{1: "/sensors/light", 9: "light-lux", 10: "sensor"},
{1: "http://www.example.com/sensors/t123", 3: "/sensors/temp",
2: "describedby"},
{1: "/t", 3: "/sensors/temp", 2: "alternate"}]
The full example of hexadecimal CBOR is found in Section 2.4.2.
Sizewise the results are definitely more compact:
Notation | Binary | Size | % to Link Format |
---|---|---|---|
Link Format | no | 257 bytes | ——– |
JSON | no | 321 bytes | > 25 % |
CBOR | yes | 203 bytes | < 21 % |
Document Shepherd: Jaime Jiménez, jaime.jimenez@ericsson.com Area Director: Alexey Melnikov, aamelnikov@fastmail.fm
JavaScript Object Notation, JSON (RFC7159) is a text-based data format which is popular for Web based data exchange. Concise Binary Object Representation, CBOR (RFC7049) is a binary data format which has been optimized for data exchange for the Internet of Things (IoT). For many IoT scenarios, CBOR formats will be preferred since it can help decrease transmission payload sizes as well as implementation code sizes compared to other data formats.
Web Linking (RFC5988) provides a way to represent links between Web resources as well as the relations expressed by them and attributes of such a link. In constrained networks, a collection of Web links can be exchanged in the CoRE link format (RFC6690). Outside of constrained environments, it may be useful to represent these collections of Web links in JSON, and similarly, inside constrained environments, in CBOR. This specification defines a common format for this.
The document is intended for Standards Track.
The document has gone through multiple expert reviews and has been discussed on multiple IETF meetings. Before the last IETF the WGLC was completed.
Each author has stated that they do not have direct, personal knowledge of any IPR related to this document. I am not aware of any IPR discussion about this document on the CoRE WG.
IMO the title should probably be: Representing CoRE link-format in JSON and CBOR
.
A previous version included other formats, the present one doesn’t.
Mail sent to media-types@iana.org, waiting for anwer. New entries (link-format+json and link-format+cbor) need verification by media-types@iana.org.
draft-greevenbosch-appsawg-cbor-cddl-09 ref should be updated
Both seem correct to me
Does not apply
If this is a bis
document, have all of the errata been considered?
Does not apply
IANA Considerations:
TBD64 and TBD54 are the requested numbers, as shown on Table 2.
no new registries