Skip to content

Commit e7b759e

Browse files
authored
Merge branch 'master' into issue-380
2 parents 1ca6d5d + 18bc029 commit e7b759e

File tree

261 files changed

+351285
-53757
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

261 files changed

+351285
-53757
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- 'gem update bundler --conservative'
3636
script:
3737
- docker pull stupchiy/checklink
38-
- docker run -it stupchiy/checklink -b -X '(http|https|mailto):' "https://labs.w3.org/spec-generator/?type=respec&url=https://rawgit.com/w3c/json-ld-api/${TRAVIS_BRANCH}/index.html?specStatus=WD&shortName=json-ld11-api"
38+
- docker run -it stupchiy/checklink -b -X '(http|https|mailto):' "https://labs.w3.org/spec-generator/?type=respec&url=https://raw.githack.com/w3c/json-ld-api/${TRAVIS_BRANCH}/index.html?specStatus=WD&shortName=json-ld11-api"
3939
- bundle exec rake check_html
4040
- stage: echidna
4141
name: "Echidna Publication"

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
This is the repository of the W3C’s specification on JSON-LD 1.1 Processing Algorithms and API, developed by the [JSON-LD Working Group](https://www.w3.org/2018/json-ld-wg/). The editors’ draft of the specification can also be [read directly](https://w3c.github.io/json-ld-api/).
77

8+
## Submitting Implementation Reports
9+
10+
We are actively seeking JSON-LD 1.1 API implementations! Please [read the instructions](https://w3c.github.io/json-ld-api/reports/#instructions-for-submitting-implementation-reports) and submit your report by either emailing it to `[email protected]` or by [sending a Pull Request to this repository](https://github.com/w3c/json-ld-api/pulls).
11+
812
## Feature Frozen
913

1014
We are no longer accepting new feature requests for JSON-LD 1.1 drafts. Please limit

Rakefile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,32 @@ task :check_html do
2222
exit(1)
2323
end
2424
end
25+
26+
desc "Create concatenated test manifests for reporting"
27+
file "reports/manifests.nt" do
28+
require 'rdf'
29+
require 'json/ld'
30+
require 'rdf/ntriples'
31+
graph = RDF::Graph.new do |g|
32+
%w( https://w3c.github.io/json-ld-api/tests/compact-manifest.jsonld
33+
https://w3c.github.io/json-ld-api/tests/expand-manifest.jsonld
34+
https://w3c.github.io/json-ld-api/tests/flatten-manifest.jsonld
35+
https://w3c.github.io/json-ld-api/tests/fromRdf-manifest.jsonld
36+
https://w3c.github.io/json-ld-api/tests/html-manifest.jsonld
37+
https://w3c.github.io/json-ld-api/tests/remote-doc-manifest.jsonld
38+
https://w3c.github.io/json-ld-api/tests/toRdf-manifest.jsonld
39+
https://w3c.github.io/json-ld-framing/tests/frame-manifest.jsonld
40+
).each do |man|
41+
puts "load #{man}"
42+
local_man = if man.include?('json-ld-api')
43+
basename = File.basename(man)
44+
File.expand_path("../tests/#{basename}", __FILE__)
45+
else
46+
man
47+
end
48+
g.load(local_man, base_uri: man, unique_bnodes: true)
49+
end
50+
end
51+
puts "write"
52+
RDF::NTriples::Writer.open("reports/manifests.nt", unique_bnodes: true, validate: false) {|w| w << graph}
53+
end

common/algorithm-terms.html

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,36 @@
99
which is used for finding coercion mappings in the <a>active contexta>.dd>
1010
<dt><dfn data-cite="JSON-LD11-API#dfn-active-subject">active subjectdfn>dt><dd>
1111
The currently active subject that the processor should use when processing.dd>
12-
<dt class="changed"><dfn data-cite="JSON-LD11-API#add-value">add valuedfn>dt>
12+
<dt class="changed"><dfn data-cite="JSON-LD11-API#dfn-add-value">add valuedfn>dt>
1313
<dd class="algorithm changed">
1414
Used as a macro within various algorithms as a way to add a <var>valuevar>
1515
to an <a>entrya> in a <a>mapa> (<var>objectvar>) using a specified <var>keyvar>.
1616
The invocation may include an <var>as arrayvar> flag defaulting to <code>falsecode>.
1717
<ol>
18-
<li>If <var>as arrayvar> is <code>truecode>,
19-
and <var>valuevar> is not an <a>arraya>,
20-
set it to an <a>arraya> containing <var>valuevar>.li>
21-
<li>If <var>keyvar> is not an entry in <var>objectvar>,
22-
add <var>valuevar> as the value of <var>keyvar> in <var>objectvar>.li>
23-
<li>Otherwise
18+
<li>If <var>as arrayvar> is <code>truecode>
19+
and the value of <var>keyvar> in <var>objectvar> does not exist
20+
or is not an <a>arraya>, set it to a new <a>arraya>
21+
containing any original value.li>
22+
<li>If <var>valuevar> is an <a>arraya>,
23+
then for each element <var>vvar> in <var>valuevar>,
24+
use <a>add valuea> recursively to add <var>vvar> to <var>keyvar> in <var>entryvar>.li>
25+
<li>Otherwise:
2426
<ol>
25-
<li>If the value of <var>keyvar> <a>entrya> in <var>objectvar> is not an <a>arraya>,
26-
set it to a new <a>arraya> containing the original value.li>
27-
<li>If <var>valuevar> is an <a>arraya>, concatenate <var>valuevar>
28-
to that <a>entrya>.li>
29-
<li>Otherwise, append <var>valuevar> to that <a>entrya>.li>
27+
<li>If <var>keyvar> is not an entry in <var>objectvar>,
28+
add <var>valuevar> as the value of <var>keyvar> in <var>objectvar>.li>
29+
<li>Otherwise
30+
<ol>
31+
<li>If the value of the <var>keyvar> <a>entrya> in <var>objectvar> is not an <a>arraya>,
32+
set it to a new <a>arraya> containing the original value.li>
33+
<li>Append <var>valuevar>
34+
to the value of the <var>keyvar> <a>entrya> in <var>objectvar>.li>
35+
ol>
36+
li>
3037
ol>
38+
li>
3139
ol>
3240
dd>
33-
<dt><dfn data-cite="JSON-LD11-FRAMING#dfn-expicit-inclusion-flag">explicit inclusion flagdfn>dt><dd>
41+
<dt><dfn data-cite="JSON-LD11-FRAMING#dfn-explicit-inclusion-flag">explicit inclusion flagdfn>dt><dd>
3442
A flag specifying that for <a>propertiesa> to be included in the output,
3543
they must be explicitly declared in the matching <a>framea>.dd>
3644
<dt><dfn data-cite="JSON-LD11-FRAMING#dfn-framing-state">framing statedfn>dt><dd>
@@ -70,7 +78,7 @@
7078
the <var>document relativevar> flag defaults to `false`,
7179
and the <var>vocabvar> flag defaults to `true`.
7280
<ol>
73-
<li>Return the result of using the <a href="#iri-expansion">IRI Expansion algorithma>,
81+
<li>Return the result of using the <a data-cite="JSON-LD11-API#iri-expansion">IRI Expansion algorithma>,
7482
passing <var>active contextvar>,
7583
<var>valuevar>,
7684
<var>local contextvar> (if supplied),
@@ -81,7 +89,7 @@
8189
dd>
8290
<dt><dfn data-cite="JSON-LD11-FRAMING#dfn-input-frame">input framedfn>dt><dd>
8391
The initial <a>Framea> provided to the framing algorithm.dd>
84-
<dt><dfn data-cite="JSON-LD11-API#dfn-json-ld-input">JSON-LD inputdfn>dt><dd>
92+
<dt><dfn data-cite="JSON-LD11-API#dfn-json-ld-input" class="preserve">JSON-LD inputdfn>dt><dd>
8593
The JSON-LD data structure that is provided as input to the algorithm.dd>
8694
<dt><dfn data-cite="JSON-LD11-API#dfn-json-ld-output">JSON-LD outputdfn>dt><dd>
8795
The JSON-LD data structure that is produced as output by the algorithm.dd>

common/common.js

Lines changed: 13 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -1,149 +1,32 @@
1-
/* globals omitTerms, respecConfig, $, require */
1+
/* globals require */
22
/* JSON-LD Working Group common spec JavaScript */
3-
// We should be able to remove terms that are not actually
4-
// referenced from the common definitions
5-
//
6-
// Add class "preserve" to a definition to ensure it is not removed.
7-
//
8-
// the termlist is in a block of class "termlist".
9-
const termNames = [] ;
10-
const termsReferencedByTerms = [] ;
11-
12-
function restrictReferences(utils, content) {
13-
const base = document.createElement("div");
14-
base.innerHTML = content;
15-
16-
// New new logic:
17-
//
18-
// 1. build a list of all term-internal references
19-
// 2. When ready to process, for each reference INTO the terms,
20-
// remove any terms they reference from the termNames array too.
21-
const noPreserve = base.querySelectorAll("dfn:not(.preserve)");
22-
for (const item of noPreserve) {
23-
const $t = $(item);
24-
const titles = $t.getDfnTitles();
25-
const n = $t.makeID("dfn", titles[0]);
26-
if (n) {
27-
termNames[n] = $t.parent();
28-
}
29-
}
30-
31-
const $container = $(".termlist", base) ;
32-
const containerID = $container.makeID("", "terms") ;
33-
return (base.innerHTML);
34-
}
353

4+
/*
5+
* Implement tabbed examples.
6+
*/
367
require(["core/pubsubhub"], (respecEvents) => {
378
"use strict";
389

39-
respecEvents.sub('end', (message) => {
10+
respecEvents.sub('end-all', (documentElement) => {
4011
// remove data-cite on where the citation is to ourselves.
41-
const selfDfns = document.querySelectorAll("dfn[data-cite^='" + respecConfig.shortName.toUpperCase() + "#']");
12+
const selfDfns = document.querySelectorAll("dfn[data-cite^='__SPEC__#']");
4213
for (const dfn of selfDfns) {
14+
const anchor = dfn.querySelector('a');
15+
if (anchor) {
16+
const anchorContent = anchor.textContent;
17+
dfn.removeChild(anchor);
18+
dfn.textContent = anchorContent;
19+
}
4320
delete dfn.dataset.cite;
4421
}
4522

4623
// Update data-cite references to ourselves.
47-
const selfRefs = document.querySelectorAll("a[data-cite^='" + respecConfig.shortName.toUpperCase() + "#']");
24+
const selfRefs = document.querySelectorAll("a[data-cite^='__SPEC__#']");
4825
for (const anchor of selfRefs) {
4926
anchor.href= anchor.dataset.cite.replace(/^.*#/,"#");
5027
delete anchor.dataset.cite;
5128
}
52-
});
5329

54-
// add a handler to come in after all the definitions are resolved
55-
//
56-
// New logic: If the reference is within a 'dl' element of
57-
// class 'termlist', and if the target of that reference is
58-
// also within a 'dl' element of class 'termlist', then
59-
// consider it an internal reference and ignore it.
60-
respecEvents.sub('end', (message) => {
61-
if (message === 'core/link-to-dfn') {
62-
// all definitions are linked; find any internal references
63-
const internalTerms = document.querySelectorAll(".termlist a.internalDFN");
64-
for (const item of internalTerms) {
65-
const idref = item.getAttribute('href').replace(/^#/,"") ;
66-
if (termNames[idref]) {
67-
// this is a reference to another term
68-
// what is the idref of THIS term?
69-
const def = item.closest('dd');
70-
if (def) {
71-
const tid = def.previousElementSibling
72-
.querySelector('dfn')
73-
.getAttribute('id');
74-
if (tid) {
75-
if (termsReferencedByTerms[tid] === undefined) termsReferencedByTerms[tid] = [];
76-
termsReferencedByTerms[tid].push(idref);
77-
}
78-
}
79-
}
80-
}
81-
82-
// clearRefs is recursive. Walk down the tree of
83-
// references to ensure that all references are resolved.
84-
const clearRefs = (theTerm) => {
85-
if (termsReferencedByTerms[theTerm] ) {
86-
for (const item of termsReferencedByTerms[theTerm]) {
87-
if (termNames[item]) {
88-
delete termNames[item];
89-
clearRefs(item);
90-
}
91-
}
92-
};
93-
// make sure this term doesn't get removed
94-
if (termNames[theTerm]) {
95-
delete termNames[theTerm];
96-
}
97-
};
98-
99-
// now termsReferencedByTerms has ALL terms that
100-
// reference other terms, and a list of the
101-
// terms that they reference
102-
const internalRefs = document.querySelectorAll("a[data-link-type='dfn']");
103-
for (const item of internalRefs) {
104-
const idref = item.getAttribute('href').replace(/^.*#/,"") ;
105-
// if the item is outside the term list
106-
if (!item.closest('dl.termlist')) {
107-
clearRefs(idref);
108-
}
109-
}
110-
111-
// delete any terms that were not referenced.
112-
for (const term in termNames) {
113-
const $p = $("#"+term);
114-
// Remove term definitions inside a dt, where data-cite does not start with shortname
115-
if ($p === undefined) { continue; }
116-
if (!$p.parent().is("dt")) { continue; }
117-
if (($p.data("cite") || "").toLowerCase().startsWith(respecConfig.shortName)) { continue; }
118-
119-
const $dt = $p.parent();
120-
const $dd = $dt.next();
121-
122-
// If the associated dd contains a dfn which is _not_ in termNames, warn
123-
if ($dd.children("dfn").length > 0) {
124-
console.log(term + " definition contains definitions " + $dd.children("dfn").attr("id"))
125-
}
126-
console.log("drop term " + term);
127-
const tList = $p.getDfnTitles();
128-
$dd.remove(); // remove dd
129-
$dt.remove(); // remove dt
130-
// FIXME: this depended on an undocumented internal structure
131-
//for (const item of tList) {
132-
// if (respecConfig.definitionMap[item]) {
133-
// delete respecConfig.definitionMap[item];
134-
// }
135-
//}
136-
}
137-
}
138-
});
139-
});
140-
141-
/*
142-
* Implement tabbed examples.
143-
*/
144-
require(["core/pubsubhub"], (respecEvents) => {
145-
"use strict";
146-
respecEvents.sub('end-all', (documentElement) => {
14730
// Add playground links
14831
for (const link of document.querySelectorAll("a.playground")) {
14932
let pre;

common/jsonld.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ const jsonld = {
5959
status: 'unofficial',
6060
date: '29 May 2015'
6161
},
62-
"JCS": {
62+
"RFC8785": {
6363
title: "JSON Canonicalization Scheme (JCS)",
64-
href: 'https://tools.ietf.org/html/draft-rundgren-json-canonicalization-scheme-17',
64+
href: 'https://www.rfc-editor.org/rfc/rfc8785',
6565
authors: ['A. Rundgren', 'B. Jordan', 'S. Erdtman'],
6666
publisher: 'Network Working Group',
67-
status: 'Internet-Draft',
68-
date: '20 January 2020'
67+
status: 'Informational',
68+
date: 'June 2020'
6969
},
7070
// These necessary as specref uses the wrong URLs
7171
"RFC7231": {

common/terms.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@
188188
An embedded <a>contexta> is a context which appears
189189
as the <code>@contextcode> <a>entrya> of one of the following:
190190
a <a>node objecta>, a <a>value objecta>, a <a>graph objecta>, a <a>list objecta>,
191-
a <a>set objecta>, the value of a <a>nested propertiesa>,
191+
a <a>set objecta>, the value of a <a>nested propertya>,
192192
or the value of an <a>expanded term definitiona>.
193193
Its value may be a <a>mapa> for a <a data-cite="JSON-LD11#dfn-context-definition">context definitiona>,
194194
as an <a>IRIa>, or as an <a>arraya> combining either of the above.
@@ -230,7 +230,7 @@
230230
Note that <a>node objectsa> may have a <code>@graphcode> <a>entrya>,
231231
but are not considered <a>graph objectsa> if they include any other <a>entriesa>.
232232
A top-level object consisting of <code>@graphcode> is also not a <a>graph objecta>.
233-
Note that a <a>node objecta> may also represent a <a>named grapha> it it includes other properties.
233+
Note that a <a>node objecta> may also represent a <a>named grapha> if it includes other properties.
234234
See the <a data-cite="JSON-LD11#graph-objects">Graph Objectsa> section of JSON-LD 1.1 for a normative description.
235235
dd>
236236
<dt class="changed"><dfn data-cite="JSON-LD11#dfn-id-map">id mapdfn>dt><dd class="changed">
@@ -302,7 +302,7 @@
302302
and normatively specified in the <a data-cite="JSON-LD11#keywords">Keywordsa> section of JSON-LD 1.1,
303303
dd>
304304
<dt><dfn data-cite="JSON-LD11#dfn-language-map">language mapdfn>dt><dd>
305-
An <a>language mapa> is a <a>mapa> value of a <a>terma>
305+
A <a>language mapa> is a <a>mapa> value of a <a>terma>
306306
defined with <code>@containercode> set to <code>@languagecode>,
307307
whose keys must be <a>stringsa> representing [[BCP47]] language codes
308308
and the values must be any of the following types:
@@ -391,11 +391,11 @@
391391
and a type,
392392
which is an <a>IRIa>.dd>
393393
<dt><dfn data-cite="JSON-LD11#dfn-value-object">value objectdfn>dt><dd>
394-
A <a>value objecta> is a <a>mapa> that has an <code>@valuecode> <a>entrya>.dd>
394+
A <a>value objecta> is a <a>mapa> that has an <code>@valuecode> <a>entrya>.
395+
See the <a data-cite="JSON-LD11#value-objects">Value Objectsa> section of JSON-LD 1.1 for a normative description.dd>
395396
<dt><dfn data-cite="JSON-LD11#dfn-vocabulary-mapping" class="preserve">vocabulary mappingdfn>dt><dd>
396397
The vocabulary mapping is set in the <a>contexta> using the <code>@vocabcode> key
397398
whose value must be an <a>IRIa>, a <a>compact IRIa>, a <a>terma>, or <code>nullcode>.
398-
See the <a data-cite="JSON-LD11#value-objects">Value Objectsa> section of JSON-LD 1.1 for a normative description.
399-
dd>
399+
See the <a data-cite="JSON-LD11#context-definitions">Context Definitionsa> section of JSON-LD 1.1 for a normative description.dd>
400400
dl>
401401
section>

common/typographical-conventions.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
A reference to a definition <em>in this documentem>
1616
is underlined and is also an active link to the definition itself. dd>
1717
<dt><a data-lt="definition"><code>markup definition referencecode>a>dt><dd>
18-
A references to a definition <em>in this documentem>,
18+
References to a definition <em>in this documentem>,
1919
when the reference itself is also a markup, is underlined,
2020
red-orange monospace font, and is also an active link to the definition itself.dd>
2121
<dt><a class="externalDFN">external definition referencea>dt><dd>

0 commit comments

Comments
 (0)