-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.html
1593 lines (1481 loc) · 62.9 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-star</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 class='remove'>
var respecConfig = {
localBiblio: {
"RDFStar": {
"title": "RDF-star and SPARQL-star",
"authors": [
"Olaf Hartig",
"Pierre-Antoine Champin"
],
"publisher": "W3C",
"status": "W3C CG Draft",
"href": "https://w3c.github.io/rdf-star/cg-spec/2021-02-18.html",
"editors": ["Olaf Hartig", "Pierre-Antoine Champin"],
"date": "2021-02-18"
},
"JSON-LD-star-tests": {
"title": "JSON-LD-star Test Suite",
"author": "Gregg Kellogg",
"publisher": "W3C",
"status": "unofficial",
"href": "https://json-ld.github.io/json-ld-star/tests/"
}
},
specStatus: "CG-DRAFT",
copyrightStart: "2020",
shortName: "json-ld-star",
latestVersion: "https://json-ld.github.io/json-ld-star/publications/2021-02-18.html",
prevVersion: "https://json-ld.github.io/json-ld-star/publications/2021-02-18.html",
previousPublishDate: "2021-02-18",
previousMaturity: "CG-DRAFT",
edDraftURI: "https://json-ld.github.io/json-ld-star/",
testSuiteURI: "https://json-ld.github.io/json-ld-star/tests/",
implementationReportURI:"https://json-ld.github.io/json-ld-star/reports/",
github: {
repoURL: "https://github.com/json-ld/json-ld-star/",
branch: "main"
},
doJsonLd: true,
editors: [{
name: "Gregg Kellogg",
url: "http://greggkellogg.net/",
w3cid: "44770"
}, {
name: "Pierre-Antoine Champin",
url: "http://champin.net/",
company: "ERCIM",
companyURL: "https://www.ercim.eu/",
w3cid: 42931,
orcid: "0000-0001-7046-4474",
}],
//previousMaturity: "FPWD",
//previousPublishDate: "1977-03-15",
// Cross-reference definitions
xref: ["json-ld11", "json-ld11-api", "json-ld11-framing"],
group: "cg/json-ld",
wgPublicList: "public-linked-json",
maxTocLevel: 4,
noRecTrack: "true"
};
</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>
.hidden { display: none;}
.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.flattened:before {
content: "Flattened";
float: right;
font: x-large Arial, sans-serif;
color: gray;
border: solid thin black;
padding: 0.2em;
}
.example > pre.expanded:before {
content: "Expanded";
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;
}
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;
}
.algorithm ol {
counter-reset: numsection;
list-style-type: none;
}
.algorithm ol>li {
margin: 0.5em 0;
}
.algorithm ol>li:before {
font-weight: bold;
counter-increment: numsection;
content: counters(numsection, ".") ") ";
}
</style>
</head>
<body>
<section id='abstract'>
<p>
This NOTE describes an extension to [[JSON-LD11]], [[JSON-LD11-API]],
and [[JSON-LD11-FRAMING]] to allow arcs in a <a>Linked Data Graph</a> to
be annotated using the [[RDFStar]] model.
</p>
</section>
<section id='sotd'>
<p>
This is an unofficial proposal.
</p>
</section>
<section>
<h2>Introduction</h2>
<p>[[[RDFStar]]] [[RDFStar]] addresses the problem of annotating arcs in a <a>Linked Data Graph</a>
by extending the <a data-cite="RDF11-CONCEPTS#data-model">RDF data model</a> [[RDF11-CONCEPTS]] to allow for triples
to be used as the <a>subject</a>
or <a>object</a> of another <a data-cite="RDF11-CONCEPTS#dfn-rdf-triple">RDF triple</a>.
This note describes an update to the <a data-cite="JSON-LD11#data-model">JSON-LD data model</a>
to allow limited form of a <a data-cite="JSON-LD11#dfn-node-object">node object</a>
to use another <a data-cite="JSON-LD11#dfn-node-object">node object</a> as its node identifier.</p>
<p>The two popular graph-based data models have been RDF [[RDF11-CONCEPTS]] and
<a href="https://en.wikipedia.org/wiki/Graph_database#Labeled-property_graph">Labeled-property Graphs</a>,
which are roughly similar, with the RDF model being more formal in identifying nodes,
datatypes and relationships, while Property Graphs
use a less formal relationship model somewhat similar to JSON. In both models,
nodes are related via edges (AKA arcs), but in Property Graphs,
those edges may themselves be annotated with properties.
This is useful in providing additional metadata and semantics to relationships of the nodes.</p>
<p>Historically, in RDF, this can be simulated through <a href="https://www.w3.org/wiki/RdfReification">Reification</a>,
where a <a>triple</a> is represented by another resource with properties for the <a>subject</a>, <a>predicate</a>, and <a>object</a>,
which allows additional properties to be asserted on that reification node.</p>
<pre class="example turtle"
data-transform="updateExample"
data-content-type="text/turtle"
title="An RDF Triple and its Reification">
<!--
@base <http://example.org/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix : <#> .
:bob :age 42 .
# Reification of previous triple
[
a rdf:Statement;
rdf:subject :bob;
rdf:predicate :age;
rdf:object 42
] .
-->
</pre>
<p>In [[RDFStar]], a <a>triple</a> may act as the <a>subject</a> or <a>object</a> in another <a>triple</a>,
for example, we can modify how certain we are about a relationship as follows:</p>
<pre class="example turtle"
data-transform="updateExample"
data-content-type="text/turtle"
data-options="rdfstar=true"
title="Annotation on an RDF triple">
<!--
@base <http://example.org/> .
@prefix : <#> .
:bob :age 42.
<< :bob :age 42 >> :source <http://example.org/~bob/>.
-->
</pre>
<p>This NOTE explores an extension of JSON-LD which can allow
the value of an `@id` property to be an <a>embedded node</a>,
and the description of an <a>annotation object</a> which serves as
a short-hand when the annotated value also is described
directly in the graph.</p>
</section>
<div class="informative">
<!-- Terms included for referencability, but not displayed -->
<div data-include="common/terms.html"></div>
<div data-include="common/algorithm-terms.html"></div>
</div>
<section id="conformance">
<p>A <a>JSON-LD-star document</a> complies with this specification if it follows
the normative statements in <a href="#grammar-extensions"></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>ex</td>
<td>http://example.org/</td>
</tr>
<tr>
<td>rdf</td>
<td>http://www.w3.org/1999/02/22-rdf-syntax-ns#</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">
<h2>JSON-LD-star-specific Terms</h2>
<p>The Following terms are used within specific algorithms.</p>
<dl data-sort>
<dt><dfn data-cite="RDFStar#dfn-dataset">RDF-star dataset</dfn></dt><dd>
An <a>RDF dataset</a> extended to allow the use of an
<a>RDF-star graph</a> instead of a plain <a>RDF graph</a>.
</dd>
<dt><dfn data-cite="RDFStar#dfn-graph">RDF-star graph</dfn></dt><dd>
A set of <a>RDF-star triples</a>.
</dd>
<dt><dfn data-cite="RDFStar#dfn-triple">RDF-star triple</dfn></dt><dd>
An <a data-cite="RDF11-CONCEPTS#dfn-rdf-triple">RDF triple</a> extended to allow an <a>RDF-star triple</a> to be
used in the <a>subject</a> or <a>object</a> position.
</dd>
<dt><dfn >Embedded Node</dfn></dt><dd>
An <a>embedded node</a> is a <a>node object</a> describing exactly one <a>property</a>/value pair.
The <a>node object</a> MAY be identified as with other node objects (including with an <a>embedded node</a>).
The <a>property</a> MUST be either `@type` or an <a>IRI</a>.
The property value MUST be either an <a>IRI</a>, <a>blank node</a>, <a>literal</a> or an <a>embedded node</a>.
An <a>embedded node</a> MAY contain other <a>entries</a> that do not, themselves, create directed-arcs, such
as `@context` or `@index`.
An <a>embedded triples</a> is the representation of an <dfn data-cite="RDFStar#dfn-embedded-triple">embedded triple</dfn>.
</dd>
<dt><dfn>JSON-LD-star document</dfn></dt><dd>
A <a>JSON-LD-star document</a> is a serialization of
an <a>RDF dataset</a> as extended by [[RDFStar]].
</dd>
<dt><dfn>Annotation Object</dfn></dt><dd>
An <a>annotation object</a> is a <a>node object</a> which is the value
of `@annotation` (or an alias). It describes [[RDFStar]] annotations
made on the <a>triple</a> between by its parent <a>node object</a> or <a>value object</a>, and the parent's closest ancestor <a>node object</a>.
</dd>
</dl>
</section>
<section id="basic-concepts" class="informative">
<h2>Basic Concepts</h2>
<p>This specification adds the concepts of an <a>embedded node</a>
and <a>annotation object</a> to JSON-LD in order to add the
ability to make statements about individual <a>triples</a> in an
<a>RDF-star Graph</a>.</p>
<p>An <a>embedded node</a> supports the ability to make one or more statements
about a <a>triple</a>, represented by an <a>embedded node</a>, without that
triple being necessarily considered to be part of the <a>Linked Data Graph</a>.</p>
<p>The following example shows how the value of `@id` can be an
of <a>embedded node</a>, which expresses a single <a>triple</a>:</p>
<aside class="example ds-selector-tabs"
title="Embedded node as subject">
<div class="selectors">
<button class="selected input" data-selects="compacted">Compacted (Input)</button>
<button data-selects="expanded">Expanded</button>
<button data-selects="flattened">Flattened</button>
<button data-selects="turtle">Turtle-star</button>
</div>
<pre class="compacted input selected"
data-transform="updateExample"
data-options="rdfstar=true">
<!--
{
"@context": {
"@base": "http://example.org/",
"@vocab": "http://example.org/"
},
"@id": {
"@id": "bob",
"age": 42
},
"certainty": 0.8
}
-->
</pre>
<pre class="expanded"
data-transform="updateExample"
data-options="rdfstar=true"
data-result-for="Embedded node as subject-compacted">
<!--
[{
"@id": {
"@id": "http://example.org/bob",
"http://example.org/age": [{"@value": 42}]
},
"http://example.org/certainty": [{"@value": 0.8}]
}]
-->
</pre>
<pre class="flattened"
data-transform="updateExample"
data-options="rdfstar=true"
data-flatten
data-result-for="Embedded node as subject-compacted">
<!--
[{
"@id": {
"@id": "http://example.org/bob",
"http://example.org/age": [{"@value": 42}]
},
"http://example.org/certainty": [{"@value": 0.8}]
}]
-->
</pre>
<pre class="turtle"
data-content-type="text/turtle"
data-transform="updateExample"
data-options="rdfstar=true,canonicalize=true"
data-to-rdf
data-result-for="Embedded node as subject-compacted">
<!--
@prefix : <http://example.org/> .
<< :bob :age 42 >> :certainty 0.8e0 .
-->
</pre>
</aside>
<p>An <a>annotation object</a> supports the ability to make one or more statements (annotations)
about a <a>triple</a>, where the <a>triple</a> <em>is</em> considered to be part of the <a>Linked Data Graph</a>.</p>
<aside class="example ds-selector-tabs"
title="Annotating a node">
<div class="selectors">
<button class="selected input" data-selects="compacted">Compacted (Input)</button>
<button data-selects="expanded">Expanded</button>
<button data-selects="flattened">Flattened</button>
<button data-selects="turtle">Turtle-star</button>
</div>
<pre class="compacted input selected"
data-transform="updateExample"
data-options="rdfstar=true">
<!--
{
"@context": {
"@base": "http://example.org/",
"@vocab": "http://example.org/"
},
"@id": "bob",
"age": {
"@value": 42,
"@annotation": {
"certainty": 0.8
}
}
}
-->
</pre>
<pre class="expanded"
data-transform="updateExample"
data-options="rdfstar=true"
data-result-for="Annotating a node-compacted">
<!--
[{
"@id": "http://example.org/bob",
"http://example.org/age": [{
"@value": 42,
"@annotation": [{
"http://example.org/certainty": [{"@value": 0.8}]
}]
}]
}]
-->
</pre>
<pre class="flattened"
data-transform="updateExample"
data-options="rdfstar=true"
data-flatten
data-result-for="Annotating a node-compacted">
<!--
[{
"@id": "http://example.org/bob",
"http://example.org/age": [{"@value": 42}]
}, {
"@id": {
"@id": "http://example.org/bob",
"http://example.org/age": [{"@value": 42}]
},
"http://example.org/certainty": [{"@value": 0.8}]
}]
-->
</pre>
<pre class="turtle"
data-content-type="text/turtle"
data-transform="updateExample"
data-options="rdfstar=true,canonicalize=true"
data-to-rdf
data-result-for="Annotating a node-compacted">
<!--
@prefix : <http://example.org/> .
:bob :age 42 .
<< :bob :age 42 >> :certainty 0.8e0 .
-->
</pre>
</aside>
</section>
<section id="advanced-concepts" class="informative">
<h2>Advanced Concepts</h2>
<p>JSON-LD allows many more sophisticated ways of describing data and
both <a>embedded nodes</a> and <a>annotation objects</a> work along with these
other features, to the extent that they are used in describing a single relationship.</p>
<section id="reverse-properties" class="informative">
<h3>Reverse Properties</h3>
<p>JSON-LD allows the description of <a data-cite="JSON-LD11#reverse-proerties"></a>
within <a>node objects</a>, either by defining a term using `@reverse`, or using
`@reverse` directly within a <a>node object</a>.</p>
<p>An <a>embedded node</a> MUST NOT, itself, use a reverse property.</p>
<p>The relationships between nodes can be reversed even when those
nodes use embedded objects:</p>
<aside class="example ds-selector-tabs"
title="Reversing relationship with embedded node">
<div class="selectors">
<button class="selected input" data-selects="compacted">Compacted (Input)</button>
<button data-selects="expanded">Expanded</button>
<button data-selects="flattened">Flattened</button>
<button data-selects="turtle">Turtle-star</button>
</div>
<pre class="compacted input selected"
data-transform="updateExample"
data-options="rdfstar=true">
<!--
{
"@context": {
"@base": "http://example.org/",
"@vocab": "http://example.org/",
"knows": {"@type": "@id"},
"claimedBy": {"@reverse": "http://example.org/claims", "@type": "@id"}
},
"@id": {
"@id": "bob",
"knows": "alice"
},
"claimedBy": "alice"
}
-->
</pre>
<pre class="expanded"
data-transform="updateExample"
data-options="rdfstar=true"
data-result-for="Reversing relationship with embedded node-compacted">
<!--
[{
"@id": {
"@id": "http://example.org/bob",
"http://example.org/knows": [{"@id": "http://example.org/alice"}]
},
"@reverse": {
"http://example.org/claims": [{"@id": "http://example.org/alice"}]
}
}]
-->
</pre>
<pre class="flattened"
data-transform="updateExample"
data-options="rdfstar=true"
data-flatten
data-result-for="Reversing relationship with embedded node-compacted">
<!--
[{
"@id": "http://example.org/alice",
"http://example.org/claims": [{
"@id": {
"@id": "http://example.org/bob",
"http://example.org/knows": [{"@id": "http://example.org/alice"}]
}
}]
}]
-->
</pre>
<pre class="turtle"
data-content-type="text/turtle"
data-transform="updateExample"
data-options="rdfstar=true"
data-to-rdf
data-result-for="Reversing relationship with embedded node-compacted">
<!--
@prefix : <http://example.org/> .
:alice :claims << :bob :knows :alice >> .
-->
</pre>
</aside>
<p>Annotations may themselves use reverse properties, in which case
the annotated triple will be the object (instead of the subject) of the annotation:</p>
<aside class="example ds-selector-tabs"
title="Reversing annotations">
<div class="selectors">
<button class="selected input" data-selects="compacted">Compacted (Input)</button>
<button data-selects="expanded">Expanded</button>
<button data-selects="flattened">Flattened</button>
<button data-selects="turtle">Turtle-star</button>
</div>
<pre class="compacted input selected"
data-transform="updateExample"
data-options="rdfstar=true">
<!--
{
"@context": {
"@base": "http://example.org/",
"@vocab": "http://example.org/",
"accordingTo": {"@type": "@id"},
"claimedBy": {"@reverse": "http://example.org/claims", "@type": "@id"}
},
"@id": "bob",
"knows": {
"@id": "alice",
"@annotation": {
"accordingTo": "alice",
"claimedBy": "bob"
}
}
}
-->
</pre>
<pre class="expanded"
data-transform="updateExample"
data-options="rdfstar=true"
data-result-for="Reversing annotations-compacted">
<!--
[{
"@id": "http://example.org/bob",
"http://example.org/knows": [{
"@id": "http://example.org/alice",
"@annotation": [{
"http://example.org/accordingTo": [{"@id": "http://example.org/alice"}],
"@reverse": {
"http://example.org/claims": [{"@id": "http://example.org/bob"}]
}
}]
}]
}]
-->
</pre>
<pre class="flattened"
data-transform="updateExample"
data-options="rdfstar=true"
data-flatten
data-result-for="Reversing annotations-compacted">
<!--
[{
"@id": "http://example.org/bob",
"http://example.org/knows": [{"@id": "http://example.org/alice"}],
"http://example.org/claims": [{
"@id": {
"@id": "http://example.org/bob",
"http://example.org/knows": [{"@id": "http://example.org/alice"}]
}
}]
}, {
"@id": {
"@id": "http://example.org/bob",
"http://example.org/knows": [{"@id": "http://example.org/alice"}]
},
"http://example.org/accordingTo": [{"@id": "http://example.org/alice"}]
}]
-->
</pre>
<pre class="turtle"
data-content-type="text/turtle"
data-transform="updateExample"
data-options="rdfstar=true"
data-to-rdf
data-result-for="Reversing annotations-compacted">
<!--
@prefix : <http://example.org/> .
:bob :knows :alice .
<< :bob :knows :alice >> :accordingTo :alice .
:bob :claims << :bob :knows :alice >> .
-->
</pre>
</aside>
</section>
<section id="deep-embedding" class="informative">
<h3>Deep Embedding</h3>
<p>[[RDFstar]] allows <a>embedded triples</a> to contain other <a>embedded triples</a>, recursively.
Similarly, an embedded node may be made up of other embedded nodes,
and annotations may be made upon embedded nodes.</p>
<aside class="example ds-selector-tabs"
title="Embedded nodes and annotations">
<div class="selectors">
<button class="selected input" data-selects="compacted">Compacted (Input)</button>
<button data-selects="expanded">Expanded</button>
<button data-selects="flattened">Flattened</button>
<button data-selects="turtle">Turtle-star</button>
</div>
<pre class="compacted input selected"
data-transform="updateExample"
data-options="rdfstar=true">
<!--
{
"@context": {
"@base": "http://example.org/",
"@vocab": "http://example.org/",
"claims": {"@type": "@id"}
},
"@id": {
"@id": "bob",
"knows": {"@id": "alice"}
},
"certainty": {
"@value": 0.8,
"@annotation": {"claims": "ted"}
}
}
-->
</pre>
<pre class="expanded"
data-transform="updateExample"
data-options="rdfstar=true"
data-result-for="Embedded nodes and annotations-compacted">
<!--
[{
"@id": {
"@id": "http://example.org/bob",
"http://example.org/knows": [{"@id": "http://example.org/alice"}]
},
"http://example.org/certainty": [{
"@value": 0.8,
"@annotation": [{
"http://example.org/claims": [{"@id": "http://example.org/ted"}]
}]
}]
}]
-->
</pre>
<pre class="flattened"
data-transform="updateExample"
data-options="rdfstar=true"
data-flatten
data-result-for="Embedded nodes and annotations-compacted">
<!--
[{
"@id": {
"@id": "http://example.org/bob",
"http://example.org/knows": [{"@id": "http://example.org/alice"}]
},
"http://example.org/certainty": [{"@value": 0.8}]
}, {
"@id": {
"@id": {
"@id": "http://example.org/bob",
"http://example.org/knows": [{"@id": "http://example.org/alice"}]
},
"http://example.org/certainty": [{"@value": 0.8}]
},
"http://example.org/claims": [{"@id": "http://example.org/ted"}]
}]
-->
</pre>
<pre class="turtle"
data-content-type="text/turtle"
data-transform="updateExample"
data-options="rdfstar=true,canonicalize=true"
data-to-rdf
data-result-for="Embedded nodes and annotations-compacted">
<!--
@prefix : <http://example.org/> .
<< :bob :knows :alice >> :certainty 0.8e0 .
<< << :bob :knows :alice >> :certainty 0.8e0 >> :claims :ted .
-->
</pre>
</aside>
</section>
<section id="mixing-annotations-and-embedded-nodes" class="informative">
<h3>Mixing Annotations and Embedded Nodes</h3>
<p><a>Annotation objects</a> and <a>embedded nodes</a> can be used together.
As well, <a>annotation objects</a> can be used to annotate <a>embedded nodes</a>
(see <a href="#deep-embedding" class="sectionRef"></a>),
<a>embedded nodes</a> may be used within <a>annotation objects</a>,
and <a>annotation objects</a> may be used to annotate annotations.
However, the <a href="#grammar-extensions">grammar</a> prevents
<a>embedded nodes</a> from including <a>annotation objects</a>.</p>
<p>While it is beyond the scope of this document to discuss use cases
for these scenarios, it is an important notion of regularity
of expression, which is shared by formats such as <a data-cite="RDFStar#turtle-star">Turtle-star</a>.</p>
<p>Consider the following examples:</p>
<aside class="example ds-selector-tabs"
title="Annotation containing embedded node">
<div class="selectors">
<button class="selected input" data-selects="compacted">Compacted (Input)</button>
<button data-selects="expanded">Expanded</button>
<button data-selects="flattened">Flattened</button>
<button data-selects="turtle">Turtle-star</button>
</div>
<pre class="compacted input selected"
data-transform="updateExample"
data-options="rdfstar=true">
<!--
{
"@context": {
"@vocab": "ex:",
"p1": {"@type": "@id"}
},
"@id": "ex:s",
"p": {
"@id": "ex:o",
"@annotation": {
"r": {
"@id": "ex:s1",
"@annotation": {
"p1": "ex:o1"
}
}
}
}
}
-->
</pre>
<pre class="expanded"
data-transform="updateExample"
data-options="rdfstar=true"
data-result-for="Annotation containing embedded node-compacted">
<!--
[{
"@id": "ex:s",
"ex:p": [{
"@id": "ex:o",
"@annotation": [{
"ex:r": [{
"@id": "ex:s1",
"@annotation": [{
"ex:p1": [{"@id": "ex:o1"}]
}]
}]
}]
}]
}]
-->
</pre>
<pre class="flattened"
data-transform="updateExample"
data-options="rdfstar=true"
data-flatten
data-result-for="Annotation containing embedded node-compacted">
<!--
[{
"@id": "ex:s",
"ex:p": [{"@id": "ex:o"}]
}, {
"@id": {
"@id": "ex:s",
"ex:p": [{"@id": "ex:o"}]
},
"ex:r": [{"@id": "ex:s1"}]
}, {
"@id": {
"@id": {
"@id": "ex:s",
"ex:p": [{"@id": "ex:o"}]
},
"ex:r": [{"@id": "ex:s1"}]
},
"ex:p1": [{"@id": "ex:o1"}]
}]
-->
</pre>
<pre class="turtle"
data-content-type="text/turtle"
data-transform="updateExample"
data-options="rdfstar=true,canonicalize=true"
data-to-rdf
data-result-for="Annotation containing embedded node-compacted">
<!--
@prefix : <ex:> .
:s :p :o {| :r :s1 {| :p1 :o1 |} |} .
-->
</pre>
</aside>
<aside class="example ds-selector-tabs"
title="Annotating an annotation">
<div class="selectors">
<button class="selected input" data-selects="compacted">Compacted (Input)</button>
<button data-selects="expanded">Expanded</button>
<button data-selects="flattened">Flattened</button>
<button data-selects="turtle">Turtle-star</button>
</div>
<pre class="compacted input selected"
data-transform="updateExample"
data-options="rdfstar=true">
<!--
{
"@context": {
"@vocab": "ex:",
"p1": {"@type": "@id"}
},
"@id": "ex:s",
"p": {
"@id": "ex:o",
"@annotation": {
"r": {
"@id": {"@id": "ex:s1", "p1": "ex:o1"}
}
}
}
}
-->
</pre>
<pre class="expanded"
data-transform="updateExample"
data-options="rdfstar=true"
data-result-for="Annotating an annotation-compacted">
<!--
[{
"@id": "ex:s",
"ex:p": [{
"@id": "ex:o",
"@annotation": [{
"ex:r": [{
"@id": {
"@id": "ex:s1",
"ex:p1": [{"@id": "ex:o1"}]
}
}]
}]
}]