197
197
.ds-selector-tabs pre .selected , .ds-selector-tabs table .selected {
198
198
display : block;
199
199
}
200
+ a .playground {
201
+ border-bottom : none;
202
+ text-decoration : none;
203
+ font-size : 13px ;
204
+ }
205
+ a [href ].playground {
206
+ border-bottom : none;
207
+ text-decoration : none;
208
+ color : # 666 ;
209
+ }
200
210
</ style >
201
211
</ head >
202
212
@@ -400,11 +410,13 @@ <h2>Expansion</h2>
400
410
< aside class ="example ds-selector-tabs "
401
411
title ="JSON-LD document using only terms ">
402
412
< div class ="selectors ">
403
- < button class ="selected " data-selects ="expanded "> Expanded</ button >
413
+ < button class ="selected " data-selects ="original "> Original</ button >
414
+ < button data-selects ="expanded "> Expanded</ button >
404
415
< button data-selects ="statements "> Statements</ button >
405
416
< button data-selects ="turtle "> Turtle</ button >
417
+ < a class ="playground " target ="_blank "> </ a >
406
418
</ div >
407
- < pre class ="expanded selected " data-transform ="updateExample ">
419
+ < pre class ="original selected " data-transform ="updateExample ">
408
420
<!--
409
421
{
410
422
"@context": {
@@ -421,7 +433,8 @@ <h2>Expansion</h2>
421
433
-->
422
434
</ pre >
423
435
< pre class ="expanded "
424
- data-result-for ="JSON-LD document using only terms-expanded ">
436
+ data-result-for ="JSON-LD document using only terms-original "
437
+ data-transform ="updateExample ">
425
438
<!--
426
439
[{
427
440
"@id": "http://me.markus-lanthaler.com/",
@@ -460,19 +473,24 @@ <h2>Expansion</h2>
460
473
and an < a > array</ a > to encapsulate another, but
461
474
leaves the rest of the information untouched.</ p >
462
475
463
- < pre class ="example nohighlight " data-transform ="updateExample "
464
- title ="Sample JSON-LD document using an IRI instead of a term to express a property ">
465
- <!--
466
- {
467
- "@context": {
468
- ****"website": "http://xmlns.com/foaf/0.1/homepage"****
469
- },
470
- "@id": "http://me.markus-lanthaler.com/",
471
- "****http://xmlns.com/foaf/0.1/name****": "Markus Lanthaler",
472
- ****"website"****: ****{ "@id":**** "http://www.markus-lanthaler.com/" ****}****
473
- }
474
- -->
475
- </ pre >
476
+ < aside class ="example ds-selector-tabs "
477
+ title ="Sample JSON-LD document using an IRI instead of a term to express a property ">
478
+ < div class ="selectors ">
479
+ < a class ="playground " target ="_blank "> </ a >
480
+ </ div >
481
+ < pre class ="original selected nohighlight " data-transform ="updateExample ">
482
+ <!--
483
+ {
484
+ "@context": {
485
+ ****"website": "http://xmlns.com/foaf/0.1/homepage"****
486
+ },
487
+ "@id": "http://me.markus-lanthaler.com/",
488
+ "****http://xmlns.com/foaf/0.1/name****": "Markus Lanthaler",
489
+ ****"website"****: ****{ "@id":**** "http://www.markus-lanthaler.com/" ****}****
490
+ }
491
+ -->
492
+ </ pre >
493
+ </ aside >
476
494
477
495
< p > Note that both inputs are valid JSON-LD and both represent the same
478
496
information. The difference is in their < a > context</ a > information
@@ -493,16 +511,16 @@ <h2>Expansion</h2>
493
511
operation) against the above examples results in the following output:</ p >
494
512
495
513
< pre class ="example nohighlight " data-transform ="updateExample "
496
- data-result-for ="Sample JSON-LD document using an IRI instead of a term to express a property "
514
+ data-result-for ="Sample JSON-LD document using an IRI instead of a term to express a property-original "
497
515
title ="Expanded JSON-LD document using an IRI ">
498
516
<!--
499
517
[
500
518
{
501
519
"@id": "http://me.markus-lanthaler.com/",
502
- "http://xmlns.com/foaf/0.1/name": [
520
+ "**** http://xmlns.com/foaf/0.1/name**** ": [
503
521
{ "@value": "Markus Lanthaler" }
504
522
],
505
- "http://xmlns.com/foaf/0.1/homepage": [
523
+ "**** http://xmlns.com/foaf/0.1/homepage**** ": [
506
524
{ "@id": "http://www.markus-lanthaler.com/" }
507
525
]
508
526
}
@@ -546,8 +564,8 @@ <h2>Compaction</h2>
546
564
547
565
< p > For example, assume the following expanded JSON-LD input document:</ p >
548
566
549
- < pre class =" example nohighlight " data-transform =" updateExample "
550
- data-result-for =" Sample JSON-LD document using an IRI instead of a term to express a property "
567
+ < pre id =" sample-document "
568
+ class =" example nohighlight " data-transform =" updateExample "
551
569
title ="Expanded sample document ">
552
570
<!--
553
571
[
@@ -567,7 +585,9 @@ <h2>Compaction</h2>
567
585
< p > Additionally, assume the following developer-supplied JSON-LD
568
586
< a > context</ a > :</ p >
569
587
570
- < pre class ="example nohighlight " data-transform ="updateExample "
588
+ < pre id ="sample-document-context "
589
+ class ="example nohighlight "
590
+ data-transform ="updateExample "
571
591
data-context-for ="Expanded sample document "
572
592
title ="JSON-LD context ">
573
593
<!--
@@ -588,26 +608,36 @@ <h2>Compaction</h2>
588
608
operation) given the context supplied above against the JSON-LD input
589
609
document provided above would result in the following output:</ p >
590
610
591
- < pre class ="example nohighlight " data-transform ="updateExample "
592
- data-result-for ="Expanded sample document "
593
- data-context ="JSON-LD context "
594
- data-compact
595
- title ="Compacted sample document ">
596
- <!--
597
- {
598
- "@context": {
599
- "name": "http://xmlns.com/foaf/0.1/name",
600
- "homepage": {
601
- "@id": "http://xmlns.com/foaf/0.1/homepage",
602
- "@type": "@id"
603
- }
604
- },
605
- "@id": "http://me.markus-lanthaler.com/",
606
- "name": "Markus Lanthaler",
607
- "homepage": "http://www.markus-lanthaler.com/"
608
- }
609
- -->
610
- </ pre >
611
+ < aside class ="example ds-selector-tabs "
612
+ title ="Compacted sample document ">
613
+ < div class ="selectors ">
614
+ < a class ="playground "
615
+ data-result-for ="#sample-document "
616
+ data-context ="#sample-document-context "
617
+ data-compact
618
+ target ="_blank "> </ a >
619
+ </ div >
620
+ < pre class ="original selected nohighlight " data-transform ="updateExample "
621
+ data-result-for ="Expanded sample document "
622
+ data-context ="JSON-LD context "
623
+ data-compact
624
+ title ="Compacted sample document ">
625
+ <!--
626
+ {
627
+ "@context": {
628
+ "name": "http://xmlns.com/foaf/0.1/name",
629
+ "homepage": {
630
+ "@id": "http://xmlns.com/foaf/0.1/homepage",
631
+ "@type": "@id"
632
+ }
633
+ },
634
+ "@id": "http://me.markus-lanthaler.com/",
635
+ "name": "Markus Lanthaler",
636
+ "homepage": "http://www.markus-lanthaler.com/"
637
+ }
638
+ -->
639
+ </ pre >
640
+ </ aside >
611
641
612
642
< p class ="changed "> The example above is the JSON-LD serialization of the output of the
613
643
< a href ="#compaction-algorithm "> compaction algorithm</ a > ,
@@ -638,7 +668,8 @@ <h2>Flattening</h2>
638
668
639
669
< p > For example, assume the following JSON-LD input document:</ p >
640
670
641
- < pre class ="example nohighlight " data-transform ="updateExample "
671
+ < pre id ="json-ld-document-in-compact-form "
672
+ class ="example nohighlight " data-transform ="updateExample "
642
673
title ="JSON-LD document in compact form ">
643
674
<!--
644
675
{
@@ -660,27 +691,35 @@ <h2>Flattening</h2>
660
691
operation) with a context set to < a > null</ a > to prevent compaction
661
692
returns the following document:</ p >
662
693
663
- < pre class ="example nohighlight " data-transform ="updateExample "
664
- data-result-for ="JSON-LD document in compact form "
665
- data-flatten
666
- title ="Flattened sample document in expanded form ">
667
- <!--
668
- [{
669
- "@id": "http://me.markus-lanthaler.com/",
670
- "http://xmlns.com/foaf/0.1/name": [
671
- { "@value": "Markus Lanthaler" }
672
- ],
673
- "http://xmlns.com/foaf/0.1/knows": [
674
- { "@id": "_:b0" }
675
- ]
676
- }, {
677
- "@id": "_:b0",
678
- "http://xmlns.com/foaf/0.1/name": [
679
- { "@value": "Dave Longley" }
680
- ]
681
- }]
682
- -->
683
- </ pre >
694
+ < aside class ="example ds-selector-tabs "
695
+ title ="Flattened sample document ">
696
+ < div class ="selectors ">
697
+ < a class ="playground "
698
+ data-result-for ="#json-ld-document-in-compact-form "
699
+ data-flatten
700
+ target ="_blank "> </ a >
701
+ </ div >
702
+ < pre class ="original selected nohighlight " data-transform ="updateExample "
703
+ data-result-for ="JSON-LD document in compact form "
704
+ data-flatten >
705
+ <!--
706
+ [{
707
+ "@id": "http://me.markus-lanthaler.com/",
708
+ "http://xmlns.com/foaf/0.1/name": [
709
+ { "@value": "Markus Lanthaler" }
710
+ ],
711
+ "http://xmlns.com/foaf/0.1/knows": [
712
+ { "@id": "_:b0" }
713
+ ]
714
+ }, {
715
+ "@id": "_:b0",
716
+ "http://xmlns.com/foaf/0.1/name": [
717
+ { "@value": "Dave Longley" }
718
+ ]
719
+ }]
720
+ -->
721
+ </ pre >
722
+ </ aside >
684
723
685
724
< p class ="changed "> The example above is the JSON-LD serialization of the output of the
686
725
< a href ="#flattening-algorithm "> flattening algorithm</ a > ,
@@ -696,28 +735,38 @@ <h2>Flattening</h2>
696
735
the same context as the input document, the flattened and compacted document
697
736
looks as follows:</ p >
698
737
699
- < pre class ="example nohighlight " data-transform ="updateExample "
700
- data-result-for ="JSON-LD document in compact form "
701
- data-flatten
702
- data-context ="JSON-LD document in compact form "
703
- title ="Flattened and compacted sample document ">
704
- <!--
705
- {
706
- "@context": {
707
- "name": "http://xmlns.com/foaf/0.1/name",
708
- "knows": "http://xmlns.com/foaf/0.1/knows"
709
- },
710
- "@graph": [{
711
- "@id": "http://me.markus-lanthaler.com/",
712
- "name": "Markus Lanthaler",
713
- "knows": { "@id": "_:b0" }
714
- }, {
715
- "@id": "_:b0",
716
- "name": "Dave Longley"
717
- }]
718
- }
719
- -->
720
- </ pre >
738
+ < aside class ="example ds-selector-tabs "
739
+ title ="Flattened and compacted sample document ">
740
+ < div class ="selectors ">
741
+ < a class ="playground "
742
+ data-result-for ="#json-ld-document-in-compact-form "
743
+ data-context ="#json-ld-document-in-compact-form "
744
+ data-flatten
745
+ target ="_blank "> </ a >
746
+ </ div >
747
+ < pre class ="original selected nohighlight " data-transform ="updateExample "
748
+ data-result-for ="JSON-LD document in compact form "
749
+ data-context ="JSON-LD document in compact form "
750
+ data-flatten
751
+ title ="Flattened and compacted sample document ">
752
+ <!--
753
+ {
754
+ "@context": {
755
+ "name": "http://xmlns.com/foaf/0.1/name",
756
+ "knows": "http://xmlns.com/foaf/0.1/knows"
757
+ },
758
+ "@graph": [{
759
+ "@id": "http://me.markus-lanthaler.com/",
760
+ "name": "Markus Lanthaler",
761
+ "knows": { "@id": "_:b0" }
762
+ }, {
763
+ "@id": "_:b0",
764
+ "name": "Dave Longley"
765
+ }]
766
+ }
767
+ -->
768
+ </ pre >
769
+ </ aside >
721
770
722
771
< p > Please note that the result of flattening and < a > compacting</ a > a document
723
772
is always a < a class ="changed "> dictionary</ a > ,
0 commit comments