-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathindex.html
13892 lines (12938 loc) · 564 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<title>JSON-LD 1.1</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<script src="https://www.w3.org/Tools/respec/respec-w3c" class="remove" defer></script>
<script src="common/common.js" class="remove" defer></script>
<script src="common/jsonld.js" class="remove"></script>
<script class="remove">
var respecConfig = {
// extend the bibliography entries
localBiblio: jsonld.localBiblio,
// specification status (e.g. WD, LCWD, NOTE, etc.). If in doubt use ED.
specStatus: "ED",
// if you wish the publication date to be other than today, set this
//publishDate: "2018-09-11",
copyrightStart: "2010",
// the specification's short name, as in http://www.w3.org/TR/short-name/
shortName: "json-ld11",
subtitle: "A JSON-based Serialization for Linked Data",
// if there is a previously published draft, uncomment this and set its YYYY-MM-DD date
// and its maturity status
prevVersion: "https://www.w3.org/TR/2020/PR-json-ld11-20200507/",
previousPublishDate: "2020-05-07",
previousMaturity: "PR",
prevRecURI: "https://www.w3.org/TR/2014/REC-json-ld-20140116/",
errata: "https://w3c.github.io/json-ld-syntax/errata/",
github: {
repoURL: "https://github.com/w3c/json-ld-syntax/",
branch: "main"
},
// if there a publicly available Editor's Draft, this is the link
edDraftURI: "https://w3c.github.io/json-ld-syntax/",
testSuiteURI: "https://w3c.github.io/json-ld-api/tests/",
implementationReportURI:"https://w3c.github.io/json-ld-api/reports/",
crEnd: "2020-04-03",
prEnd: "2020-06-18",
includePermalinks: true,
doJsonLd: true,
pluralize: true,
// Cross-reference definitions
xref: ["json-ld11", "json-ld11-api", "json-ld11-framing"],
// if you want to have extra CSS, append them to this list
// it is recommended that the respec.css stylesheet be kept
// extraCSS: [],
// editors, add as many as you like
// only "name" is required
editors: [
{ name: "Gregg Kellogg",
url: "https://greggkellogg.net/",
w3cid: "44770",
note: "v1.0 and v1.1" },
{ name: "Pierre-Antoine Champin",
url: "http://champin.net/",
company: "LIRIS - Université de Lyon",
companyURL: "https://liris.cnrs.fr/",
w3cid: "42931",
note: "v1.1" },
{ name: "Dave Longley",
url: "https://digitalbazaar.com/author/dlongley/",
w3cid: "48025",
company: "Digital Bazaar",
companyURL: "https://digitalbazaar.com/",
note: "v1.1" }
],
// editors, add as many as you like
// only "name" is required
formerEditors: [
{ name: "Manu Sporny",
url: "http://manu.sporny.org/",
company: "Digital Bazaar",
companyURL: "https://digitalbazaar.com/",
note: "v1.0" },
{ name: "Markus Lanthaler",
url: "https://www.markus-lanthaler.com/",
company: "Google",
companyURL: "https://www.google.com/",
note: "v1.0" }
],
// authors, add as many as you like.
// This is optional, uncomment if you have authors as well as editors.
// only "name" is required. Same format as editors.
authors: [
{ name: "Manu Sporny",
url: "http://manu.sporny.org/",
company: "Digital Bazaar",
companyURL: "https://digitalbazaar.com/",
note: "v1.0" },
{ name: "Dave Longley",
url: "https://digitalbazaar.com/author/dlongley/",
company: "Digital Bazaar",
companyURL: "https://digitalbazaar.com/",
note: "v1.0 and v1.1" },
{ name: "Gregg Kellogg",
url: "https://greggkellogg.net/",
w3cid: "44770",
note: "v1.0 and v1.1" },
{ name: "Markus Lanthaler",
url: "https://www.markus-lanthaler.com/",
company: "Google",
companyURL: "https://www.google.com/",
note: "v1.0" },
{ name: "Pierre-Antoine Champin",
url: "http://champin.net/",
company: "LIRIS - Université de Lyon",
companyURL: "https://liris.cnrs.fr/",
w3cid: "42931",
note: "v1.1" },
{ name: "Niklas Lindström",
url: "http://neverspace.net/",
note: "v1.0" }
],
group: "wg/json-ld",
wgPublicList: "public-json-ld-wg",
maxTocLevel: 4,
alternateFormats: [ {uri: "json-ld11.epub", label: "EPUB"} ]
};
</script>
<script>
document.addEventListener("DOMContentLoaded", () => {
// Add example button selection logic
for (const button of document.querySelectorAll(".ds-selector-tabs .selectors button")) {
button.onclick = () => {
const ex = button.closest(".ds-selector-tabs");
ex.querySelector("button.selected").classList.remove("selected");
ex.querySelector(".selected").classList.remove("selected");
button.classList.add('selected');
ex.querySelector("." + button.dataset.selects).classList.add("selected");
}
}
// Toggle show/hide changes
for (const elem of document.querySelectorAll(".show-changes")) {
elem.onclick = () => {
if (elem.classList.contains("selected")) {
// Remove highlight class from elements having "changed" class
elem.classList.remove("selected");
for (const changed of document.querySelectorAll(".changed")) {
changed.classList.remove("highlight");
}
} else {
// Add highlight class to elements having "changed" class
elem.classList.add("selected");
for (const changed of document.querySelectorAll(".changed")) {
changed.classList.add("highlight");
}
}
}
}
});
</script>
<style>
.hl-bold { font-weight: bold; color: #0a3; }
.comment { color: #999; }
table, thead, tr, td { padding: 5px; border-width: 1px; border-spacing: 0px; border-style: solid; border-collapse: collapse; }
table.example {width: 100%;}
.example > pre.context:before {
content: "Context";
float: right;
font: x-large Arial, sans-serif;
color: gray;
border: solid thin black;
padding: 0.2em;
}
.example > pre.frame:before {
content: "Frame";
float: right;
font: x-large Arial, sans-serif;
color: gray;
border: solid thin black;
padding: 0.2em;
}
.example > pre.input:before {
content: "Input";
float: right;
font: x-large Arial, sans-serif;
color: gray;
border: solid thin black;
padding: 0.2em;
}
.example > pre.result:before {
content: "Result";
float: right;
font: x-large Arial, sans-serif;
color: gray;
border: solid thin black;
padding: 0.2em;
}
.example > pre.turtle:before {
content: "Turtle";
float: right;
font: x-large Arial, sans-serif;
color: gray;
border: solid thin black;
padding: 0.2em;
}
.highlight.changed, .show-changes {
background-color: lime;
}
.show-changes.selected:before {
content: "de-highlight";
}
.show-changes:before {
content: "highlight";
}
aside.example {
overflow-y: hidden;
}
/* example tab selection */
.ds-selector-tabs {
padding-bottom: 2em;
}
.ds-selector-tabs .selectors {
padding: 0;
border-bottom: 1px solid #ccc;
height: 28px;
}
.ds-selector-tabs .selectors button {
display: inline-block;
min-width: 54px;
text-align: center;
font-size: 11px;
font-weight: bold;
height: 27px;
padding: 0 8px;
line-height: 27px;
transition: all,0.218s;
border-top-right-radius: 2px;
border-top-left-radius: 2px;
color: #666;
border: 1px solid transparent;
}
.ds-selector-tabs .selectors button:first-child {
margin-left: 2px;
}
.ds-selector-tabs .selectors button.selected {
color: #202020 !important;
border: 1px solid #ccc;
border-bottom: 1px solid #fff !important;
}
.ds-selector-tabs .selectors button:hover {
background-color: transparent;
color: #202020;
cursor: pointer;
}
.ds-selector-tabs pre:not(.preserve), .ds-selector-tabs table:not(.preserve) {
display: none;
}
.ds-selector-tabs pre.selected, .ds-selector-tabs table.selected {
display: block;
}
a.playground {
display: inline-block;
width: 150px;
border: 1px solid transparent;
border-top-right-radius: 2px;
border-top-left-radius: 2px;
background-color: rgb(192, 192, 192);
text-decoration: none;
font-size: 13px;
margin-bottom: 10px;
}
a[href].playground {
padding: 4px 0 3px 8px;
border-bottom: none;
text-decoration: none;
color: #666;
}
</style>
</head>
<body>
<section id="abstract">
<p>JSON is a useful data serialization and messaging format.
This specification defines JSON-LD 1.1, a JSON-based format to serialize
Linked Data. The syntax is designed to easily integrate into deployed
systems that already use JSON, and provides a smooth upgrade path from
JSON to JSON-LD.
It is primarily intended to be a way to use Linked Data in Web-based
programming environments, to build interoperable Web services, and to
store Linked Data in JSON-based storage engines.</p>
<p>This specification describes a superset of the features defined in
[[[JSON-LD10]]] [[JSON-LD10]]
and, except where noted,
documents created using the 1.0 version of this specification remain compatible with JSON-LD 1.1.</p>
</section>
<section id="sotd">
<p>This document has been developed by the
<a href="https://www.w3.org/2018/json-ld-wg/">JSON-LD Working Group</a> and was derived from the <a href="https://www.w3.org/community/json-ld/">JSON-LD Community Group's</a> <a href="https://www.w3.org/2018/jsonld-cg-reports/json-ld/">Final Report</a>.</p>
<p>There is a
<a href="https://json-ld.org/playground/">live JSON-LD playground</a> that is capable
of demonstrating the features described in this document.</p>
<p>This specification is intended to <a href='https://www.w3.org/2019/Process-20190301/#rec-rescind'>supersede</a> the [[[JSON-LD10]]] [[JSON-LD10]] specification. </p>
<section>
<h2>Set of Documents</h2>
<p>This document is one of three JSON-LD 1.1 Recommendations produced by the
<a href="https://www.w3.org/2018/json-ld-wg/">JSON-LD Working Group</a>:</p>
<ul>
<li><a href="">JSON-LD 1.1</a></li>
<li>[[[JSON-LD11-API]]]</li>
<li>[[[JSON-LD11-FRAMING]]]</li>
</ul>
</section>
</section>
<section class="informative">
<h1>Introduction</h1>
<p>Linked Data [[LINKED-DATA]] is a way to create a network of
standards-based machine interpretable data across different documents and
Web sites. It allows an application to start at one piece of Linked Data,
and follow embedded links to other pieces of Linked Data that are hosted on
different sites across the Web.</p>
<p>JSON-LD is a lightweight syntax to serialize Linked Data in
JSON [[RFC8259]]. Its design allows existing JSON to be interpreted as
Linked Data with minimal changes. JSON-LD is primarily intended to be a
way to use Linked Data in Web-based programming environments, to build
interoperable Web services, and to store Linked Data in JSON-based storage engines. Since
JSON-LD is 100% compatible with JSON, the large number of JSON parsers and libraries
available today can be reused. In addition to all the features JSON provides,
JSON-LD introduces:</p>
<ul>
<li>a universal identifier mechanism for <a>JSON objects</a>
via the use of <a>IRIs</a>,</li>
<li>a way to disambiguate keys shared among different JSON documents by mapping
them to <a>IRIs</a> via a <a>context</a>,</li>
<li>a mechanism in which a value in a <a>JSON object</a> may refer
to a <a>resource</a> on a different site on the Web,</li>
<li>the ability to annotate <a>strings</a> with their language,</li>
<li>a way to associate datatypes with values such as dates and times,</li>
<li>and a facility to express one or more directed graphs, such as a social
network, in a single document.</li>
</ul>
<p>JSON-LD is designed to be usable directly as JSON, with no knowledge of RDF
[[RDF11-CONCEPTS]]. It is also designed to be usable as RDF
in conjunction with other Linked Data technologies like SPARQL [[SPARQL11-OVERVIEW]].
Developers who
require any of the facilities listed above or need to serialize an <a>RDF graph</a>
or <a>Dataset</a> in a JSON-based syntax will find JSON-LD of interest. People
intending to use JSON-LD with RDF tools will find it can be used as another
RDF syntax, as with [[Turtle]] and [[TriG]]. Complete details of how JSON-LD relates
to RDF are in section <a href="#relationship-to-rdf"></a>.
</p>
<p>The syntax is designed to not disturb already
deployed systems running on JSON, but provide a smooth upgrade path from
JSON to JSON-LD. Since the shape of such data varies wildly, JSON-LD
features mechanisms to reshape documents into a deterministic structure
which simplifies their processing.</p>
<section class="informative">
<h2>How to Read this Document</h2>
<p>This document is a detailed specification for a serialization of Linked
Data in JSON. The document is primarily intended for the following audiences:</p>
<ul>
<li>Software developers who want to encode Linked Data in a variety of
programming languages that can use JSON</li>
<li>Software developers who want to convert existing JSON to JSON-LD</li>
<li>Software developers who want to understand the design decisions and
language syntax for JSON-LD</li>
<li>Software developers who want to implement processors and APIs for
JSON-LD</li>
<li>Software developers who want to generate or consume Linked Data,
an <a>RDF graph</a>, or an <a>RDF Dataset</a> in a JSON syntax</li>
</ul>
<p>A companion document, the JSON-LD 1.1 Processing Algorithms and API specification
[[JSON-LD11-API]], specifies how to work with JSON-LD at a higher level by
providing a standard library interface for common JSON-LD operations.</p>
<p>To understand the basics in this specification you must first be familiar with
<a data-cite="RFC8259" data-no-xref="">JSON</a>, which is detailed in [[RFC8259]].</p>
<p>This document almost exclusively uses the term IRI
(<a data-cite="ld-glossary#internationalized-resource-identifier">Internationalized Resource Indicator</a>)
when discussing hyperlinks. Many Web developers are more familiar with the
URL (<a data-cite="ld-glossary#uniform-resource-locator">Uniform Resource Locator</a>)
terminology. The document also uses, albeit rarely, the URI
(<a data-cite="ld-glossary#uniform-resource-identifier">Uniform Resource Indicator</a>)
terminology. While these terms are often used interchangeably among
technical communities, they do have important distinctions from one
another and the specification goes to great lengths to try and use the
proper terminology at all times.</p>
<p>This document can highlight changes since the [[[JSON-LD10]]] version.
Select to <button class="show-changes"></button> changes.</p>
</section>
<section class="informative">
<h2>Contributing</h2>
<p>There are a number of ways that one may participate in the development of
this specification:</p>
<ul>
<li>Technical discussion typically occurs on the working group mailing list:
<a href="https://lists.w3.org/Archives/Public/public-json-ld-wg/">public-json-ld-wg@w3.org</a></li>
<li>The working group uses <a href="https://irc.w3.org/?channels=json-ld">#json-ld</a>
IRC channel is available for real-time discussion on <a href="https://irc.w3.org">irc.w3.org</a>.</li>
<li>The <a href="https://webchat.freenode.net/?channels=json-ld">#json-ld</a>
IRC channel is also available for real-time discussion on irc.freenode.net.</li>
</ul>
</section>
<section class="informative">
<h2>Typographical conventions</h2>
<div data-include="common/typographical-conventions.html"></div>
</section>
<section class="informative">
<h2>Terminology</h2>
<p>This document uses the following terms as defined in external specifications
and defines terms specific to JSON-LD.</p>
<div data-include="common/terms.html"></div>
</section>
<section class="informative">
<h2>Design Goals and Rationale</h2>
<p>JSON-LD satisfies the following design goals:</p>
<dl>
<dt>Simplicity</dt>
<dd>No extra processors or software libraries are necessary to use JSON-LD
in its most basic form. The language provides developers with a very easy
learning curve. Developers not concerned with Linked Data only need to understand JSON,
and know to include but ignore the <code>@context</code> property,
to use the basic functionality in JSON-LD.</dd>
<dt>Compatibility</dt>
<dd>A JSON-LD document is always a valid JSON document. This ensures that
all of the standard JSON libraries work seamlessly with JSON-LD documents.</dd>
<dt>Expressiveness</dt>
<dd>The syntax serializes labeled directed graphs. This ensures that almost
every real world data model can be expressed.</dd>
<dt>Terseness</dt>
<dd>The JSON-LD syntax is very terse and human readable, requiring as
little effort as possible from the developer.</dd>
<dt>Zero Edits, most of the time</dt>
<dd>JSON-LD ensures a smooth and simple transition from existing
JSON-based systems. In many cases,
zero edits to the JSON document and the addition of one line to the HTTP response
should suffice (see <a class="sectionRef" href="#interpreting-json-as-json-ld"></a>).
This allows organizations that have
already deployed large JSON-based infrastructure to use JSON-LD's features
in a way that is not disruptive to their day-to-day operations and is
transparent to their current customers. However, there are times where
mapping JSON to a graph representation is a complex undertaking.
In these instances, rather than extending JSON-LD to support
esoteric use cases, we chose not to support the use case. While Zero
Edits is a design goal, it is not always possible without adding
great complexity to the language. JSON-LD focuses on simplicity when
possible.</dd>
<dt>Usable as RDF</dt>
<dd>JSON-LD is usable by developers as
idiomatic JSON, with no need to understand RDF [[RDF11-CONCEPTS]].
JSON-LD is also usable as RDF, so people intending to use JSON-LD
with RDF tools will find it can be used like any other RDF syntax.
Complete details of how JSON-LD relates to RDF are in section
<a href="#relationship-to-rdf"></a>.</dd>
</dl>
</section>
<section class="informative">
<h2>Data Model Overview</h2>
<p>Generally speaking, the data model described by a <a>JSON-LD document</a> is a labeled, directed <a>graph</a>.
The graph contains <a>nodes</a>, which are connected by directed-arcs.
A node is either a <a>resource</a> with <a>properties</a>, or the data values of those properties including
<a>strings</a>, <a>numbers</a>, <a>typed values</a> (like dates and times) and <a>IRIs</a>.</p>
<p class="changed">Within a directed graph, nodes are <a>resources</a>, and may
be <em>unnamed</em>, i.e., not identified by an <a>IRI</a>;
which are called <a>blank nodes</a>,
and may be identified using a <a>blank node identifier</a>.
These identifiers may be required to represent a fully connected graph
using a tree structure, such as JSON, but otherwise have no
intrinsic meaning.
Literal values, such as <a>strings</a> and <a>numbers</a>, are also considered <a>resources</a>,
and JSON-LD distinguishes between <a>node objects</a> and <a>value objects</a> to distinguish between the different
kinds of <a>resources</a>.</p>
<p>This simple data model is incredibly
flexible and powerful, capable of modeling almost any kind of
data. For a deeper explanation of the data model, see
section <a href="#data-model"></a>.</p>
<p>Developers who are familiar with Linked Data technologies will
recognize the data model as the RDF Data Model. To dive deeper into how
JSON-LD and RDF are related, see
section <a href="#relationship-to-rdf"></a>.</p>
<p>At the surface level, a <a>JSON-LD document</a> is simply
<a data-cite="RFC8259" data-no-xref="">JSON</a>, detailed in [[RFC8259]].
For the purpose of describing the core data structures,
this is limited to <a>arrays</a>, <a>maps</a> (the parsed version of a <a>JSON Object</a>),
<a>strings</a>, <a>numbers</a>, <a>booleans</a>, and <a>null</a>,
<span class="changed">called the <a>JSON-LD internal representation</a>.
This allows surface syntaxes other than JSON
to be manipulated using the same algorithms, when the syntax maps
to equivalent core data structures</span>.</p>
<p class="changed note">Although not discussed in this specification,
parallel work using [[[YAML]]] [[YAML]]
and binary representations such as [[[RFC7049]]] [[RFC7049]]
could be used to map into the <a>internal representation</a>, allowing
the JSON-LD 1.1 API [[JSON-LD11-API]] to operate as if the source was a
JSON document.</p>
</section>
<section class="informative">
<h2>Syntax Tokens and Keywords</h2>
<p>JSON-LD specifies a number of syntax tokens and <a>keywords</a>
that are a core part of the language.
A normative description of the <a>keywords</a> is given in <a class="sectionRef" href="#keywords"></a>.
</p>
<dl data-sort>
<dt><code>@context</code></dt>
<dd>Used to define the short-hand names that are used throughout a JSON-LD
document. These short-hand names are called <a>terms</a> and help
developers to express specific identifiers in a compact manner. The
<code>@context</code> keyword is described in detail in
<a class="sectionRef" href="#the-context"></a>.</dd>
<dt class="changed"><code>@direction</code></dt>
<dd class="changed">Used to set the <a>base direction</a> of a <a>JSON-LD value</a>,
which are not <a>typed values</a> (e.g. <a>strings</a>, or <a>language-tagged strings</a>).
This keyword is described in
<a class="sectionRef" href="#string-internationalization"></a>.</dd>
<dt><code>@id</code></dt>
<dd>Used to uniquely identify <a>node objects</a> that are being described in the document
with <a>IRIs</a> or
<a>blank node identifiers</a>. This keyword
is described in <a class="sectionRef" href="#node-identifiers"></a>.
A <a>node reference</a> is a <a>node object</a> containing only the `@id` property,
which may represent a reference to a <a>node object</a> found elsewhere in the document.</dd>
<dt><code>@value</code></dt>
<dd>Used to specify the data that is associated with a particular
<a>property</a> in the graph. This keyword is described in
<a class="sectionRef" href="#string-internationalization"></a> and
<a class="sectionRef" href="#typed-values"></a>.</dd>
<dt><code>@language</code></dt>
<dd>Used to specify the language for a particular string value or the default
language of a JSON-LD document. This keyword is described in
<a class="sectionRef" href="#string-internationalization"></a>.</dd>
<dt><code>@type</code></dt>
<dd>Used to set the type of a <a>node</a> or the datatype of a <a>typed value</a>.
This keyword is described further in <a class="sectionRef" href="#specifying-the-type"></a>
and <a class="sectionRef" href="#typed-values"></a>.
<div class="note">The use of <code>@type</code> to define a type for both
<a>node objects</a> and <a>value objects</a> addresses the basic need to type data,
be it a literal value or a more complicated resource.
Experts may find the overloaded use of the <code>@type</code> keyword for both purposes concerning,
but should note that Web developer usage of this feature over multiple years
has not resulted in its misuse due to the far less frequent use of <code>@type</code>
to express typed literal values.
</div>
</dd>
<dt><code>@container</code></dt>
<dd>Used to set the default container type for a <a>term</a>.
This keyword is described in the following sections:
<ul>
<li><a class="sectionRef" href="#sets-and-lists"></a>,</li>
<li><a class="sectionRef" href="#data-indexing"></a>,</li>
<li><a class="sectionRef" href="#language-indexing"></a>,</li>
<li class="changed"><a class="sectionRef" href="#node-identifier-indexing"></a>,</li>
<li class="changed"><a class="sectionRef" href="#node-type-indexing"></a></li>
<li class="changed"><a class="sectionRef" href="#named-graphs"></a>,</li>
<li class="changed"><a class="sectionRef" href="#named-graph-indexing"></a>, and</li>
<li class="changed"><a class="sectionRef" href="#named-graph-data-indexing"></a></li>
</ul></dd>
<dt><code>@list</code></dt>
<dd>Used to express an ordered set of data.
This keyword is described in <a class="sectionRef" href="#lists"></a>.</dd>
<dt><code>@set</code></dt>
<dd>Used to express an unordered set of data and to ensure that values are always
represented as arrays. This keyword is described in
<a class="sectionRef" href="#sets"></a>.</dd>
<dt><code>@reverse</code></dt>
<dd>Used to express reverse properties. This keyword is described in
<a class="sectionRef" href="#reverse-properties"></a>.</dd>
<dt><code>@index</code></dt>
<dd>Used to specify that a container is used to index information and
that processing should continue deeper into a JSON data structure.
This keyword is described in <a class="sectionRef" href="#data-indexing"></a>.</dd>
<dt><code>@base</code></dt>
<dd>Used to set the <a>base IRI</a> against which to resolve those <a>relative IRI references</a>
which are otherwise interpreted relative to the document.
This keyword is described in <a class="sectionRef" href="#base-iri"></a>.</dd>
<dt><code>@vocab</code></dt>
<dd>Used to expand properties and values in <code>@type</code> with a common prefix
<a>IRI</a>. This keyword is described in <a class="sectionRef" href="#default-vocabulary"></a>.</dd>
<dt><code>@graph</code></dt><dd>Used to express a <a>graph</a>.
This keyword is described in <a class="sectionRef" href="#named-graphs"></a>.</dd>
<dt class="changed"><code>@nest</code></dt><dd class="changed">Used to define a <a>property</a> of a <a>node object</a> that groups together properties of that node, but is not an edge in the graph.</dd>
<dt class="changed"><code>@none</code></dt><dd class="changed">Used as an index value
in an <a>index map</a>, <a>id map</a>, <a>language map</a>, <a>type map</a>, or elsewhere where a <a>map</a> is
used to index into other values, when the indexed node does not have the feature being indexed.</dd>
<dt class="changed"><code>@prefix</code></dt><dd class="changed">
With the value <code>true</code>, allows this <a>term</a> to be used to construct a <a>compact IRI</a>
when compacting.
With the value `false` prevents the term from being used to construct a <a>compact IRI</a>.
Also determines if the term will be considered when expanding <a>compact IRIs</a>.</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 [[[JSON-LD10]]] [[JSON-LD10]] described in this specification are
not available when <a>processing mode</a> has been explicitly set to
`json-ld-1.0`.
<div class="note">Within a <a>context definition</a> `@version` takes the specific value `1.1`, not
`"json-ld-1.1"`, as a JSON-LD 1.0 processor may accept a string value for `@version`,
but will reject a numeric value.</div>
<div class="note">The use of `1.1` for the value of `@version` is intended to
cause a JSON-LD 1.0 processor to stop processing.
Although it is clearly meant to be related to JSON-LD 1.1, it does not
otherwise adhere to the requirements for <a href="https://semver.org/">Semantic Versioning</a>.</div>
</dd>
<dt class="changed"><code>@json</code></dt><dd class="changed">
Used as the <code>@type</code> value of a <a>JSON literal</a>.
This keyword is described in <a href="#json-literals" class="sectionRef"></a>.
</dd>
<dt class="changed"><code>:</code></dt><dd class="changed">
The separator for JSON keys and values that use <a>compact IRIs</a>.</dd>
<dt class="changed">`@propagate`</dt><dd class="changed">
Used in a <a>context definition</a> to change the scope of that context.
By default, it is `true`,
meaning that contexts propagate across <a>node objects</a>
(other than for <a>type-scoped contexts</a>, which default to `false`).
Setting this to `false` causes term definitions created within that context
to be removed when entering a new <a>node object</a>.</dd>
<dt class="changed">`@protected`</dt><dd class="changed">
Used to prevent <a>term definitions</a> of a context to be overridden by other contexts.
This keyword is described in <a class="sectionRef" href="#protected-term-definitions"></a>.
<dt class="changed">`@import`</dt><dd class="changed">
Used in a <a>context definition</a> to load an external context
within which the containing <a>context definition</a> is merged.
This can be useful to add JSON-LD 1.1 features to JSON-LD 1.0 contexts.</dd>
<dt class="changed">`@included`</dt><dd class="changed">
Used in a top-level <a>node object</a> to define an <a>included block</a>,
for including secondary <a>node objects</a> within another <a>node object</a>.
</dd>
</dl>
<p>All keys, <a>keywords</a>, and values in JSON-LD are case-sensitive.</p>
</section>
</section>
<section id="conformance">
<p>A <a>JSON-LD document</a> complies with this specification if it follows
the normative statements in appendix <a href="#json-ld-grammar"></a>. JSON documents
can be interpreted as JSON-LD by following the normative statements in
<a class="sectionRef" href="#interpreting-json-as-json-ld"></a>. For convenience, normative
statements for documents are often phrased as statements on the properties of the document.</p>
<p>This specification makes use of the following namespace prefixes:</p>
<table class="simple">
<thead><tr>
<th>Prefix</th>
<th>IRI</th>
</tr></thead>
<tbody>
<tr>
<td>dc11</td>
<td>http://purl.org/dc/elements/1.1/</td>
</tr>
<tr>
<td>dcterms</td>
<td>http://purl.org/dc/terms/</td>
</tr>
<tr>
<td>cred</td>
<td>https://w3id.org/credentials#</td>
</tr>
<tr>
<td>foaf</td>
<td>http://xmlns.com/foaf/0.1/</td>
</tr>
<tr>
<td>geojson</td>
<td>https://purl.org/geojson/vocab#</td>
</tr>
<tr>
<td>prov</td>
<td>http://www.w3.org/ns/prov#</td>
</tr>
<tr>
<td>i18n</td>
<td>https://www.w3.org/ns/i18n#</td>
</tr>
<tr>
<td>rdf</td>
<td>http://www.w3.org/1999/02/22-rdf-syntax-ns#</td>
</tr>
<tr>
<td>schema</td>
<td>http://schema.org/</td>
</tr>
<tr>
<td>skos</td>
<td>http://www.w3.org/2004/02/skos/core#</td>
</tr>
<tr>
<td>xsd</td>
<td>http://www.w3.org/2001/XMLSchema#</td>
</tr>
</tbody>
</table>
<p>These are used within this document as part of a <a>compact IRI</a>
as a shorthand for the resulting <a>IRI</a>, such as <code>dcterms:title</code>
used to represent <code>http://purl.org/dc/terms/title</code>.</p>
</section>
<section class="informative">
<h1>Basic Concepts</h1>
<p>JSON [[RFC8259]] is a lightweight, language-independent data interchange format.
It is easy to parse and easy to generate. However, it is difficult to integrate JSON
from different sources as the data may contain keys that conflict with other
data sources. Furthermore, JSON has no
built-in support for hyperlinks, which are a fundamental building block on
the Web. Let's start by looking at an example that we will be using for the
rest of this section:</p>
<pre class="example" data-transform="updateExample"
title="Sample JSON document">
<!--
{
"name": "Manu Sporny",
"homepage": "http://manu.sporny.org/",
"image": "http://manu.sporny.org/images/manu.png"
}
-->
</pre>
<p>It's obvious to humans that the data is about a person whose
<code>name</code> is "Manu Sporny"
and that the <code>homepage</code> property contains the URL of that person's homepage.
A machine doesn't have such an intuitive understanding and sometimes,
even for humans, it is difficult to resolve ambiguities in such representations. This problem
can be solved by using unambiguous identifiers to denote the different concepts instead of
tokens such as "name", "homepage", etc.</p>
<p>Linked Data, and the Web in general, uses <a>IRIs</a>
(<a data-cite="RFC3987#section-2">Internationalized Resource Identifiers</a> as described in [[RFC3987]]) for unambiguous
identification. The idea is to use <a>IRIs</a>
to assign unambiguous identifiers to data that may be of use to other developers.
It is useful for <a>terms</a>,
like <code>name</code> and <code>homepage</code>, to expand to <a>IRIs</a>
so that developers don't accidentally step on each other's terms. Furthermore, developers and
machines are able to use this <a>IRI</a> (by using a web browser, for instance) to go to
the term and get a definition of what the term means. This process is known as <a>IRI</a>
dereferencing.</p>
<p>Leveraging the popular <a href="http://schema.org/">schema.org vocabulary</a>,
the example above could be unambiguously expressed as follows:</p>
<aside class="example ds-selector-tabs"
title="Sample JSON-LD document using full IRIs instead of terms">
<div class="selectors">
<button class="selected" data-selects="expanded">Expanded (Input)</button>
<button data-selects="statements">Statements</button>
<button data-selects="turtle">Turtle (Result)</button>
<a class="playground" target="_blank" href="">PG</a>
</div>
<pre class="expanded input selected nohighlight" data-transform="updateExample">
<!--
{
"****http://schema.org/name****": "Manu Sporny",
"****http://schema.org/url****": ****{
"@id": ****"http://manu.sporny.org/"
####↑ The '@id' keyword means 'This value is an identifier that is an IRI'####
****}****,
"****http://schema.org/image****": ****{
"@id": ****"http://manu.sporny.org/images/manu.png"
****}****
}
-->
</pre>
<table class="statements"
data-result-for="Sample JSON-LD document using full IRIs instead of terms-expanded"
data-to-rdf>
<thead><tr><th>Subject</th><th>Property</th><th>Value</th></tr></thead>
<tbody>
<tr><td>_:b0</td><td>schema:image</td><td>http://manu.sporny.org/images/manu.png</td></tr>
<tr><td>_:b0</td><td>schema:name</td><td>Manu Sporny</td></tr>
<tr><td>_:b0</td><td>schema:url</td><td>http://manu.sporny.org/</td></tr>
</tbody>
</table>
<pre class="turtle"
data-content-type="text/turtle"
data-result-for="Sample JSON-LD document using full IRIs instead of terms-expanded"
data-transform="updateExample"
data-to-rdf>
<!--
@prefix schema: <http://schema.org/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
[
schema:image <http://manu.sporny.org/images/manu.png>;
schema:name "Manu Sporny";
schema:url <http://manu.sporny.org/>
] .
-->
</pre>
</aside>
<p>In the example above, every property is unambiguously identified by an <a>IRI</a> and all values
representing <a>IRIs</a> are explicitly marked as such by the
<code>@id</code> <a>keyword</a>. While this is a valid JSON-LD
document that is very specific about its data, the document is also overly verbose and difficult
to work with for human developers. To address this issue, JSON-LD introduces the notion
of a <a>context</a> as described in the next section.</p>
<p>This section only covers the most basic features of JSON-LD. More advanced features,
including <a>typed values</a>, <a href="#indexed-values">indexed values</a>, and <a>named graphs</a>,
can be found in <a class="sectionRef" href="#advanced-concepts"></a>.</p>
<section class="informative">
<h2>The Context</h2>
<p>When two people communicate with one another, the conversation takes
place in a shared environment, typically called
"the context of the conversation". This shared context allows the
individuals to use shortcut terms, like the first name of a mutual friend,
to communicate more quickly but without losing accuracy. A context in
JSON-LD works in the same way. It allows two applications to use shortcut
terms to communicate with one another more efficiently, but without
losing accuracy.</p>
<p>Simply speaking, a <a>context</a> is used to map <a>terms</a> to <a>IRIs</a>.
<a>Terms</a> are case sensitive and most valid <a>strings</a> that are not reserved JSON-LD <a>keywords</a>
can be used as a <a>term</a>.
<span class="changed">Exceptions are the empty string `""` and strings that have the form
of a keyword (i.e., starting with `"@"` followed exclusively by one or more <em>ALPHA</em> characters (see [[RFC5234]])), which must not be used as terms.
Strings that have the form of
an <a>IRI</a> (e.g., containing a `":"`) should not be used as terms.</span></p>
<p>For the sample document in the previous section, a <a>context</a> would
look something like this:</p>
<pre class="example context nohighlight" data-transform="updateExample"
data-context-for="Sample JSON document"
title="Context for the sample document in the previous section">
<!--
{
****"@context": {
"name": "http://schema.org/name",****
####↑ This means that 'name' is shorthand for 'http://schema.org/name'####
****"image": {
"@id": "http://schema.org/image",****
####↑ This means that 'image' is shorthand for 'http://schema.org/image'####
****"@type": "@id"****
####↑ This means that a string value associated with 'image'
should be interpreted as an identifier that is an IRI####
****},
"homepage": {
"@id": "http://schema.org/url",****
####↑ This means that 'homepage' is shorthand for 'http://schema.org/url'####
****"@type": "@id"****
####↑ This means that a string value associated with 'homepage'
should be interpreted as an identifier that is an IRI#### ****
}
}****
}
-->
</pre>
<p>As the <a>context</a> above shows, the value of a <a>term definition</a> can
either be a simple string, mapping the <a>term</a> to an <a>IRI</a>,
or a <a>map</a>.</p>
<p>A <a>context</a> is introduced using an <a>entry</a> with the key <code>@context</code> and may
appear within a <a>node object</a> or a <a>value object</a>.</p>
<p>When an <a>entry</a> with a <a>term</a> key has a <a>map</a> value, the <a>map</a> is called
an <a>expanded term definition</a>. The example above specifies that
the values of <code>image</code> and <code>homepage</code>, if they are
strings, are to be interpreted as
<a>IRIs</a>. <a>Expanded term definitions</a>
also allow terms to be used for <a href="#data-indexing">index maps</a>
and to specify whether <a>array</a> values are to be
interpreted as <a href="#sets">sets</a> or <a href="#lists">lists</a>.
<a>Expanded term definitions</a> may
be defined using <a>IRIs</a> or
<a>compact IRIs</a> as keys, which is
mainly used to associate type or language information with an
<a>IRIs</a> or <a>compact IRI</a>.</p>
<p><a>Contexts</a> can either be directly embedded
into the document (an <a>embedded context</a>) or be referenced using a URL.
Assuming the context document in the previous
example can be retrieved at <code>https://json-ld.org/contexts/person.jsonld</code>,
it can be referenced by adding a single line and allows a JSON-LD document to
be expressed much more concisely as shown in the example below:</p>
<aside class="example ds-selector-tabs"
title="Referencing a JSON-LD context">
<div class="selectors">
<button class="selected input" data-selects="compacted">Compacted (Input)</button>
<button data-selects="expanded">Expanded (Result)</button>
<button data-selects="statements">Statements</button>
<button data-selects="turtle">Turtle</button>
<a class="playground" target="_blank" href="">PG</a>
</div>
<pre class="compacted input selected nohighlight" data-transform="updateExample">
<!--
{
****"@context": "https://json-ld.org/contexts/person.jsonld",****
"name": "Manu Sporny",
"homepage": "http://manu.sporny.org/",
"image": "http://manu.sporny.org/images/manu.png"
}
-->
</pre>
<pre class="expanded result nohighlight"
data-transform="updateExample"
data-result-for="Referencing a JSON-LD context-compacted">
<!--
[{
"http://xmlns.com/foaf/0.1/name": [{"@value": "Manu Sporny"}],
"http://xmlns.com/foaf/0.1/homepage": [{ "@id": "http://manu.sporny.org/" }],
"http://xmlns.com/foaf/0.1/img": [{ "@id": "http://manu.sporny.org/images/manu.png" }]
}]
-->
</pre>
<table class="statements"
data-result-for="Referencing a JSON-LD context-expanded"
data-to-rdf>
<thead><tr><th>Subject</th><th>Property</th><th>Value</th></tr></thead>
<tbody>
<tr><td>_:b0</td><td>foaf:name</td><td>Manu Sporny</td></tr>
<tr><td>_:b0</td><td>foaf:homepage</td><td>http://manu.sporny.org/</td></tr>
<tr><td>_:b0</td><td>foaf:img</td><td>http://manu.sporny.org/images/manu.png</td></tr>
</tbody>
</table>
<pre class="turtle"
data-content-type="text/turtle"
data-result-for="Referencing a JSON-LD context-expanded"
data-transform="updateExample"
data-to-rdf>
<!--
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
[
foaf:name "Manu Sporny";
foaf:homepage <http://manu.sporny.org/>;
foaf:img <http://manu.sporny.org/images/manu.png>
] .
-->
</pre>
</aside>
<p>The referenced context not only specifies how the terms map to
<a>IRIs</a> in the Schema.org vocabulary but also
specifies that string values associated with
the <code>homepage</code> and <code>image</code> property
can be interpreted as an <a>IRI</a> (<code>"@type": "@id"</code>,
see <a class="sectionRef" href="#iris"></a> for more details). This information allows developers
to re-use each other's data without having to agree to how their data will interoperate
on a site-by-site basis. External JSON-LD context documents may contain extra
information located outside of the <code>@context</code> key, such as
documentation about the <a>terms</a> declared in the
document. Information contained outside of the <code>@context</code> value
is ignored when the document is used as an external <dfn data-lt="context document">JSON-LD context document</dfn>.</p>
<p class="changed">A remote context may also be referenced using a relative URL,
which is resolved relative to the location of the document containing the reference.
For example, if a document were located at <code>http://example.org/document.jsonld</code>
and contained a relative reference to <code>context.jsonld</code>,
the referenced context document would be found relative at <code>http://example.org/context.jsonld</code>.</p>
<pre class="example nohighlight changed"
title="Loading a relative context"