Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spec/latest/common/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var jsonld = {
},
"JSON-LD-API": {
title: "JSON-LD 1.1 Processing Algorithms and API",
href: "http://json-ld.org/spec/latest/json-ld/",
href: "http://json-ld.org/spec/latest/json-ld-api/",
authors: ["Markus Lanthaler", "Gregg Kellogg", "Manu Sporny"],
publisher: "W3C",
status: 'CG Draft'
Expand Down
10 changes: 5 additions & 5 deletions spec/latest/common/terms.html
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,10 @@ <h1>General Terminology</h1>
<dt><dfn data-lt="objects">object</dfn></dt><dd>
An <a data-cite="RDF11-CONCEPTS#dfn-object" class="externalDFN">object</a> is a <a>node</a> in a <a>linked data graph</a> with at least one incoming edge.
See <dfn data-cite="RDF11-CONCEPTS#dfn-object" class="preserve">RDF object</dfn>in [[RDF11-CONCEPTS]].</dd>
<dt><dfn data-lt="prefixes">prefix</dfn></dt><dd>
A <a>prefix</a> is a <a>term</a> that expands to a vocabulary <a>base IRI</a>. It
is typically used along with a <em>suffix</em> to form a <a>compact IRI</a> to create an IRI
within a vocabulary.</dd>
<dt><dfn data-lt="prefixes">prefix</dfn></dt><dd>
A <a>prefix</a> is the first component of a <a>compact IRI</a> which comes from a
<a>term</a> that maps to a string that, when prepended to the suffix of the <a>compact IRI</a>
results in an <a>absolute IRI</a>.</dd>
<dt><dfn>processing mode</dfn></dt><dd>
The processing mode defines how a JSON-LD document is processed.
By default, all documents are assumed to be conformat with
Expand Down Expand Up @@ -252,7 +252,7 @@ <h1>General Terminology</h1>
<dt><dfn data-lt="term definitions">term definition</dfn></dt><dd>
A term definition is an entry in a <a>context</a>, where the key defines a <a>term</a> which may be used within
a <a>JSON object</a> as a <a>property</a>, type, or elsewhere that a string is interpreted as a vocabulary item.
Its value is either a string, expanding to an absolute IRI, or an <a>expanded term definition</a>.
Its value is either a string (<dfn data-lt="simple terms|simple term|simple term definitions">simple term definition</dfn>), expanding to an absolute IRI, or an <a>expanded term definition</a>.
</dd>
<dt class="changed"><dfn data-lt="type maps">type map</dfn></dt><dd class="changed">
An <a>type map</a> is a <a>JSON object</a> value of a <a>term</a> defined with
Expand Down
115 changes: 83 additions & 32 deletions spec/latest/json-ld-api/index.html

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion spec/latest/json-ld-framing/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1222,13 +1222,21 @@ <h3>JsonLdProcessor</h3>
<li>Set <em>context</em> to the value of <code>@context</code>
from <a data-lt="JsonLdProcessor-frame-frame">frame</a>, if it exists, or to
a new empty <a>context</a>, otherwise.</li>
<li class="changed">Initialize an <a>active context</a> using <em>context</em>;
the <a>base IRI</a> is set to
the <a data-cite="JSON-LD-API#dom-jsonldoptions-base">base</a> option from
<a data-lt="jsonldprocessor-frame-options">options</a>, if set;
otherwise, if the
<a data-cite="JSON-LD-API#dom-jsonldoptions-compacttorelative">compactToRelative</a> option is
<strong>true</strong>, to the IRI of the currently being processed
document, if available; otherwise to <code>null</code>.</li>
<li>If <a data-lt="JsonLdProcessor-frame-frame">frame</a> has a top-level
property which expands to <code>@graph</code> set the <a data-link-for="JsonLdOptions">frameDefault</a>
option to <a data-lt="JsonLdProcessor-frame-options">options</a> with the
value <code>true</code>.</li>
<li>Set <em>framed</em> to the result of using the
<a href="#framing-algorithm">Framing algorithm</a>, passing
<em>expanded input</em>, <em>expanded frame</em>, <em>context</em>, and <em>options</em>.</li>
<em>expanded input</em>, <em>expanded frame</em>, <a>active context</a>, and <em>options</em>.</li>
<li>Fulfill the <em>promise</em> passing <em>framed</em>.</li>
</ol>

Expand Down
49 changes: 37 additions & 12 deletions spec/latest/json-ld/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,9 @@ <h2>Syntax Tokens and Keywords</h2>
This keyword is described in <a class="sectionRef" href="#named-graphs"></a>.</dd>
<dt class="changed"><code>@nest</code></dt><dd class="changed">Collects a set of <a>nested properties</a> within
a <a>node object</a>.</dd>
<dt class="changed"><code>@prefix</code></dt><dd class="changed">
With the value <a>true</a>, allows this <a>term</a> to be used to construct a <a>compact IRI</a>
when compacting.</dd>
<dt class="changed"><code>@version</code></dt><dd class="changed">
Used in a <a>context definition</a> to set the <a>processing mode</a>.
New features since <a data-cite="JSON-LD-20140116">JSON-LD 1.0</a> [[!JSON-LD-20140116]] described in this specification are
Expand Down Expand Up @@ -1043,6 +1046,20 @@ <h2>Compact IRIs</h2>
underscore (<code>_</code>), the value is interpreted as <a>blank node identifier</a>
instead.</p>

<p class="changed">In JSON-LD 1.0, terms will be used as <a>compact IRI</a> prefixes when
compacting only if they map to a value that ends with a URI <a
data-cite="RFC3986#section-2.2">gen-delim</a> character (e.g, <code>/</code>,
<code>#</code> and others, see [[!RFC3986]]).</p>

<p class="note">This represents a small change to the 1.0 algorithm to prevent IRIs
that are not really intended to be used as prefixes from being used for creating
<a>compact IRIs</a>.</p>

<p class="changed">When <a>processing mode</a> is set to <code>json-ld-1.1</code>, terms will be used as <a>compact IRI</a> prefixes
when compacting only if their <a>expanded term definition</a> contains
a <code>@prefix</code> member with the value <a>true</a>, or if it has a
a <a>simple term definition</a> where the value ends with a URI <a data-cite="RFC3986#section-2.2">gen-delim</a> character
(e.g, <code>/</code>, <code>#</code> and others, see [[!RFC3986]]).</p>

<p>It's also possible to use compact IRIs within the context as shown in the
following example:</p>
Expand Down Expand Up @@ -2228,7 +2245,7 @@ <h2>Scoped Contexts</h2>
<p>Scoping on <code>@type</code> is useful when common properties are used to relate things of different types, where the vocabularies in use within different entities calls for different context scoping. For example, `hasPart`/`partOf` may be common terms used in a document, but mean different things depending on the context.</p>

<p class="note">Scoped Contexts are a new feature in JSON-LD 1.1, requiring
<a>processing mode</a> set to <code>json-ld-1.1</code></p>
<a>processing mode</a> set to <code>json-ld-1.1</code>.</p>
</section>


Expand Down Expand Up @@ -2788,7 +2805,7 @@ <h2>Node Identifier Indexing</h2>
</pre>

<p class="note"><a>Id maps</a> are a new feature in JSON-LD 1.1, requiring
<a>processing mode</a> set to <code>json-ld-1.1</code></p>
<a>processing mode</a> set to <code>json-ld-1.1</code>.</p>
</section>

<section class="informative changed">
Expand Down Expand Up @@ -2869,7 +2886,7 @@ <h2>Node Type Indexing</h2>
</pre>

<p class="note"><a>Type maps</a> are a new feature in JSON-LD 1.1, requiring
<a>processing mode</a> set to <code>json-ld-1.1</code></p>
<a>processing mode</a> set to <code>json-ld-1.1</code>.</p>
</section>

<section class="informative changed">
Expand Down Expand Up @@ -2951,7 +2968,7 @@ <h2>Nested Properties</h2>
</pre>

<p class="note"><a>Nested properties</a> are a new feature in JSON-LD 1.1, requiring
<a>processing mode</a> set to <code>json-ld-1.1</code></p>
<a>processing mode</a> set to <code>json-ld-1.1</code>.</p>
</section>

<section class="informative">
Expand Down Expand Up @@ -3682,7 +3699,8 @@ <h2>Context Definitions</h2>

<p>An <a>expanded term definition</a> MUST be a <a>JSON object</a>
composed of zero or more keys from <code>@id</code>, <code>@reverse</code>,
<code>@type</code>, <code>@language</code>, <code class="changed">@context</code> or <code>@container</code>. An
<code>@type</code>, <code>@language</code>, <code class="changed">@context</code>,
<code class="changed">@prefix</code> or <code>@container</code>. An
<a>expanded term definition</a> SHOULD NOT contain any other keys.</p>

<p>If an <a>expanded term definition</a> has an <code>@reverse</code> member,
Expand Down Expand Up @@ -3727,14 +3745,17 @@ <h2>Context Definitions</h2>
<p class="changed">If an <a>expanded term definition</a> has an <code>@context</code> member,
it MUST be a valid <code>context definition</code>.</p>

<p class="changed">If the <a>expanded term definition</a> contains the <code>@nest</code>
<a>keyword</a>, its value MUST be either <code>@nest</code>, or a term
which expands to <code>@nest</code>.</p>

<p class="changed">If the <a>expanded term definition</a> contains the <code>@prefix</code>
<a>keyword</a>, its value MUST be <code>true</code> or <code>false</code>.</p>

<p><a>Terms</a> MUST NOT be used in a circular manner. That is,
the definition of a term cannot depend on the definition of another term if that other
term also depends on the first term.</p>

<p>If the <a>expanded term definition</a> contains the <code>@nest</code>
<a>keyword</a>, its value MUST be either <code>@nest</code>, or a term
which expands to <code>@nest</code>.</p>

<p>See <a class="sectionRef" href="#the-context"></a> for further discussion on contexts.</p>
</section>

Expand Down Expand Up @@ -3937,17 +3958,21 @@ <h2>Changes since 1.0 Recommendation of 16 January 2014</h2>
keyword along with <code>@set</code> (other than <code>@list</code>).
This allows a way to ensure that such property values will always
be expressed in <a>array</a> form.</li>
<li>In JSON-LD 1.1, terms will be used as <a>compact IRI</a> prefixes
when compacting only if
a <a>simple term definition</a> is used where the value ends with a URI <a data-cite="RFC3986#section-2.2">gen-delim</a> character,
or if their <a>expanded term definition</a> contains
a <code>@prefix</code> member with the value <a>true</a>. The 1.0 algorithm has
been updated to only consider terms that map to a value that ends with a URI
<a data-cite="RFC3986#section-2.2">gen-delim</a> character.</li>
</ul>
</section>

<section class="appendix informative">
<h4>Open Issues</h4>
<p>The following is a list of open issues being worked on for the next release.</p>
<p class="issue" data-number="195"></p>
<p class="issue" data-number="269"></p>
<p class="issue" data-number="333"></p>
<p class="issue" data-number="407"></p>
<p class="issue" data-number="429"></p>
<p class="issue" data-number="481"></p>
</section>

Expand Down
1 change: 1 addition & 0 deletions test-suite/context.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"description": "rdfs:comment",
"base": { "@type": "@id" },
"compactArrays": { "@type": "xsd:boolean" },
"compactToRelative": { "@type": "xsd:boolean" },
"documentLoader": { "@type": "xsd:string" },
"expandContext": { "@type": "xsd:string" },
"processingMode": { "@type": "xsd:string" },
Expand Down
10 changes: 5 additions & 5 deletions test-suite/tests/compact-0038-out.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
"title": {
"en": {
"@type": "site-cd:field-types/title_field",
"title:/value": "This is the English title"
"site-cd:node/article/title/value": "This is the English title"
},
"es": {
"@type": "site-cd:field-types/title_field",
"title:/value": "Este es el t’tulo espa–ol"
"site-cd:node/article/title/value": "Este es el t’tulo espa–ol"
}
},
"body": {
"en": {
"@type": "site-cd:field-types/text_with_summary",
"body:/value": "This is the English body. There is no Spanish body, so this will be displayed for both the English and Spanish versions.",
"body:/summary": "This is the teaser for the body.",
"body:/format": "full_html"
"site-cd:node/article/body/value": "This is the English body. There is no Spanish body, so this will be displayed for both the English and Spanish versions.",
"site-cd:node/article/body/summary": "This is the teaser for the body.",
"site-cd:node/article/body/format": "full_html"
}
},
"field_tags": {
Expand Down
2 changes: 1 addition & 1 deletion test-suite/tests/compact-0045-context.jsonld
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"@context": {
"term": "http://example.com/terms-are-not-considered-in-id",
"compact-iris": "http://example.com/compact-iris-",
"compact-iris": "http://example.com/compact-iris#",
"property": "http://example.com/property",
"@vocab": "http://example.org/vocab-is-not-considered-for-id"
},
Expand Down
2 changes: 1 addition & 1 deletion test-suite/tests/compact-0045-in.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"@id": "http://json-ld.org/test-suite/tests/term",
"http://example.com/property": [
{
"@id": "http://example.com/compact-iris-are-considered",
"@id": "http://example.com/compact-iris#are-considered",
"http://example.com/property": [
{ "@value": "@id supports the following values: relative, absolute, and compact IRIs" }
]
Expand Down
2 changes: 1 addition & 1 deletion test-suite/tests/compact-0045-out.jsonld
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"@context": {
"term": "http://example.com/terms-are-not-considered-in-id",
"compact-iris": "http://example.com/compact-iris-",
"compact-iris": "http://example.com/compact-iris#",
"property": "http://example.com/property",
"@vocab": "http://example.org/vocab-is-not-considered-for-id"
},
Expand Down
83 changes: 82 additions & 1 deletion test-suite/tests/compact-manifest.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,87 @@
"context": "compact-n010-context.jsonld",
"expect": "compact-n010-out.jsonld",
"option": {"processingMode": "json-ld-1.1"}
}, {
"@id": "#tp001",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
"name": "Compact IRI does may use an expanded term definition in 1.0",
"purpose": "Terms with an expanded term definition may be used for creating compact IRIs",
"option": {"processingMode": "json-ld-1.0"},
"input": "compact-p001-in.jsonld",
"context": "compact-p001-context.jsonld",
"expect": "compact-p001-out.jsonld"
}, {
"@id": "#tp002",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
"name": "Compact IRI does not use expanded term definition in 1.1",
"purpose": "Terms with an expanded term definition are not used for creating compact IRIs",
"option": {"processingMode": "json-ld-1.1"},
"input": "compact-p002-in.jsonld",
"context": "compact-p002-context.jsonld",
"expect": "compact-p002-out.jsonld"
}, {
"@id": "#tp003",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
"name": "Compact IRI does not use simple term that does not end with a gen-delim",
"purpose": "Terms not ending with a gen-delim are not used for creating compact IRIs",
"input": "compact-p003-in.jsonld",
"context": "compact-p003-context.jsonld",
"expect": "compact-p003-out.jsonld"
}, {
"@id": "#tp004",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
"name": "Compact IRIs using simple terms ending with gen-delim",
"purpose": "All simple terms ending with gen-delim are suitable for compaction",
"input": "compact-p004-in.jsonld",
"context": "compact-p004-context.jsonld",
"expect": "compact-p004-out.jsonld"
}, {
"@id": "#tp005",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
"name": "Compact IRI uses term with definition including @prefix: true",
"purpose": "Expanded term definition may set prefix explicitly in 1.1",
"option": {"processingMode": "json-ld-1.1"},
"input": "compact-p005-in.jsonld",
"context": "compact-p005-context.jsonld",
"expect": "compact-p005-out.jsonld"
}, {
"@id": "#tp006",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
"name": "Compact IRI uses term with definition including @prefix: true",
"purpose": "Expanded term definition may set prefix explicitly in 1.1",
"option": {"processingMode": "json-ld-1.1"},
"input": "compact-p006-in.jsonld",
"context": "compact-p006-context.jsonld",
"expect": "compact-p006-out.jsonld"
}, {
"@id": "#tp007",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
"name": "Compact IRI not used as prefix",
"purpose": "Terms including a colon are excluded from being used as a prefix",
"input": "compact-p007-in.jsonld",
"context": "compact-p007-context.jsonld",
"expect": "compact-p007-out.jsonld"
}, {
"@id": "#tr001",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
"name": "Expands and compacts to document base by default",
"purpose": "Compact IRI attempts to compact document-relative IRIs",
"input": "compact-r001-in.jsonld",
"context": "compact-r001-context.jsonld",
"expect": "compact-r001-out.jsonld",
"option": {"base": "http://example.org/", "processingMode": "json-ld-1.1"}
}, {
"@id": "#tr002",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
"name": "Expands and does not compact to document base with compactToRelative false",
"purpose": "With compactToRelative option set to false, IRIs which could be made relative to the document base are not made relative.",
"input": "compact-r002-in.jsonld",
"context": "compact-r002-context.jsonld",
"expect": "compact-r002-out.jsonld",
"option": {
"processingMode": "json-ld-1.1",
"compactToRelative": false
}
}, {
"@id": "#ts001",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
Expand All @@ -846,7 +927,7 @@
"expect": "compact-s001-out.jsonld",
"option": {"processingMode": "json-ld-1.1"}
}, {
"@id": "#ts001",
"@id": "#ts002",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
"name": "@context with array including @set uses array values",
"purpose": "@context values may include @set along with another compatible value",
Expand Down
5 changes: 5 additions & 0 deletions test-suite/tests/compact-p001-context.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"@context": {
"ex": {"@id": "http://example.org/"}
}
}
5 changes: 5 additions & 0 deletions test-suite/tests/compact-p001-in.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"@id": "http://example.org/id1",
"@type": ["http://example.org/Type1", "http://example.org/Type2"],
"http://example.org/term": {"@id": "http://example.org/id2"}
}
8 changes: 8 additions & 0 deletions test-suite/tests/compact-p001-out.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"@context": {
"ex": {"@id": "http://example.org/"}
},
"@id": "ex:id1",
"@type": ["ex:Type1", "ex:Type2"],
"ex:term": {"@id": "ex:id2"}
}
5 changes: 5 additions & 0 deletions test-suite/tests/compact-p002-context.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"@context": {
"ex": {"@id": "http://example.org/"}
}
}
5 changes: 5 additions & 0 deletions test-suite/tests/compact-p002-in.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"@id": "http://example.org/id1",
"@type": ["http://example.org/Type1", "http://example.org/Type2"],
"http://example.org/term": {"@id": "http://example.org/id2"}
}
8 changes: 8 additions & 0 deletions test-suite/tests/compact-p002-out.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"@context": {
"ex": {"@id": "http://example.org/"}
},
"@id": "http://example.org/id1",
"@type": ["http://example.org/Type1", "http://example.org/Type2"],
"http://example.org/term": {"@id": "http://example.org/id2"}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't ex be used as a prefix definition here and thus be used in the compaction? Its value ends with a "/". I would expect a (negative) test for this to leave terms as-is (as IRIs) when a simple term does not end with a gen-delim or the key with a ":". Or am I missing something?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the text above is written I believe you are correct. But I've actually argued below that we shouldn't do this. I think we should specify one way to create prefixes (append a colon (:) to your term). I now see that you argued for this over on #469.

I also see @gkellogg's counter argument:

#469 (comment)

However, don't these contexts need to change to call for JSON-LD 1.1 processing rules to be applied anyway? If so, why not make the simpler change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@niklasl ex is not used, because it's not a simple term, this test is there to be sure that a term with an expanded term definition is not used for creating a compact IRI. Certainly, when expanding, it would be used, but most expanded term definitions are defined for property values, not things intended as prefixes, this the problem with defining a term "resource", and finding that when compacting, you get "resource:s", which the limitation is attempting to address.

I originally did use 1.1 processing rules for this, and we could certainly put that back in, but my worry was that 1.0 processors will continue to do things differently, and this would be confusing in any case. Also, ex: can certainly be used in 1.0 to create ex::term, which is allowed, but odd. This just fixes that behavior.

The theory is that compact IRI generation in 1.0 is basically broken, so we should attempt to fix it without invoking the heavy-handed step of needing to explicitly define this as a 1.1 processing mode.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gkellogg, ok, as an attempt to fix 1.0 I agree. Perhaps with 1.1 we can make it such that a colon must be present to define a prefix and only use the trailing gen-delim behavior in 1.0 for compatibility purposes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dlongley see comment below. Seems like a radical departure and totally breaks otherwise fine 1.0 contexts used for creating compact IRIs which may be more confusing, but if only done in a string 1.1 mode, that may be satisfactory. Let's hear some other opinions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gkellogg I see. I wonder if using "simple" as the arbiter here (as in key + string value) is too brittle. I'll move my thinking into the main thread...

6 changes: 6 additions & 0 deletions test-suite/tests/compact-p003-context.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"@context": {
"compact-iris:": "http://example.com/compact-iris-",
"property": "http://example.com/property"
}
}
6 changes: 6 additions & 0 deletions test-suite/tests/compact-p003-in.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"http://example.com/property": {
"@id": "http://example.com/compact-iris-are-considered",
"http://example.com/property": "Prefix terms must end in a gen-delim"
}
}
Loading