@@ -407,6 +407,7 @@ <h2>Syntax Tokens and Keywords</h2>
407
407
developers express specific identifiers in a compact manner. The
408
408
< code > @context</ code > keyword is described in detail in the section titled
409
409
< a href ="#the-context "> The Context</ a > .</ dd >
410
+ < dt > < code > @graph</ code > </ dt > < dd > Used to explicitly express a < tref > linked data graph</ tref > .</ dd >
410
411
< dt > < code > @id</ code > </ dt >
411
412
< dd > Used to uniquely identify things that are being described in the document.
412
413
This keyword is described in the section titled
@@ -678,7 +679,7 @@ <h3>The Context</h3>
678
679
< p >
679
680
The set of contexts defined within a specific < tref > JSON Object</ tref > are
680
681
referred to as < tdef > local context</ tdef > s. Setting the context to < code > null</ code >
681
- effectively sets the < tdef > local context</ tdef > to it's initial state. The
682
+ effectively sets the < tref > local context</ tref > to it's initial state. The
682
683
< tdef > active context</ tdef > refers to the accumulation of
683
684
< tref > local context</ tref > s that are in scope at a specific point within
684
685
the document. The following example specifies an external context and then
@@ -1928,12 +1929,109 @@ <h2>Embedding</h2>
1928
1929
</ p >
1929
1930
</ section >
1930
1931
1932
+ < section >
1933
+ < h2 > Named Graphs</ h2 >
1934
+ < p class ="issue "> This section is provisional, as the group has not yet decided to include
1935
+ support for named graphs. However, the use of the < code > @graph</ code > keyword does have
1936
+ meaning for a top-level object definition.</ p >
1937
+ < p > The < code > @graph</ code > is used to identify a set of JSON-LD object definitions that may not be directly
1938
+ related through a property, or where < tref > embedding</ tref > is not appropriate. For example:</ p >
1939
+
1940
+ < pre class ="example " data-transform ="updateExample ">
1941
+ <!--
1942
+ {
1943
+ "@context": ...,
1944
+ "@graph":
1945
+ [
1946
+ {
1947
+ "@id": "http://manu.sporny.org/i/public",
1948
+ "@type": "foaf:Person",
1949
+ "name": "Manu Sporny",
1950
+ "knows" "http://greggkellogg.net/foaf#me"
1951
+ },
1952
+ {
1953
+ "@id": "http://greggkellogg.net/foaf#me",
1954
+ "@type": "foaf:Person",
1955
+ "name": "Gregg Kellogg",
1956
+ "knows" "http://manu.sporny.org/i/public"
1957
+ }
1958
+ ]
1959
+ }
1960
+ -->
1961
+ </ pre >
1962
+
1963
+ < p > In this case, embedding doesn't work as each JSON-LD object references the other.
1964
+ Using the < code > @graph</ code >
1965
+ keyword allows multiple resources to be defined within an < tref > array</ tref > , and allows the use
1966
+ of a shared < tref > context</ tref > . This is equivalent to using multiple < tref > JSON Object</ tref >
1967
+ definitions in array and defining the < code > @context</ code > within each object:</ p >
1968
+
1969
+ < pre class ="example " data-transform ="updateExample ">
1970
+ <!--
1971
+ ****[****
1972
+ {
1973
+ ****"@context": ...,****
1974
+ "@id": "http://manu.sporny.org/i/public",
1975
+ "@type": "foaf:Person",
1976
+ "name": "Manu Sporny",
1977
+ "knows" "http://greggkellogg.net/foaf#me"
1978
+ },
1979
+ {
1980
+ ****"@context": ...,****
1981
+ "@id": "http://greggkellogg.net/foaf#me",
1982
+ "@type": "foaf:Person",
1983
+ "name": "Gregg Kellogg",
1984
+ "knows" "http://manu.sporny.org/i/public"
1985
+ }
1986
+ ****]****
1987
+ -->
1988
+ </ pre >
1989
+
1990
+ < p > The < code > @graph</ code > keyword takes on additional meaning when it is used along with
1991
+ other properties, or is used within an embedded JSON-LD object. In this case, the set
1992
+ of JSON-LD objects contained within a < code > @graph</ code > is given a < em > name</ em > , based
1993
+ on the label of the JSON-LD object containing a < code > @graph</ code > property, either an
1994
+ < tref > IRI</ tref > , or an < tref > unlabeled node</ tref > . This allows statements to be
1995
+ made about an entire < tref > linked data graph</ tref > , rather than just a single JSON-LD object.</ p >
1996
+
1997
+ < pre class ="example " data-transform ="updateExample ">
1998
+ <!--
1999
+ {
2000
+ "@context": ...,
2001
+ ****"@id": "http://example.org/linked-data-graph",
2002
+ "@type": "Graph",
2003
+ "asOf": {"@value": "2012-04-09", "@type": "xsd:date"},****
2004
+ "@graph":
2005
+ [
2006
+ {
2007
+ "@id": "http://manu.sporny.org/i/public",
2008
+ "@type": "foaf:Person",
2009
+ "name": "Manu Sporny",
2010
+ "knows" "http://greggkellogg.net/foaf#me"
2011
+ },
2012
+ {
2013
+ "@id": "http://greggkellogg.net/foaf#me",
2014
+ "@type": "foaf:Person",
2015
+ "name": "Gregg Kellogg",
2016
+ "knows" "http://manu.sporny.org/i/public"
2017
+ }
2018
+ ]
2019
+ }
2020
+ -->
2021
+ </ pre >
2022
+
2023
+ < p > This example says that there is a < tref > linked data graph</ tref > identified by
2024
+ < code > http://example.org/linked-data-graph</ code > which is composed of the statements
2025
+ about Manu and Gregg. Additionally, there is information about the graph itself, which
2026
+ indicates a time at which this information as asserted to be true.</ p >
2027
+ </ section >
2028
+
1931
2029
< section >
1932
2030
< h2 > Identifying Unlabeled Nodes</ h2 >
1933
2031
1934
2032
< p > At times, it becomes necessary to be able to express information without
1935
2033
being able to specify the subject. Typically, this type of node is called
1936
- an unlabeled node or a blank node. In JSON-LD, unlabeled node identifiers are
2034
+ an < tref > unlabeled node</ tref > or a blank node. In JSON-LD, < tref > unlabeled node</ tref > identifiers are
1937
2035
automatically created if a subject is not specified using the
1938
2036
< code > @id</ code > keyword. However, authors may provide identifiers for
1939
2037
unlabeled nodes by using the special < code > _</ code > (underscore)
@@ -1952,7 +2050,7 @@ <h2>Identifying Unlabeled Nodes</h2>
1952
2050
1953
2051
< p > The example above would set the subject to < code > _:foo</ code > , which can
1954
2052
then be used later on in the JSON-LD markup to refer back to the
1955
- unlabeled node. This practice, however, is usually frowned upon when
2053
+ < tref > unlabeled node</ tref > . This practice, however, is usually frowned upon when
1956
2054
generating < tref > Linked Data</ tref > . If a developer finds that they refer to the unlabeled
1957
2055
node more than once, they should consider naming the node using a resolve-able
1958
2056
< tref > IRI</ tref > .
0 commit comments