Network Working Group | E. Wilde |
Internet-Draft | CA Technologies |
Intended status: Informational | H. Van de Sompel |
Expires: December 15, 2017 | Los Alamos National Laboratory |
June 13, 2017 |
Linkset: A Link Relation Type for Link Sets
draft-wilde-linkset-link-rel-02
This specification defines the "linkset" link relation type that can be used to link to a resource that provides a set of links.
Please discuss this draft on the ART mailing list (<https://www.ietf.org/mailman/listinfo/art>).
Online access to all versions and files is available on GitHub (<https://github.com/dret/I-D/tree/master/linkset-link-rel>).
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
This Internet-Draft will expire on December 15, 2017.
Copyright (c) 2017 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
Resources on the Web often convey typed Web Links [RFC5988] as a part of resource representations, for example, using the <link> element for HTML representations, or the "Link" header field in HTTP response headers for representations of any media type. In some cases, however, providing links by value is impractical or impossible. In these cases, an approach to provide links by reference (instead of by value) can solve the problem. This specification defines the "linkset" relation type that allows to link resources to sets of links, thereby making it possible to represent links by reference, and not by value.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [RFC2119].
This section introduces two types of resources involved in providing links by reference, as well as the link relation type used to interlink them.
An "origin resource" is a resource that makes links in which it participates discoverable by providing a typed link that has a "link set resource" as the target. From the perspective of the origin resource, the links in the "link set resource" are therefore provided by reference.
A "link set resource" is a resource - distinct from the origin resource, and possibly linked to from the origin resource - that provides one or more links in which the origin resource participates.
Because the link set resource is distinct from the origin resource, links provided by the link set resource must represent both the source and target of each link to allow unambiguous interpretation.
The following sections outline some scenarios in which it is useful to have the ability to separate resources and links pertaining to them.
These are all scenarios in which providing (some) links by reference is advantageous or necessary to accomplish certain goals. It is important to keep in mind that even when using the pattern of "links by reference", it is still possible to provide links by value, allowing resources to decide and combine which of the two patterns they would like to use.
In some cases, it is useful that links pertaining to an origin resource are provided by a server other than the one that hosts the origin resource. For example, this allows:
In such cases, a third-party link set resource provides links pertaining to the origin resource. This link set resource may be managed by the same custodian as the origin resource, or by a third party.
In order for the server hosting the origin resource to provide an up-to-date and complete set of links for it, it would need to obtain the links from the link set resource, and embed them in the origin resource's representations prior to responding to a client. Doing so would increase latency and load, which may be unnecessary if a client is not intent on consuming these links. Providing links by reference, instead of by value, removes the server-to-server communication and resulting overhead required to obtain links. Instead, the consumer of the origin resource can decide if they need the additional links as context for the resource.
When conveying links in the HTTP "Link" header, it is possible for the size of the HTTP response header to become unpredictable. This can be the case when links are determined dynamically dependent on a range of contextual factors. It is possible to statically configure a web server to correctly handle large HTTP response headers by specifying an upper boundary for their size. But when the number of links is unpredictable, estimating a reliable upper boundary is challenging.
HTTP [RFC7231] defines error codes related to excess communication by the user agent ("413 Request Entity Too Large" and "414 Request-URI Too Long"), but no specific error codes are defined to indicate that a response header exceeds the upper boundary that can be handled by the server, and thus it has been truncated. As a result, applications take counter measures aimed at controlling the size of the HTTP "Link" header, for example by limiting the links they provide to those with select relation types, thereby limiting the value of the HTTP "Link" header to clients. Providing links by reference, instead of by value, overcomes challenges related to the unpredictable nature of the extent of HTTP "Link" headers.
In more extreme scenarios it is conceivable that the number of links pertaining to the origin resource becomes so large that the response from the associated link set resource becomes too large. This could be the case for highly popular origin resources, when the link set includes incoming links as well. In such cases, the link set resource could deliver responses incrementally, for example, using a paged resource model that clients could consume as required.
A link with the "linkset" link relation type has as Context IRI the IRI of an origin resource, and as Target IRI the IRI of an associated link set resource.
A link with the "linkset" relation type MAY be provided in the header and/or the body of the origin resource's representation. It may also be discovered by other means, such as through client-side information.
More than one link with a "linkset" relation type MAY be provided. Multiple such links can refer to the same set of links expressed using different representations, or to different link sets (potentially provided by different services).
The use of a link with the "linkset" relation type does not preclude the provision of links with other relation types, i.e. the origin resource can provide typed links other than a "linkset" link. Therefore, the effective set of links pertaining to the origin resource is the union of the links that the resource itself provides, and of all links in which it participates which are provided by the link set resources linked from it via "linkset" links.
The link set resource MAY provide the links that pertain to the origin resource in its HTTP response header and/or body:
There is no constraint on the Target IRI of a link with the "linkset" relation type; designing and using these links is left to the discretion of implementers.
If an origin resource provides a "linkset" link pointing at a link set resource, and that link set resource provides a "linkset" link in turn, then this latter link points at links pertaining to the link set resource. This means that in the context of the latter link, the link set resource is an origin resource. This also means that linkset relations are not transitive; it is up to a client to decide whether they follow "chains" of linkset links or not.
Sections Section 5.1 and Section 5.2 show examples whereby the link set resource provides links pertaining to the origin resource, in its response header and body, respectively.
Figure 1 shows a client issuing an HTTP head request against origin resource http://example.org/resource1.
HEAD /resource1 HTTP/1.1 Host: example.org Connection: close
Figure 1: Client HTTP HEAD Request
Figure 2 shows the response to the HEAD request of Figure 1. The response contains a Link header with a link that uses the "linkset" relation type. It indicates that links pertaining to the origin resource are provided by link set resource http://example.com/links?uri=http%3A%2F%2Fexample.org%2Fresource.
HTTP/1.1 200 OK Date: Mon, 28 Nov 2016 14:37:51 GMT Server: Apache-Coyote/1.1 Link: <http://example.com/links?uri=http%3A%2F%2Fexample.org%2Fresource> ; rel="linkset" ; type="text/html" Content-Length: 5214 Content-Type: text/html;charset=utf-8 Connection: close
Figure 2: Response to HTTP HEAD on Origin Resource
While in this example the IRI of the linkset resource uses a pattern that represents the IRI of the origin resource, this is opaque to the client, which simply follows the provided linkset IRI when retrieving the linkset resource.
Figure 3 shows the client issuing an HTTP GET request against the link set resource provided in Figure 2.
GET /links?uri=http%3A%2F%2Fexample.org%2Fresource HTTP/1.1 Host: example.com Connection: close
Figure 3: Client HTTP GET against the Link Set Resource
Figure 4 shows the response headers to the HTTP GET request of Figure 3. The links pertaining to the origin resource are provided in the Link response header of the link set resource. As can be seen, in order to support an unambiguous determination of the Context IRI of each link, the "anchor" attribute is provided for each link. Note that most, but not all, links have the origin resource as Context IRI (anchor).
HTTP/1.1 200 OK Date: Mon, 28 Nov 2016 14:40:02 GMT Server: Apache-Coyote/1.1 Link: <http://authors.example.net/johndoe> ; rel="author" ; type="application/rdf+xml" ; anchor="http://example.org/resource1", <http://authors.example.net/janedoe> ; rel="author" ; type="application/rdf+xml" ; anchor="http://example.org/resource1", <http://example.org/resource1/items/AF48EF.pdf> ; rel="item" ; type="application/pdf" ; anchor="http://example.org/resource1", <http://example.org/resource1/items/CB63DA.html> ; rel="item" ; type="text/html" ; anchor="http://example.org/resource1", <http://example.net/resource41/> ; rel="related" ; type="application/pdf" ; anchor="http://example.org/resource1/items/AF48EF.pdf" Content-Type: text/html Content-Length: 3018
Figure 4: Response to HTTP GET against the Link Set Resource
Figure 5 is an example of a client issuing an HTTP head request against origin resource http://example.org/article?id=10.1371/journal.pone.0167475
HEAD article?id=10.1371/journal.pone.0167475 HTTP/1.1 Host: example.org Connection: close
Figure 5: Client HTTP HEAD Request
Figure 6 shows the response to the HEAD request of Figure 5. The response contains a Link header with a link that has the "linkset" relation type. It indicates that links pertaining to the origin resource are provided by link set resource http://example.com/links/10.1371/journal.pone.0167475, which provides a representation with vendor media type application/vnd.example.org.linkset+json.
HTTP/1.1 200 OK Date: Mon, 28 Nov 2016 14:37:51 GMT Server: Apache-Coyote/1.1 Link: <http://example.com/links/10.1371/journal.pone.0167475> ; rel="linkset" ; type="application/vnd.example.org.linkset+json" Content-Length: 236 Content-Type: text/html;charset=utf-8 Connection: close
Figure 6: Response to HTTP HEAD on Origin Resource
In this example, the IRI of the linkset resource does not directly represent the IRI of the origin resource anymore. There still is an association possible through a IRI pattern that is including DOI information, but as in the example above, the linkset IRI is opaque to the client which simply accesses the IRI to retrieve the linkset resource.
Figure 7 shows the client issuing an HTTP GET request against the link set resource provided in Figure 6.
GET /links/10.1371/journal.pone.0167475 HTTP/1.1 Host: example.com Accept: application/vnd.example.org.linkset+json Connection: close
Figure 7: Client HTTP GET against the Link Set Resource
Figure 8 shows the response headers to the HTTP GET request of Figure 7. The links pertaining to the origin resource are provided in the response body of the link set resource and are serialized according to the vendor media type application/vnd.example.org.linkset+json.
HTTP/1.1 200 OK Date: Mon, 28 Nov 2016 14:40:02 GMT Server: Apache-Coyote/1.1 Content-Type: application/vnd.example.org.linkset+json Content-Length: 729 [{"anchor":"http://example.org/article?id=10.1371/journal.pone.0167475","href":"http://authors.example.net/johndoe","rel":"author","type":"application/rdf+xml"}, {"anchor":"http://example.org/article?id=10.1371/journal.pone.0167475","href":"http://authors.example.net/janedoe","rel":"author","type":"application/rdf+xml"}, {"anchor":"http://example.org/article?id=10.1371/journal.pone.0167475","href":"http://example.org/resource1/items/AF48EF.pdf","rel":"item","type":}, {"anchor":"http://example.org/article?id=10.1371/journal.pone.0167475","href":,"rel":,"type":"application/pdf"}, {"anchor":"http://example.org/resource1/items/AF48EF.pdf","href":"http://example.net/resource41/","rel":"related","type":"application/pdf"}]
Figure 8: Response to HTTP GET against the Link Set Resource
The link relation type below has been registered by IANA per Section 6.2.1 of RFC 5988 [RFC5988]:
...
[RFC2119] | Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997. |
[RFC5988] | Nottingham, M., "Web Linking", RFC 5988, DOI 10.17487/RFC5988, October 2010. |
[RFC6690] | Shelby, Z., "Constrained RESTful Environments (CoRE) Link Format", RFC 6690, DOI 10.17487/RFC6690, August 2012. |
[RFC7231] | Fielding, R. and J. Reschke, "Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content", RFC 7231, DOI 10.17487/RFC7231, June 2014. |