Skip to content

Commit ae24034

Browse files
committed
Add definitions for absolute IRI and relative IRI.
Add requirements that keys expand to absolute IRIs to be processed. (It's an open issue of what to do with the value of keys that do not expand to absolute IRIs). This partially addresses issue #49 and the resolution of 1/24/2012 http://json-ld.org/minutes/2012-01-24/#resolution-1
1 parent 562faa2 commit ae24034

File tree

2 files changed

+40
-26
lines changed

2 files changed

+40
-26
lines changed

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

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ <h3>JsonLdProcessor</h3>
493493
<dt>INVALID_SYNTAX</dt>
494494
<dd>A general syntax error was detected in the <code>@context</code>.
495495
For example, if a <code>@type</code> key maps to anything other than
496-
<code>@id</code> or an absolute <tref>IRI</tref>, this exception would be raised.</dd>
496+
<code>@id</code> or an <tref>absolute IRI</tref>, this exception would be raised.</dd>
497497
<dt>LOAD_ERROR</dt>
498498
<dd>There was a problem encountered loading a remote context.</dd>
499499
</dl>
@@ -518,7 +518,7 @@ <h3>JsonLdProcessor</h3>
518518
<dt>INVALID_SYNTAX</dt>
519519
<dd>A general syntax error was detected in the <code>@context</code>.
520520
For example, if a <code>@type</code> key maps to anything other than
521-
<code>@id</code> or an absolute <tref>IRI</tref>, this exception would be raised.</dd>
521+
<code>@id</code> or an <tref>absolute IRI</tref>, this exception would be raised.</dd>
522522
<dt>LOAD_ERROR</dt>
523523
<dd>There was a problem encountered loading a remote context.</dd>
524524
</dl>
@@ -586,7 +586,7 @@ <h3>JsonLdProcessor</h3>
586586
<dt>INVALID_SYNTAX</dt>
587587
<dd>A general syntax error was detected in the <code>@context</code>.
588588
For example, if a <code>@type</code> key maps to anything other than
589-
<code>@id</code> or an absolute <tref>IRI</tref>, this exception would be raised.</dd>
589+
<code>@id</code> or an <tref>absolute IRI</tref>, this exception would be raised.</dd>
590590
<dt>LOAD_ERROR</dt>
591591
<dd>There was a problem encountered loading a remote context.</dd>
592592
</dl>
@@ -614,7 +614,7 @@ <h3>JsonLdProcessor</h3>
614614
<dt>INVALID_SYNTAX</dt>
615615
<dd>A general syntax error was detected in the <code>@context</code>.
616616
For example, if a <code>@type</code> key maps to anything other than
617-
<code>@id</code> or an absolute <tref>IRI</tref>, this exception would be raised.</dd>
617+
<code>@id</code> or an <tref>absolute IRI</tref>, this exception would be raised.</dd>
618618
<dt>LOAD_ERROR</dt>
619619
<dd>There was a problem encountered loading a remote context.</dd>
620620
</dl>
@@ -787,7 +787,7 @@ <h2 id="context">Context</h2>
787787
<ol id="process-context" class="algorithm">
788788
<li>If <em>value</em> is an <tref>array</tref>, process
789789
each element as <em>value</em>, in order using <a href="#process-context">Step 2</a>.</li>
790-
<li>If <em>value</em> is a simple <tref>string</tref>, it MUST have a lexical form of absolute <tref>IRI</tref>.
790+
<li>If <em>value</em> is a simple <tref>string</tref>, it MUST have a lexical form of <tref>absolute IRI</tref>.
791791
<ol class="algorithm">
792792
<li>Dereference <em>value</em>.</li>
793793
<li>If the resulting document is a JSON document, extract the top-level <code>@context</code>
@@ -805,21 +805,21 @@ <h2 id="context">Context</h2>
805805
or being an empty string, perform the following steps:
806806
<ol class="algorithm">
807807
<li>If the key's value is a simple <tref>string</tref>, the value MUST have the form of
808-
<tref>term</tref>, <tref>compact IRI</tref>, absolute <tref>IRI</tref>. Determine the IRI mapping value by
808+
<tref>term</tref>, <tref>compact IRI</tref>, <tref>absolute IRI</tref>. Determine the IRI mapping value by
809809
performing <a href="#iri-expansion">IRI Expansion</a> on the associated value. If the result of the IRI
810-
mapping is an absolute IRI, merge the key-value pair into the <tref>local context</tref>
810+
mapping is an <tref>absolute IRI</tref>, merge the key-value pair into the <tref>local context</tref>
811811
<tref>term mapping</tref>.</li>
812812
<li>Otherwise, the key's value MUST be a <tref>JSON object</tref>.
813813
<ol class="algorithm">
814814
<li>The value MUST have a <code>@id</code> key with a string value, the value MUST have the
815-
form of <tref>term</tref>, <tref>compact IRI</tref>, absolute <tref>IRI</tref>. Determine the IRI mapping value
815+
form of <tref>term</tref>, <tref>compact IRI</tref>, <tref>absolute IRI</tref>. Determine the IRI mapping value
816816
by performing <a href="#iri-expansion">IRI Expansion</a> on the associated value. If the result of
817-
the IRI mapping is an absolute <tref>IRI</tref>, merge the key-value pair into the <tref>local context</tref>
817+
the IRI mapping is an <tref>absolute IRI</tref>, merge the key-value pair into the <tref>local context</tref>
818818
<tref>term mapping</tref>.</li>
819819
<li>If the value has a <code>@type</code> key, the value MUST have the form of <tref>term</tref>,
820-
<tref>compact IRI</tref>, absolute <tref>IRI</tref> or the <tref>keyword</tref> <code>@id</code>. Determine the IRI by
820+
<tref>compact IRI</tref>, <tref>absolute IRI</tref> or the <tref>keyword</tref> <code>@id</code>. Determine the IRI by
821821
performing <a href="#iri-expansion">IRI Expansion</a> on the associated value. If the result of the
822-
IRI mapping is an absolute <tref>IRI</tref> or <code>@id</code>, merge into the <tref>local context</tref>
822+
IRI mapping is an <tref>absolute IRI</tref> or <code>@id</code>, merge into the <tref>local context</tref>
823823
<tref>coercion mapping</tref>.</li>
824824
<li>If the value has a <code>@list</code> key, the value MUST be
825825
<code>true</code> or <code>false</code>. Merge into the <tref>local context</tref> <tref>list
@@ -837,11 +837,11 @@ <h2 id="context">Context</h2>
837837
</li>
838838
</ol>
839839

840-
<p class="note">It can be difficult to distinguish between a <tref>compact IRI</tref> and an absolute <tref>IRI</tref>,
840+
<p class="note">It can be difficult to distinguish between a <tref>compact IRI</tref> and an <tref>absolute IRI</tref>,
841841
as a <tref>compact IRI</tref> may seem to be a valid IRI <em>scheme</em>. When performing repeated IRI expansion,
842842
a term used as a prefix may not have a valid mapping due to dependencies in resolving term definitions. By
843843
continuing <a href="#object-context">Step 2.3.2</a> until no changes are made, mappings to IRIs created
844-
using an undefined term prefix will eventually resolve to absolute <tref>IRI</tref>s.</p>
844+
using an undefined term prefix will eventually resolve to <tref>absolute IRI</tref>s.</p>
845845

846846
<p class="issue"><a href="https://github.com/json-ld/json-ld.org/issues/43">Issue 43</a>
847847
concerns performing IRI expansion in the key position of a context definition.</p>
@@ -851,7 +851,12 @@ <h2 id="context">Context</h2>
851851
<h2>IRI Expansion</h2>
852852
<p>Keys and some values are evaluated to produce an <tref>IRI</tref>. This section defines an algorithm for
853853
transforming a value representing an IRI into an actual IRI.</p>
854-
<p><tref>IRI</tref>s may be represented as an absolute IRI, a <tref>term</tref> or a <tref>compact IRI</tref>.</p>
854+
<p><tref>IRI</tref>s may be represented as an <tref>absolute IRI</tref>, a <tref>term</tref> or a <tref>compact IRI</tref>.</p>
855+
<p>An <tdef>absolute IRI</tdef> is defined in [[!RFC3987]] containing a <em>scheme</em> along with
856+
<em>path</em> and optional <em>query</em> and fragment segments. A <tdef>relative IRI</tdef> is an IRI
857+
that is relative some other <tref>absolute IRI</tref>; in the case of JSON-LD this is the base location
858+
of the document.</p>
859+
855860
<p>The algorithm for generating an IRI is:
856861
<ol class="algorithm">
857862
<li>Split the value into a <em>prefix</em> and <em>suffix</em> from the first occurrence of ':'.</li>
@@ -865,7 +870,7 @@ <h2>IRI Expansion</h2>
865870
</p>
866871
<p class="note">
867872
Previous versions of this specification used <code>@base</code> and <code>@vocab</code> to define IRI prefixes
868-
used to resolve relative IRIs. It was determined that this added too much complexity, but the issue
873+
used to resolve <tref title="relative IRI">relative IRIs</tref>. It was determined that this added too much complexity, but the issue
869874
can be re-examined in the future based on community input.
870875
</p>
871876
</section>
@@ -1827,12 +1832,13 @@ <h3>RDF Conversion Algorithm</h3>
18271832
<li>Otherwise, set the <tref>active property</tref> to the result of performing
18281833
<a href="#iri-expansion">IRI Expansion</a> on the key.</li>
18291834
<li>
1830-
If the <tref>active property</tref> is the target of a <code>@list</code> coercion,
1831-
and the value is an <tref>array</tref>,
1835+
If the <tref>active property</tref> is an <tref>absolute IRI</tref> and is the
1836+
target of a <code>@list</code> coercion, and the value is an <tref>array</tref>,
18321837
process the value as a list as described in in <a href="#list-conversion">List Conversion</a>.
18331838
</li>
18341839
<li>
1835-
Otherwise, create a new <tref>processor state</tref> copies of the <tref>active context</tref>,
1840+
Otherwise, If the <tref>active property</tref> is an <tref>absolute IRI</tref>,
1841+
create a new <tref>processor state</tref> copies of the <tref>active context</tref>,
18361842
<tref>active subject</tref> and <tref>active property</tref> and process the value
18371843
starting at <a href="#processing-step-associative">Step 2</a> and proceed using the
18381844
previous <tref>processor state</tref>.

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

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ <h3>The Context</h3>
558558
in an JSON document, to <tref>IRI</tref>s. A <tdef>term</tdef> is a short word that MAY be expanded to an
559559
<tref>IRI</tref>. A <tref>term</tref> MUST have the lexical form of <cite><a
560560
href="http://www.w3.org/TR/2009/REC-xml-names-20091208/#NT-NCName">NCName</a></cite> (see [[XML-NAMES]]),
561-
<tref>compact IRI</tref>, absolute <tref>IRI</tref>, or
561+
<tref>compact IRI</tref>, <tref>absolute IRI</tref>, or
562562
be an empty string.</p>
563563
<p>The Web uses <tref title="IRI">IRIs</tref> for unambiguous identification. The
564564
idea is that these <tref>term</tref>s mean something that may be of use to other developers and that it is useful to
@@ -703,7 +703,7 @@ <h3>The Context</h3>
703703
<code>foaf</code> <tref>prefix</tref>. The <code>foaf</code> vocabulary
704704
contains a term called <strong>name</strong>. If you join the
705705
<code>foaf</code> <tref>prefix</tref> with the <strong>name</strong> suffix,
706-
you can build a <tref>compact IRI</tref> that will expand out into an absolute IRI for the
706+
you can build a <tref>compact IRI</tref> that will expand out into an <tref>absolute IRI</tref> for the
707707
<code>http://xmlns.com/foaf/0.1/name</code> <tref>vocabulary</tref> term.
708708
That is, the compact IRI (or short-form), is <code>foaf:name</code> and the
709709
expanded-form is <code>http://xmlns.com/foaf/0.1/name</code>. This vocabulary
@@ -783,16 +783,20 @@ <h2>IRIs</h2>
783783

784784
<ol>
785785
<li>Except within a <tref>context</tref> definition, <tref>term</tref>s in the key position in
786-
a <tref>JSON object</tref> that have a mapping to an <tref>IRI</tref> or another <tref>term</tref> in the
786+
a <tref>JSON object</tref> that have a mapping to an <tref>absolute IRI</tref> or another <tref>term</tref> in the
787787
<tref>active context</tref> are expanded to an IRI by JSON-LD processors.</li>
788788
<li>An <tref>IRI</tref> is generated for the <tref>string</tref> value specified using
789789
<code>@id</code> or <code>@type</code>.</li>
790790
<li>An <tref>IRI</tref> is generated for the <tref>string</tref> value of any key for which there
791791
are <tref>coercion</tref> rules in effect that identify the value as an <code>@id</code>.</li>
792792
</ol>
793793

794-
<p>IRIs may be represented as an absolute IRI, an IRI that is relative to the
795-
base location of the document, a <tref>term</tref>, or a <tref>compact IRI</tref>.</p>
794+
<p>IRIs may be represented as an <tref>absolute IRI</tref>, a <tref>relative IRI</tref>, a <tref>term</tref>, or a <tref>compact IRI</tref>.</p>
795+
796+
<p>An <tdef>absolute IRI</tdef> is defined in [[!RFC3987]] containing a <em>scheme</em> along with
797+
<em>path</em> and optional <em>query</em> and fragment segments. A <tdef>relative IRI</tdef> is an IRI
798+
that is relative some other <tref>absolute IRI</tref>; in the case of JSON-LD this is the base location
799+
of the document.</p>
796800

797801
<p>IRIs can be expressed directly in the key position like so:</p>
798802

@@ -847,6 +851,10 @@ <h2>IRIs</h2>
847851

848852
<p><tref>Term</tref>s are case sensitive, and MUST be matched using a case-sensitive comparison.</p>
849853

854+
<p>Keys that do not expand to an absolute IRI are ignored.</p>
855+
<p class="issue">It is not determined if processing proceeds into values of undefined keys. If so,
856+
this would result in a graph which is not <tref title="embedding">embedded</tref>.</p>
857+
850858
<p><code>foaf:name</code> above will automatically expand out to the IRI
851859
<code>http://xmlns.com/foaf/0.1/name</code>. See <a href="#compact-iris">Compact IRIs</a> for more details.</p>
852860

@@ -1300,7 +1308,7 @@ <h2>Compact IRIs</h2>
13001308
hand for the Friend-of-a-Friend vocabulary, which is identified using
13011309
the IRI <code>http://xmlns.com/foaf/0.1/</code>. A developer may append
13021310
any of the FOAF <tref>vocabulary</tref> terms to the end of the prefix
1303-
to specify a short-hand version of the absolute IRI for the
1311+
to specify a short-hand version of the <tref>absolute IRI</tref> for the
13041312
<tref>vocabulary</tref> term. For example, <code>foaf:name</code> would
13051313
be expanded out to the IRI <code>http://xmlns.com/foaf/0.1/name</code>.
13061314
Instead of having to remember and type out the entire IRI, the developer
@@ -1668,7 +1676,7 @@ <h2>Type Coercion</h2>
16681676

16691677
<p>Type coercion is specified within an <a href="#expanded-term-definition">expanded term definition</a>
16701678
using the <code>@type</code> key. The values of this key represent type IRIs and MUST take the form of
1671-
<tref>term</tref>, <tref>compact IRI</tref>, absolute <tref>IRI</tref> or the keyword <code>@id</code>. Specifying
1679+
<tref>term</tref>, <tref>compact IRI</tref>, <tref>absolute IRI</tref> or the keyword <code>@id</code>. Specifying
16721680
<code>@id</code> indicates that within the body of a JSON-LD document, string values of keys coerced as
16731681
<code>@id</code> are to be interpreted as <tref>IRI</tref>s.</p>
16741682

@@ -2303,7 +2311,7 @@ <h4>Prefix definitions</h4>
23032311

23042312
<div class="note">
23052313
<p>JSON-LD has no equivalent for the Turtle <code>@base</code> declaration. Authors could, of course,
2306-
use a prefix definition to resolve relative IRIs. For example, an empty prefix could be used
2314+
use a prefix definition to resolve <tref>relative IRI</tref>s. For example, an empty prefix could be used
23072315
to get a similar effect to <code>@base</code>:</p>
23082316
<pre class="example" data-transform="updateExample">
23092317
<!--

0 commit comments

Comments
 (0)