<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "http://xml.resource.org/authoring/rfc2629.dtd" [
<!-- One method to get references from the online citation libraries.
     There has to be one entity for each item to be referenced. 
     An alternate method (rfc include) is described in the references. -->

<!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml"> 
<!ENTITY RFC5988 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5988.xml"> 
<!ENTITY RFC6690 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6690.xml">
<!ENTITY RFC7231 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7231.xml">
]>

<?rfc compact="yes" ?>
<?rfc subcompact="no" ?>
<?rfc toc="yes" ?>
<?rfc sortrefs="yes" ?>
<?rfc symrefs="yes" ?>
<rfc category="info" ipr="trust200902" docName="draft-wilde-linkset-link-rel-02">
    <front>
        <title abbrev="Linkset Link Relation Type">Linkset: A Link Relation Type for Link Sets</title>
        <author initials="E." surname="Wilde" fullname="Erik Wilde">
            <organization>CA Technologies</organization>
            <address>
                <email>erik.wilde@dret.net</email>
                <uri>http://dret.net/netdret/</uri>
            </address>
        </author>
        <author initials="H." surname="Van de Sompel" fullname="Herbert Van de Sompel">
            <organization>Los Alamos National Laboratory</organization>
            <address>
                <email>herbertv@lanl.gov</email>
                <uri>http://public.lanl.gov/herbertv/</uri>
            </address>
        </author>
        <date day="13" month="June" year="2017"/>
        <abstract>
            <t>This specification defines the "linkset" link relation type that can be used 
                to link to a resource that provides a set of links.</t>
        </abstract>
        <note title="Note to Readers">
            <t>Please discuss this draft on the ART mailing list (<eref target="https://www.ietf.org/mailman/listinfo/art"/>).</t>
            <t>Online access to all versions and files is available on GitHub (<eref target="https://github.com/dret/I-D/tree/master/linkset-link-rel"/>).</t>
        </note>
    </front>
    <middle>
        <section title="Introduction" anchor="introduction">
            <t>Resources on the Web often convey typed Web Links <xref target="RFC5988"/> as a  
                 part of resource representations, for example, using the &lt;link&gt; 
                 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.</t>
        </section>
        <section title="Terminology" anchor="terminology">
            <t>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 <xref target="RFC2119"/>.</t>
            <t>This section introduces two types of resources involved in providing links by reference,  
                as well as the link relation type used to interlink them.</t>
            <section title="Origin Resource" anchor="origin-resource">
                <t>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.</t>
            </section>
            <section title="Link Set Resource" anchor="link-set-resource">
                <t>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.</t>
                <t>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.</t>
            </section>
        </section>
        <section title="Scenarios" anchor="scenarios">
            <t>The following sections outline some scenarios in which it is useful to have the ability to
                separate resources and links pertaining to them.</t>
            <t>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.</t>
              <section title="Third-Party Links" anchor="third-party">
                 <t>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:</t>
                     <t><list style="symbols">
                        <t>Providing links in which the origin resource is involved not just as source but 
                             also as target.</t> 
                        <t>Providing links pertaining to the original resource that the server hosting that 
                             resource is not aware of.</t>
                        <t>External management of links pertaining to the origin resource in a special-purpose link
                            management service.</t>
                     </list></t>
                <t>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.</t>
                <t>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.</t>
            </section>
            <section title="Large Number of Links" anchor="link-volume">
                <t>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.</t>
                <t>HTTP <xref target="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.</t>
                <t>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.</t>
             </section>
        </section>
        <section title="The &quot;linkset&quot; Relation Type for Linking to Link Sets" anchor="linkset-link-relation">
            <t>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.</t>
            <t>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.</t>
            <t>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).</t> 
            <t>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.</t>
            <t>The link set resource MAY provide the links that pertain to the origin resource 
                 in its HTTP response header and/or body:</t> 
                <t><list style="symbols">
                    <t>In cases whereby the link set resource provides these links 
                        in its Link HTTP response header, the payload of that header MUST comply with the 
                        syntax defined in Web Linking <xref target="RFC5988"/>. The media type of the response 
                        body is not constrained.</t>
                    <t>In cases whereby the link set resource provides these links 
                        in its response body, the body 
                        SHOULD allow a client to determine the source and target of 
                        each provided link. The media type of the response 
                        body is otherwise not constrained.</t>
                </list></t>
            <t>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.</t>
             <t>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.</t>
        </section>
<!--        
        <section title="A JSON Format for Link Sets" anchor="json-linkset">
            <t>Possibly, a format and media type are defined here.</t>
        </section>
