Skip to content

Commit be493d3

Browse files
committed
Add statement to the API spec that malformed IRIs or language tags MUST NOT be corrected
Updated the algorithms accordingly. This addresses #203.
1 parent 3a4d42c commit be493d3

File tree

1 file changed

+21
-24
lines changed

1 file changed

+21
-24
lines changed

spec/latest/json-ld-api/index.html

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,9 @@ <h2>Conformance</h2>
557557
from the result that would be obtained by the specification's algorithms.</p>
558558

559559
<p>This specification does not define how JSON-LD Implementations or Processors handle
560-
non-conforming input documents.</p>
560+
non-conforming input documents. This implies that JSON-LD Implementations or Processors
561+
MUST NOT attempt to correct malformed IRIs or language tags; however, they MAY issue
562+
validation warnings.</p>
561563

562564
<p class="note">Implementers can partially check their level of conformance to
563565
this specification by successfully passing the test cases of the JSON-LD test
@@ -810,8 +812,7 @@ <h2>Expansion Algorithm</h2>
810812
nor <tref>null</tref> trigger an <code class="error">INVALID_VALUE_OBJECT_VALUE</code> error.</li>
811813
<li>If <em>expanded property</em> equals <code>@language</code>, set the <code>@language</code>
812814
member of <em>result</em> to the lowercased <em>value</em>. If <em>value</em> is not
813-
a valid language tag according [[!BCP47]], trigger an
814-
<code class="error">INVALID_LANGUAGE_VALUE</code> error.</li>
815+
a <tref>string</tref>, trigger an <code class="error">INVALID_LANGUAGE_VALUE</code> error.</li>
815816
<li>If <em>expanded property</em> equals <code>@annotation</code>, set the <code>@annotation</code>
816817
member of <em>result</em> to <em>value</em>. If <em>value</em> is not a <tref>string</tref>
817818
trigger an <code class="error">INVALID_ANNOTATION_VALUE</code> error.</li>
@@ -840,9 +841,7 @@ <h2>Expansion Algorithm</h2>
840841
consisting of two members: <code>@value</code> set to the currently
841842
processed item and <code>@language</code> set to the lowercased <em>key</em>.
842843
If <em>val</em> is not a <tref>string</tref>, trigger a
843-
<code class="error">LANGUAGE_MAP_INVALID_VALUE</code> error; if <em>key</em>
844-
is not a valid language tag according [[!BCP47]], trigger an
845-
<code class="error">LANGUAGE_MAP_INVALID_KEY</code> error. Otherwise append
844+
<code class="error">LANGUAGE_MAP_INVALID_VALUE</code> error. Otherwise append
846845
the object to <em>language map values</em>.</li>
847846
</ol>
848847
</li>
@@ -985,13 +984,14 @@ <h2 id="context">Context Processing</h2>
985984
<code class="error">INVALID_LOCAL_CONTEXT</code> error.</li>
986985
<li>Otherwise, if <em>context</em> is an <tref>JSON object</tref>, perform the following steps:
987986
<ol class="algorithm">
988-
<li>If <em>context</em> has a <code>@vocab</code> member: if its value is not
989-
a valid <tref>absolute IRI</tref> or <tref>null</tref> trigger an
990-
<code class="error">INVALID_VOCAB_MAPPING</code> error; otherwise set the
991-
<tref title="active context">active context's</tref> <tref>vocabulary mapping</tref> to
992-
its value and remove the <code>@vocab</code> member from <em>context</em>.</li>
993-
<li>If <em>context</em> has a <code>@language</code> member: if its value is not
994-
a valid language tag according [[!BCP47]] or <tref>null</tref> trigger an
987+
<li>If <em>context</em> has a <code>@vocab</code> member: if its value is neither
988+
an <tref>absolute IRI</tref>, i.e., it does not contain a colon (<code>:</code>),
989+
nor <tref>null</tref>, trigger an <code class="error">INVALID_VOCAB_MAPPING</code>
990+
error; otherwise set the <tref title="active context">active context's</tref>
991+
<tref>vocabulary mapping</tref> to its value and remove the <code>@vocab</code>
992+
member from <em>context</em>.</li>
993+
<li>If <em>context</em> has a <code>@language</code> member: if its value is neither
994+
a <tref>string</tref> nor <tref>null</tref>, trigger an
995995
<code class="error">INVALID_DEFAULT_LANGUAGE</code> error; otherwise set the
996996
<tref title="active context">active context's</tref> <tref>default language</tref> to
997997
its value and remove the <code>@language</code> member from <em>context</em>.</li>
@@ -1005,11 +1005,9 @@ <h2 id="context">Context Processing</h2>
10051005
for <em>key</em> in the <tref>active context</tref> with an <tref>IRI mapping</tref>
10061006
set to <tref>null</tref> and continue with the next <em>key</em>-<em>value</em> pair.</li>
10071007
<li>If <em>value</em> is a <tref>string</tref>, expand it according to the
1008-
<a href="#iri-expansion">IRI Expansion algorithm</a>. If the result is neither a
1009-
<tref>keyword</tref> nor a valid <tref>absolute IRI</tref>, trigger an
1010-
<code class="error">INVALID_TERM_DEFINITION</code> error. Otherwise replace the
1008+
<a href="#iri-expansion">IRI Expansion algorithm</a> and replace the
10111009
<tref>term definition</tref> for <em>key</em> in the <tref>active context</tref> with
1012-
an <tref>IRI mapping</tref> set to the expanded <em>value</em> and continue with
1010+
an <tref>IRI mapping</tref> set to the expanded <em>value</em>. Continue with
10131011
the next <em>key</em>-<em>value</em> pair.</li>
10141012
<li>If <em>value</em> is not a <tref>JSON object</tref>, trigger an
10151013
<code class="error">INVALID_TERM_DEFINITION</code> error</li>
@@ -1019,9 +1017,8 @@ <h2 id="context">Context Processing</h2>
10191017
<li>If <em>value</em> has an <code>@id</code> member with a value <em>val</em>
10201018
<ol class="algorithm">
10211019
<li>and <em>val</em> is an <tref>array</tref>, expand each item according the
1022-
<a href="#iri-expansion">IRI Expansion algorithm</a>. If an item does not expand to
1023-
a valid <tref>absolute IRI</tref>, raise an
1024-
<code class="error">INVALID_PROPERTY_GENERATOR</code> error; otherwise sort
1020+
<a href="#iri-expansion">IRI Expansion algorithm</a>. If an item is not a <tref>string</tref>,
1021+
raise an <code class="error">INVALID_PROPERTY_GENERATOR</code> error; otherwise sort
10251022
<em>val</em> and store it as <tref>IRI mapping</tref> in <em>definition</em>.</li>
10261023
<li>Otherwise, if <em>val</em> is a <tref>string</tref>, expand it according the
10271024
<a href="#iri-expansion">IRI Expansion algorithm</a>. Set the <tref>IRI mapping</tref> of
@@ -1035,14 +1032,14 @@ <h2 id="context">Context Processing</h2>
10351032
<li>Otherwise, set the <tref>IRI mapping</tref> of <em>definition</em> to the result of
10361033
expanding <em>key</em> according the <a href="#iri-expansion">IRI Expansion algorithm</a>.</li>
10371034
<li>If <em>value</em> has an <code>@type</code> member with a value <em>val</em> and <em>val</em>
1038-
is not a <tref>string</tref> or does not expand to an absolute IRI using the
1035+
is not a <tref>string</tref> or does not expand to an <tref>absolute IRI</tref> using the
10391036
<a href="#iri-expansion">IRI Expansion algorithm</a>, raise an
10401037
<code class="error">INVALID_TYPE_MAPPING</code> error. Otherwise set the
10411038
<tref>IRI mapping</tref> of <em>definition</em> to the expanded <em>val</em>.</li>
10421039
<li>Otherwise, if <em>value</em> has an <code>@language</code> member with a value <em>val</em>
1043-
that is a valid language tag according [[!BCP47]] or <tref>null</tref>, set the
1044-
<tref>language mapping</tref> of <em>definition</em> to the lowercased <em>val</em>.
1045-
If <em>val</em> is not a valid language tag or <tref>null</tref>, raise an
1040+
that is a <tref>string</tref> or <tref>null</tref>, set the <tref>language mapping</tref> of
1041+
<em>definition</em> to the lowercased <em>val</em>. If <em>val</em> is neither a
1042+
<tref>string</tref> nor <tref>null</tref>, raise an
10461043
<code class="error">INVALID_LANGUAGE_MAPPING</code> error.</li>
10471044
<li>f <em>value</em> has an <code>@container</code> member with a value <em>val</em> that
10481045
equals <code>@list</code>, <code>@set</code>, or <code>@annotation</code>, set the

0 commit comments

Comments
 (0)