@@ -1754,8 +1754,9 @@ <h1>Advanced Concepts</h1>
1754
1754
< p > In general, contexts may be used any time a
1755
1755
< a > dictionary</ a > is defined.
1756
1756
The only time that one cannot express a context is as a direct child of another context definition (other than as part of an < a > expanded term definition</ a > ).
1757
- For example, a < a > JSON-LD document</ a > may use more than one context at different
1758
- points in a document:</ p >
1757
+ For example, a < a > JSON-LD document</ a > may
1758
+ have the form of an < a > array</ a > composed of one or more < a > node objects</ a > ,
1759
+ which use a context definition in each top-level < a > node object</ a > :</ p >
1759
1760
1760
1761
< aside class ="example ds-selector-tabs "
1761
1762
title ="Using multiple contexts ">
@@ -1774,8 +1775,7 @@ <h1>Advanced Concepts</h1>
1774
1775
"name": "Manu Sporny",
1775
1776
"homepage": "http://manu.sporny.org/",
1776
1777
"depiction": "http://twitter.com/account/profile_image/manusporny"
1777
- },
1778
- {
1778
+ }, {
1779
1779
****"@context": "https://json-ld.org/contexts/place.jsonld",****
1780
1780
"name": "The Empire State Building",
1781
1781
"description": "The Empire State Building is a 102-story landmark in New York City.",
@@ -1857,6 +1857,113 @@ <h1>Advanced Concepts</h1>
1857
1857
</ pre >
1858
1858
</ aside >
1859
1859
1860
+ < p > The outer array is standard for a document in
1861
+ < a href ="expanded-document-form "> expanded document form</ a >
1862
+ and < a href ="flattened-document-form "> flattened document form</ a > ,
1863
+ and may be necessary when describing a disconnected graph,
1864
+ where nodes may not reference each other. In such cases, using
1865
+ a top-level dictionary with a @graph property can be useful for saving
1866
+ the repetition of @graph. See < a href ="#embedding " class ="sectionRef "> </ a >
1867
+ for more.</ p >
1868
+
1869
+ < aside class ="example ds-selector-tabs "
1870
+ title ="Describing disconnected nodes with @graph ">
1871
+ < div class ="selectors ">
1872
+ < button class ="selected " data-selects ="original "> Original</ button >
1873
+ < button data-selects ="expanded "> Expanded</ button >
1874
+ < button data-selects ="statements "> Statements</ button >
1875
+ < button data-selects ="turtle "> Turtle</ button >
1876
+ < a class ="playground " target ="_blank "> </ a >
1877
+ </ div >
1878
+ < pre class ="original selected nohighlight " data-transform ="updateExample ">
1879
+ <!--
1880
+ {
1881
+ ****"@context": "https://json-ld.org/contexts/person.jsonld",****
1882
+ ****"@graph": [****{
1883
+ "name": "Manu Sporny",
1884
+ "homepage": "http://manu.sporny.org/",
1885
+ "depiction": "http://twitter.com/account/profile_image/manusporny"
1886
+ }, {
1887
+ "name": "The Empire State Building",
1888
+ "description": "The Empire State Building is a 102-story landmark in New York City.",
1889
+ "geo": {
1890
+ "latitude": "40.75",
1891
+ "longitude": "73.98"
1892
+ }
1893
+ }****]****
1894
+ }
1895
+ -->
1896
+ </ pre >
1897
+ < pre class ="expanded nohighlight " data-transform ="updateExample "
1898
+ data-result-for ="Describing disconnected nodes with @graph-original ">
1899
+ <!--
1900
+ [{
1901
+ "http://xmlns.com/foaf/0.1/name": [{"@value": "Manu Sporny"}],
1902
+ "http://xmlns.com/foaf/0.1/homepage": [{"@id": "http://manu.sporny.org/"}],
1903
+ "http://xmlns.com/foaf/0.1/depiction": [{"@id": "http://twitter.com/account/profile_image/manusporny"}]
1904
+ }, {
1905
+ "http://purl.org/dc/terms/title": [{"@value": "The Empire State Building"}],
1906
+ "http://purl.org/dc/terms/description": [{
1907
+ "@value": "The Empire State Building is a 102-story landmark in New York City."
1908
+ }],
1909
+ "http://schema.org/geo": [{
1910
+ "http://www.w3.org/2003/01/geo/wgs84_pos#lat": [{
1911
+ "@type": "http://www.w3.org/2001/XMLSchema#decimal",
1912
+ "@value": "40.75"
1913
+ }],
1914
+ "http://www.w3.org/2003/01/geo/wgs84_pos#long": [{
1915
+ "@type": "http://www.w3.org/2001/XMLSchema#decimal",
1916
+ "@value": "73.98"
1917
+ }]
1918
+ }]
1919
+ }]
1920
+ -->
1921
+ </ pre >
1922
+ < table class ="statements "
1923
+ data-result-for ="Describing disconnected nodes with @graph-expanded "
1924
+ data-to-rdf >
1925
+ < thead > < tr > < th > Subject</ th > < th > Property</ th > < th > Value</ th > < th > Value Type</ th > </ tr > </ thead >
1926
+ < tbody >
1927
+ < tr > < td > _:b0</ td > < td > foaf:name</ td > < td > Manu Sporny</ td > < td > </ td > </ tr >
1928
+ < tr > < td > _:b0</ td > < td > foaf:homepage</ td > < td > http://manu.sporny.org/</ td > < td > </ td > </ tr >
1929
+ < tr > < td > _:b0</ td > < td > foaf:depiction</ td > < td > http://twitter.com/account/profile_image/manusporny</ td > < td > </ td > </ tr >
1930
+ < tr > < td > _:b1</ td > < td > dc:title</ td > < td > The Empire State Building</ td > < td > </ td > </ tr >
1931
+ < tr > < td > _:b1</ td > < td > dc:description</ td > < td > The Empire State Building is a 102-story landmark in New York City.</ td > < td > </ td > </ tr >
1932
+ < tr > < td > _:b2</ td > < td > geo:lat</ td > < td > 40.75</ td > < td > xsd:decimal</ td > </ tr >
1933
+ < tr > < td > _:b2</ td > < td > geo:long</ td > < td > 73.98</ td > < td > xsd:decimal</ td > </ tr >
1934
+ < tr > < td > _:b1</ td > < td > schema:geo</ td > < td > _:b2</ td > < td > </ td > </ tr >
1935
+ </ tbody >
1936
+ </ table >
1937
+ < pre class ="turtle "
1938
+ data-content-type ="text/turtle "
1939
+ data-result-for ="Describing disconnected nodes with @graph-expanded "
1940
+ data-transform ="updateExample "
1941
+ data-to-rdf >
1942
+ <!--
1943
+ @prefix dc: <http://purl.org/dc/terms/> .
1944
+ @prefix foaf: <http://xmlns.com/foaf/0.1/> .
1945
+ @prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
1946
+ @prefix schema: <http://schema.org/> .
1947
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
1948
+
1949
+ [
1950
+ foaf:name "Manu Sporny";
1951
+ foaf:homepage <http://manu.sporny.org/>;
1952
+ foaf:depiction <http://twitter.com/account/profile_image/manusporny>
1953
+ ] .
1954
+
1955
+ [
1956
+ dc:title "The Empire State Building";
1957
+ dc:description "The Empire State Building is a 102-story landmark in New York City.";
1958
+ schema:geo [
1959
+ geo:lat 40.75;
1960
+ geo:long 73.98
1961
+ ]
1962
+ ] .
1963
+ -->
1964
+ </ pre >
1965
+ </ aside >
1966
+
1860
1967
< p > Duplicate context < a > terms</ a > are overridden using a
1861
1968
most-recently-defined-wins mechanism.</ p >
1862
1969
@@ -1928,7 +2035,9 @@ <h1>Advanced Concepts</h1>
1928
2035
</ aside >
1929
2036
1930
2037
< p > In the example above, the < code > name</ code > < a > term</ a > is overridden
1931
- in the more deeply nested < code > details</ code > structure. Note that this is
2038
+ in the more deeply nested < code > details</ code > structure,
2039
+ which uses its own < a > embedded context</ a > .
2040
+ Note that this is
1932
2041
rarely a good authoring practice and is typically used when working with
1933
2042
legacy applications that depend on a specific structure of the
1934
2043
< a > dictionary</ a > . If a < a > term</ a > is redefined within a
0 commit comments