-->        
         <section title="Examples" anchor="linkset-link-examples">

              <t>Sections <xref target="linkset-link-link-format"/> and <xref target="linkset-link-json-format"/>
              show examples whereby the link set resource provides links pertaining to the origin resource, 
              in its response header and body, respectively.
              </t>
           <section title="Links Provided in the Header of the Link Set Resource" anchor="linkset-link-link-format">
               <t><xref target="Request1"/> shows a client issuing an 
                   HTTP head request against origin resource http://example.org/resource1.</t>
               
               <figure title="Client HTTP HEAD Request" align="center" anchor="Request1">
                   <artwork align="left"><![CDATA[
HEAD /resource1 HTTP/1.1
Host: example.org
Connection: close
]]>
                   </artwork> 
               </figure>
               
               <t><xref target="Response1.1"/> shows the response to the HEAD request of 
             <xref target="Request1"/>. 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.
             </t>
              <figure title="Response to HTTP HEAD on Origin Resource" align="center" anchor="Response1.1">
                <artwork align="left"><![CDATA[
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
]]>
                </artwork> 
              </figure>
               <t>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.</t>
                <t><xref target="Request2"/> shows the client issuing an HTTP GET 
                    request against the link set resource provided in <xref target="Response1.1"/>. 
                </t>
                <figure title="Client HTTP GET against the Link Set Resource" align="center" anchor="Request2">
                    <artwork align="left"><![CDATA[
GET /links?uri=http%3A%2F%2Fexample.org%2Fresource HTTP/1.1
Host: example.com
Connection: close
]]>
                    </artwork> 
                </figure>
               <t><xref target="Response2.1"/> shows the response headers to the HTTP GET request of <xref target="Request2"/>. 
                   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).
                   </t>
                <figure title="Response to HTTP GET against the Link Set Resource" align="center" anchor="Response2.1">
                    <artwork align="left"><![CDATA[
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

]]></artwork> 
                </figure>
            </section>
             <section title="Link Set Serialized as application/link-format+json" anchor="linkset-link-json-format">
                 <t><xref target="Request3"/> is an example of a client issuing an 
                     HTTP head request against origin resource 
                      http://example.org/article?id=10.1371/journal.pone.0167475</t>
                 
                 <figure title="Client HTTP HEAD Request" align="center" anchor="Request3">
                     <artwork align="left"><![CDATA[
HEAD article?id=10.1371/journal.pone.0167475 HTTP/1.1
Host: example.org
Connection: close
]]>
                     </artwork> 
                 </figure>
                 <t><xref target="Response3.1"/> shows the response to the HEAD request of 
                     <xref target="Request3"/>. 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.
                 </t>
                 <figure title="Response to HTTP HEAD on Origin Resource" align="center" anchor="Response3.1">
                     <artwork align="left"><![CDATA[
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
]]>
                     </artwork> 
                 </figure>
                 <t>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.</t>
                 <t><xref target="Request4"/> shows the client issuing an HTTP GET 
                     request against the link set resource provided in <xref target="Response3.1"/>. 
                 </t>
                 <figure title="Client HTTP GET against the Link Set Resource" align="center" anchor="Request4">
                     <artwork align="left"><![CDATA[
GET /links/10.1371/journal.pone.0167475 HTTP/1.1
Host: example.com
Accept: application/vnd.example.org.linkset+json
Connection: close
]]></artwork> 
                 </figure>
                 <t><xref target="Response4.1"/> shows the response headers to the HTTP GET request of <xref target="Request4"/>. 
                     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. 
                 </t>
                 <figure title="Response to HTTP GET against the Link Set Resource" align="center" anchor="Response4.1">
                     <artwork align="left"><![CDATA[
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"}]
]]></artwork> 
                 </figure>
            </section>
        </section>
        <section title="IANA Considerations" anchor="iana-considerations">
            <t>The link relation type below has been registered by IANA per Section 6.2.1 of RFC 5988 <xref target="RFC5988"/>:</t>
            <section title="Link Relation Type: linkset">
                <t>
                    <list>
                        <t>Relation Name: linkset</t>
                        <t>Description: The Target IRI of a link with the "linkset" relation type 
                            provides a set of links that pertain to the Context IRI of the link.</t>
                        <t>Reference: [[ This document ]]</t>
                    </list>
                </t>
            </section>
        </section>
        <section title="Security Considerations" anchor="security-considerations">
            <t>...</t>
        </section>
    </middle>
    <back>
        <references title="Normative References">
&RFC2119; 
&RFC5988; 
&RFC6690;
&RFC7231;
            <!--
            <reference anchor="RFC2119">
                <front>
                    <title abbrev="RFC Key Words">Key words for use in RFCs to Indicate Requirement Levels</title>
                    <author initials="S." surname="Bradner" fullname="Scott Bradner"/>
                    <date month="March" year="1997"/>
                </front>
                <seriesInfo name="RFC" value="2119"/>
            </reference>
            <reference anchor="RFC5988">
                <front>
                    <title>Web Linking</title>
                    <author initials="M." surname="Nottingham" fullname="Mark Nottingham"/>
                    <date month="October" year="2010"/>
                </front>
                <seriesInfo name="RFC" value="5988"/>
            </reference>
            <reference anchor="RFC6690">
                <front>
                    <title>Constrained RESTful Environments (CoRE) Link Format</title>
                    <author initials="Z." surname="Shelby" fullname="Zach Shelby"/>
                    <date month="August" year="2012"/>
                </front>
                <seriesInfo name="RFC" value="6690"/>
            </reference>
-->
        </references>
<!--
      <references title="Informative References">
      </references>
      
      -->
             <!--
      <section title="Acknowledgements">
         <t>Thanks for comments and suggestions provided by Mark Nottingham, ...</t>
      </section>
-->
    </back>
</rfc>
