Skip to content

Commit 00507e9

Browse files
committed
Server and parser behavior on unexpected version announcement.
Fixes #205.
1 parent 2b1d6c8 commit 00507e9

File tree

1 file changed

+57
-2
lines changed

1 file changed

+57
-2
lines changed

spec/index.html

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,10 @@ <h3>RDF Version Announcement</h3>
535535
Location: http://example.com/document.ttl
536536
</pre>
537537

538+
<p>Servers are also expected to announce the version in-line,
539+
when the format supports in-line version announcement
540+
(such as [[[RDF12-TURTLE]]] [[RDF12-TURTLE]]).</p>
541+
538542
<p>When requesting an RDF document from an HTTP server, a client
539543
can use the <code>version</code> parameter
540544
during <a data-cite="webarch#frag-coneg">content negotiation</a> [[WEBARCH]],
@@ -543,12 +547,20 @@ <h3>RDF Version Announcement</h3>
543547

544548
<pre class="box http">GET /document.ttl HTTP/1.1
545549
Host: example.com
546-
Accept: text/turtle; version=1.2
550+
Accept: text/turtle; version="1.2"
547551
</pre>
548552
<p>
549553
Section <a href="#defined-version-labels" class="sectionRef"></a> defines <a>version labels</a>
550554
to be used with the <code>version</code> parameter and in <a>concrete RDF syntax</a>.
551555
</p>
556+
557+
<p class="note">As HTTP <a data-cite="webarch#frag-coneg">content negotiation</a> is advisory,
558+
clients recieving a document should be prepared to properly handle a document
559+
of the requested media type but potentially having a `version` other than what was
560+
requested.
561+
Systems may consider down-grading the content to an appropriate version
562+
as discussed in <a href="#defined-version-labels" class="sectionRef"></a>,
563+
or by returning a `406 "Not Acceptable"` status in the response.</p>
552564
</section>
553565
</section>
554566

@@ -612,6 +624,49 @@ <h3>Version Labels</h3>
612624
</tr>
613625
</tbody>
614626
</table>
627+
628+
<p>For serializations supporting in-line version annouoncement,
629+
the version announcement SHOULD be made early in the document
630+
and certainly before serializing any feature depending on that version.</p>
631+
632+
<section id="server-considerations" class="informative">
633+
<h4>Server considerations</h4>
634+
<p>When serializing a graph or dataset which uses features incompatible
635+
with a requested version, servers can consider different alternatives:</p>
636+
637+
<ol>
638+
<li>Downgrade <a>Triple Terms</a> by using an algorithm such
639+
as <em>Unstar</em> ("1.2" to "1.2-basic" or "1.1").
640+
<div class="ednote">Fix this when such an algorithmm is defined.</div></li>
641+
<li>Downgrade <a>directional language-tagged strings</a>
642+
to a <a>literal</a> with a <a>datatype IRI</a>,
643+
using <a data-cite="JSON-LD11#the-i18n-namespace">the `i18n` namespace</a>, as defined in [[JSON-LD11]]
644+
("1.2" or "1.2-basic" to "1.1").</li>
645+
<li>Return `406 "Not Acceptable"`.</li>
646+
<li>Ignore the requested version and return a native representation.</li>
647+
</ol>
648+
649+
<p class="note">The principle here is to follow the
650+
<a href="https://en.wikipedia.org/wiki/Robustness_principle">Robustness principle</a>
651+
(also known as Postel's Law):
652+
servers should be conservative in what they send, be liberal in what they accept.</p>
653+
</section>
654+
655+
<section id="client-considerations" class="informative">
656+
<h4>Client considerations</h4>
657+
<p>If a document has no stated `version` (either by HTTP header or internal),
658+
systems can assume the version is `"1.2"`, which is compatible
659+
with all RDF versions.</p>
660+
<p>When parsing a document with conflicting versions,
661+
or when parsing a document using unsupported versions, a parser
662+
may:</p>
663+
<ul>
664+
<li>Ignore the version directive.</li>
665+
<li>Raise an error and abort.</li>
666+
<li>Issue a warning and ignore the triple.</li>
667+
<li>Parse the structure, but emit triples consistent with the declared version.</li>
668+
</ul>
669+
</section>
615670
</section>
616671

617672
<section id="rdf-strings">
@@ -2369,7 +2424,7 @@ <h3>Acknowledgments for RDF 1.2</h3>
23692424
<h2>Changes between RDF 1.1 and RDF 1.2</h2>
23702425

23712426
<ul>
2372-
<li>Added <a href="#section-version-announcement"class="sectionRef"></a>
2427+
<li>Added <a href="#section-version-announcement" class="sectionRef"></a>
23732428
for announcing RDF versions in RDF documents via the HTTP Content-Type header and/or syntax.</li>
23742429
<li>Added <a href="#section-basic-full-interop" class="sectionRef"></a>
23752430
for informative mappings between RDF [=Full=] and RDF [=Basic=].</li>

0 commit comments

Comments
 (0)