@@ -1856,23 +1856,6 @@ <h3>JsonLdProcessor</h3>
1856
1856
< dd > A set of options that MAY affect the expansion algorithm such as, e.g., the
1857
1857
input document's base < tref > IRI</ tref > .</ dd >
1858
1858
</ dl >
1859
-
1860
- < dl title ="InvalidContext ">
1861
- < dt > INVALID_SYNTAX</ dt >
1862
- < dd > A general syntax error was detected in the < code > @context</ code > .
1863
- For example, if a < code > @type</ code > key maps to anything other than
1864
- < code > @id</ code > or an < tref > absolute IRI</ tref > , this error type
1865
- will be set in the error sent to the < code > callback</ code > .</ dd >
1866
- < dt > LOAD_ERROR</ dt >
1867
- < dd > There was a problem encountered loading a remote context.</ dd >
1868
- </ dl >
1869
-
1870
- < dl title ="ProcessingError ">
1871
- < dt > LIST_OF_LISTS_DETECTED</ dt >
1872
- < dd > A list of lists was detected. The list of lists feature is
1873
- not supported in this version of JSON-LD due to the algorithmic
1874
- complexity associated with conversion to RDF.</ dd >
1875
- </ dl >
1876
1859
</ dd >
1877
1860
1878
1861
< dt > void compact()</ dt >
@@ -1899,26 +1882,6 @@ <h3>JsonLdProcessor</h3>
1899
1882
input document's base < tref > IRI</ tref > . This also includes < code > optimize</ code > ,
1900
1883
which if set will cause processor-specific optimization.</ dd >
1901
1884
</ dl >
1902
-
1903
- < dl title ="InvalidContext ">
1904
- < dt > INVALID_SYNTAX</ dt >
1905
- < dd > A general syntax error was detected in the < code > @context</ code > .
1906
- For example, if a < code > @type</ code > key maps to anything other than
1907
- < code > @id</ code > or an < tref > absolute IRI</ tref > , this error
1908
- would be returned via the < code > callback</ code > .</ dd >
1909
- < dt > LOAD_ERROR</ dt >
1910
- < dd > There was a problem encountered loading a remote context.</ dd >
1911
- </ dl >
1912
-
1913
- < dl title ="ProcessingError ">
1914
- < dt > CONFLICTING_DATATYPES</ dt >
1915
- < dd > The target datatype specified in the coercion rule and the
1916
- datatype for the typed value do not match.</ dd >
1917
- < dt > LIST_OF_LISTS_DETECTED</ dt >
1918
- < dd > A list of lists was detected. The list of lists feature is
1919
- not supported in this version of JSON-LD due to the algorithmic
1920
- complexity associated with conversion to RDF.</ dd >
1921
- </ dl >
1922
1885
</ dd >
1923
1886
</ dl >
1924
1887
@@ -1934,16 +1897,90 @@ <h3>Callbacks</h3>
1934
1897
asynchronous manner to calling applications. This section details the
1935
1898
parameters sent to those callbacks.</ p >
1936
1899
1900
+ < section >
1901
+ < h3 > JsonLdCallback</ h3 >
1902
+ < p > The JsonLdCallback is used to return a processed JSON-LD
1903
+ representation as the result of processing an API method.</ p >
1904
+
1905
+ < dl title ="callback JsonLdCallback = void " class ="idl ">
1906
+ < dt > JsonLdProcessingError error</ dt >
1907
+ < dd > If the value is < code > null</ code > , then no error occurred. If
1908
+ the value is non-< code > null</ code > , a processing error occurred
1909
+ and the details will be contained within the < code > error</ code >
1910
+ object.</ dd >
1911
+ < dt > object or object[] document</ dt >
1912
+ < dd > The processed JSON-LD document.</ dd >
1913
+ </ dl >
1914
+ </ section >
1915
+ </ section >
1916
+
1917
+ < section >
1918
+ < h3 > Data Structures</ h3 >
1919
+ < p > This section describes datatype definitions used within the JSON-LD API.</ p >
1920
+
1921
+ < section >
1922
+ < h3 > JsonLdOptions</ h3 >
1923
+ < p > The < a > JsonLdOptions</ a > type is used to pass various options to the < a > JsonLdProcessor</ a > methods.</ p >
1924
+ < dl title ="dictionary JsonLdOptions " class ="idl ">
1925
+ < dt > DOMString base</ dt >
1926
+ < dd > The Base IRI to use when expanding the document. This overrides the value of
1927
+ < em > input</ em > if it is a < a > IRI</ a > . If not specified and < em > input</ em > is not
1928
+ an < a > IRI</ a > , the base IRI defaults to the current document IRI if in a browser context,
1929
+ or the empty string if there is no document context.
1930
+ </ dd >
1931
+ < dt > object or DOMString expandContext = null</ dt >
1932
+ < dd > A context that is used to initialize the active context when expanding a document.</ dd >
1933
+ < dt > boolean compactArrays = true</ dt >
1934
+ < dd > If set to < code > true</ code > , the JSON-LD processor replaces arrays with just
1935
+ one element with that element during compaction. If set to < code > false</ code > ,
1936
+ all arrays will remain arrays even if they have just one element.
1937
+ </ dd >
1938
+ < dt > boolean flatten = false</ dt >
1939
+ < dd > If set to a value that is not < code > false</ code > ,
1940
+ the JSON-LD processor must modify the output of the
1941
+ < a href ="#compaction-algorithm "> Compaction Algorithm</ a >
1942
+ or the < a href ="#expansion-algorithm "> Expansion Algorithm</ a > by
1943
+ coalescing all properties associated with each < tref > node</ tref > via the
1944
+ < a href ="#flattening-algorithm "> Flattening Algorithm</ a > . The value
1945
+ of < code > flatten</ code > MUST be either an < tref > IRI</ tref > value
1946
+ representing the name of the graph to flatten, or < code > true</ code > .
1947
+ If the value is < code > true</ code > , then the first graph encountered in
1948
+ the input document is selected and flattened.
1949
+ </ dd >
1950
+ < dt > boolean optimize = false</ dt >
1951
+ < dd > If set to < code > true</ code > , the JSON-LD processor is allowed to
1952
+ optimize the output of the < a href ="#compaction-algorithm "> Compaction Algorithm</ a >
1953
+ to produce even compacter representations. The algorithm for compaction
1954
+ optimization is beyond the scope of this specification and thus
1955
+ not defined. Consequently, different implementations MAY implement
1956
+ different optimization algorithms.
1957
+ </ dd >
1958
+ < dt > boolean useRdfType = false</ dt >
1959
+ < dd > If set to < code > true</ code > , the JSON-LD processor will use the
1960
+ expanded < code > rdf:type</ code > IRI as the property instead of
1961
+ < code > @type</ code > when < a href ="#convert-from-rdf-algorithm "> converting from RDF</ a > .
1962
+ </ dd >
1963
+ < dt > boolean useNativeTypes = true</ dt >
1964
+ < dd > If set to < code > true</ code > , the JSON-LD processor will try to convert
1965
+ < tref title ="typed value "> typed values</ tref > to JSON native types instead of using the
1966
+ expanded object form when < a href ="#convert-from-rdf-algorithm "> converting from RDF</ a > .
1967
+ < code > xsd:boolean</ code > values will be converted to < tref > true</ tref > or < tref > false</ tref > .
1968
+ < code > xsd:integer</ code > and < code > xsd:double</ code > values will be
1969
+ converted to
1970
+ < tref title ="number "> JSON numbers</ tref > .
1971
+ </ dd >
1972
+ </ dl >
1973
+ </ section >
1974
+
1937
1975
< section >
1938
1976
< h3 > JsonLdProcessingError</ h3 >
1939
- < p > The < a > JsonLdError </ a > type is used to encapsulate a variety of
1977
+ < p > The JsonLdProcessingError type is used to encapsulate a variety of
1940
1978
parameters that outline the cause of a particular
1941
1979
< a > JsonLdProcessor</ a > error.</ p >
1942
1980
1943
1981
< dl title ="dictionary JsonLdProcessingError " class ="idl ">
1944
- < dt > DOMString type</ dt >
1945
- < dd > a string representing the particular error type,
1946
- such as < code > LIST_OF_LISTS_DETECTED</ code > , as described in
1982
+ < dt > JsonLdErrorCode code</ dt >
1983
+ < dd > a string representing the particular error type, as described in
1947
1984
the various algorithms in this document.</ dd >
1948
1985
< dt > DOMString operation</ dt >
1949
1986
< dd > a string representing the operation that was being performed
@@ -1961,80 +1998,23 @@ <h3>JsonLdProcessingError</h3>
1961
1998
</ section >
1962
1999
1963
2000
< section >
1964
- < h3 > JsonLdCallback</ h3 >
1965
- < p > The < a > JsonLdCallback</ a > is used to return a processed JSON-LD
1966
- representation as the result of processing an API method.</ p >
1967
-
1968
- < dl title ="callback JsonLdCallback = void " class ="idl ">
1969
- < dt > JsonLdProcessingError error</ dt >
1970
- < dd > If the value is < code > null</ code > , then no error occurred. If
1971
- the value is non-< code > null</ code > , a processing error occurred
1972
- and the details will be contained within the < code > error</ code >
1973
- object.</ dd >
1974
- < dt > object or object[] document</ dt >
1975
- < dd > The processed JSON-LD document.</ dd >
2001
+ < h3 > JsonLdErrorCode</ h3 >
2002
+ < p > The JsonLdErrorCode represent the collection of valid JSON-LD error
2003
+ codes.</ p >
2004
+
2005
+ < dl title ="enum JsonLdErrorCode " class ="idl ">
2006
+ < dt > INVALID_SYNTAX</ dt >
2007
+ < dd > A violation of the grammar as defined by the JSON-LD syntax specification
2008
+ [[!JSON-LD]] was detected.</ dd >
2009
+ < dt > LOAD_ERROR</ dt >
2010
+ < dd > There was a problem encountered loading a remote context.</ dd >
2011
+ < dt > LIST_OF_LISTS_DETECTED</ dt >
2012
+ < dd > A list of lists was detected. List of lists are not supported in
2013
+ this version of JSON-LD due to the algorithmic complexity associated
2014
+ with conversion to RDF.</ dd >
1976
2015
</ dl >
1977
2016
</ section >
1978
2017
</ section >
1979
-
1980
- < section >
1981
- < h3 > Data Structures</ h3 >
1982
- < p > This section describes datatype definitions used within the JSON-LD API.</ p >
1983
-
1984
- < section >
1985
- < h3 > JsonLdOptions</ h3 >
1986
- < p > The < a > JsonLdOptions</ a > type is used to pass various options to the < a > JsonLdProcessor</ a > methods.</ p >
1987
- < dl title ="dictionary JsonLdOptions " class ="idl ">
1988
- < dt > DOMString base</ dt >
1989
- < dd > The Base IRI to use when expanding the document. This overrides the value of
1990
- < em > input</ em > if it is a < a > IRI</ a > . If not specified and < em > input</ em > is not
1991
- an < a > IRI</ a > , the base IRI defaults to the current document IRI if in a browser context,
1992
- or the empty string if there is no document context.
1993
- </ dd >
1994
- < dt > object or DOMString expandContext = null</ dt >
1995
- < dd > A context that is used to initialize the active context when expanding a document.</ dd >
1996
- < dt > boolean compactArrays = true</ dt >
1997
- < dd > If set to < code > true</ code > , the JSON-LD processor replaces arrays with just
1998
- one element with that element during compaction. If set to < code > false</ code > ,
1999
- all arrays will remain arrays even if they have just one element.
2000
- </ dd >
2001
- < dt > boolean flatten = false</ dt >
2002
- < dd > If set to a value that is not < code > false</ code > ,
2003
- the JSON-LD processor must modify the output of the
2004
- < a href ="#compaction-algorithm "> Compaction Algorithm</ a >
2005
- or the < a href ="#expansion-algorithm "> Expansion Algorithm</ a > by
2006
- coalescing all properties associated with each < tref > node</ tref > via the
2007
- < a href ="#flattening-algorithm "> Flattening Algorithm</ a > . The value
2008
- of < code > flatten</ code > MUST be either an < tref > IRI</ tref > value
2009
- representing the name of the graph to flatten, or < code > true</ code > .
2010
- If the value is < code > true</ code > , then the first graph encountered in
2011
- the input document is selected and flattened.
2012
- </ dd >
2013
- < dt > boolean optimize = false</ dt >
2014
- < dd > If set to < code > true</ code > , the JSON-LD processor is allowed to
2015
- optimize the output of the < a href ="#compaction-algorithm "> Compaction Algorithm</ a >
2016
- to produce even compacter representations. The algorithm for compaction
2017
- optimization is beyond the scope of this specification and thus
2018
- not defined. Consequently, different implementations MAY implement
2019
- different optimization algorithms.
2020
- </ dd >
2021
- < dt > boolean useRdfType = false</ dt >
2022
- < dd > If set to < code > true</ code > , the JSON-LD processor will use the
2023
- expanded < code > rdf:type</ code > IRI as the property instead of
2024
- < code > @type</ code > when < a href ="#convert-from-rdf-algorithm "> converting from RDF</ a > .
2025
- </ dd >
2026
- < dt > boolean useNativeTypes = true</ dt >
2027
- < dd > If set to < code > true</ code > , the JSON-LD processor will try to convert
2028
- < tref title ="typed value "> typed values</ tref > to JSON native types instead of using the
2029
- expanded object form when < a href ="#convert-from-rdf-algorithm "> converting from RDF</ a > .
2030
- < code > xsd:boolean</ code > values will be converted to < tref > true</ tref > or < tref > false</ tref > .
2031
- < code > xsd:integer</ code > and < code > xsd:double</ code > values will be
2032
- converted to
2033
- < tref title ="number "> JSON numbers</ tref > .
2034
- </ dd >
2035
- </ dl >
2036
- </ section >
2037
- </ section >
2038
2018
</ section >
2039
2019
2040
2020
< section class ="appendix ">
0 commit comments