Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect an attempt to compact an IRI which results in an absolute IRI #110

Merged
merged 6 commits into from
Jun 18, 2019
Merged
Show file tree
Hide file tree
Changes from 3 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
16 changes: 15 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3516,7 +3516,7 @@ <h3>Algorithm</h3>
<a data-lt="active context">active context's</a> <a>vocabulary mapping</a>.
Try to create a <a>compact IRI</a>, starting by initializing
<var>compact IRI</var> to <code>null</code>. This variable will be used to
tore the created <a>compact IRI</a>, if any.</li>
store the created <a>compact IRI</a>, if any.</li>
<li>For each key <a>term</a> and value <a>term definition</a> in
the <var>active context</var>:
<ol>
Expand All @@ -3543,6 +3543,13 @@ <h3>Algorithm</h3>
</ol>
</li>
<li>If <var>compact IRI</var> is not <code>null</code>, return <var>compact IRI</var>.</li>
<li class="changed">To ensure that the <a>absolute IRI</a> <var>var</var> is
not confused with a <a>compact IRI</a>,
if the <a data-cite="RFC3986#section-3.1">IRI scheme</a> of <var>var</var>
matches any term in <a>active context</a>,
gkellogg marked this conversation as resolved.
Show resolved Hide resolved
gkellogg marked this conversation as resolved.
Show resolved Hide resolved
and <var>var</var> has no <a datacite="https://tools.ietf.org/html/rfc3986#section-3.2">IRI authority</a> (beginning with double-forward-slash (<code>//</code>),
an <a data-link-for="JsonLdErrorCode">IRI confused with prefix</a> error has been detected,
and processing is aborted.</li>
<li>If <var>vocab</var> is <code>false</code>,
transform <var>var</var> to a <a>relative IRI</a> using
the <span class="changed"><a>base IRI</a> from <var>active context</var>, if it exists</span>.</li>
Expand Down Expand Up @@ -5917,6 +5924,7 @@ <h4>JsonLdErrorCode</h4>
"invalid value object",
"invalid value object value",
"invalid vocab mapping",
"IRI confused with prefix",
"keyword redefinition",
"loading document failed",
"loading remote context failed",
Expand Down Expand Up @@ -6024,6 +6032,9 @@ <h4>JsonLdErrorCode</h4>
<dt><dfn>invalid vocab mapping</dfn></dt>
<dd>An invalid <a>vocabulary mapping</a> has been detected,
i.e., it is neither an <a>IRI</a> nor <code>null</code>.</dd>
<dt class="changed">IRI confused with prefix</dt>
<dd>When compacting an <a>absolute IRI</a> would result in an <a>absolute IRI</a>
which could be confused with a compact IRI (because its <a data-cite="RFC3986#section-3.1">IRI scheme</a> matches a <a>term definition</a> and it has no <a data-cite="RFC3986#section-3.1">IRI authority</a>).</dd>
pchampin marked this conversation as resolved.
Show resolved Hide resolved
<dt><dfn>keyword redefinition</dfn></dt>
<dd>A <a>keyword</a> redefinition has been detected.</dd>
<dt><dfn>loading document failed</dfn></dt>
Expand Down Expand Up @@ -6190,6 +6201,9 @@ <h2>Changes since JSON-LD Community Group Final Report</h2>
This allows a mechanism for documenting the content of a context using HTML.</li>
<li>Consolidate <a>RemoteDocument</a> processing into the <a>LoadDocumentCallback</a>
including variations on HTML processing.</li>
<li>The <a href="#iri-compaction">IRI compaction algorithm</a> may generate an error if the result is an
<a>absolute IRI</a> which could be confused with a compact IRI in the
<a>active context</a>.</li>
</ul>
</section>

Expand Down
9 changes: 9 additions & 0 deletions tests/compact-manifest.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,15 @@
"input": "compact/e001-in.jsonld",
"context": "compact/e001-context.jsonld",
"expect": "compaction to list of lists"
}, {
"@id": "#te002",
"@type": [ "jld:NegativeEvaluationTest", "jld:CompactTest" ],
"name": "Absolute IRI confused with Compact IRI",
"purpose": "Verifies that IRI compaction detects when the result is an absolute IRI with a scheme matching a term.",
"option": {"specVersion": "json-ld-1.1"},
"input": "compact/e002-in.jsonld",
"context": "compact/e002-context.jsonld",
"expect": "IRI confused with prefix"
}, {
"@id": "#ten01",
"@type": [ "jld:NegativeEvaluationTest", "jld:CompactTest" ],
Expand Down
5 changes: 5 additions & 0 deletions tests/compact/e002-context.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"@context": {
"tag": "http://example.org/ns/tag/"
}
}
3 changes: 3 additions & 0 deletions tests/compact/e002-in.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[{
"tag:champin.net,2019:prop": {"@value": "hello world"}
}]