@@ -903,7 +903,7 @@ <h3>Algorithm</h3>
903
903
</ li >
904
904
< li > If < em > value</ em > contains the key < code > @reverse</ code > :
905
905
< ol class ="algorithm ">
906
- < li > If < em > value</ em > contains an < code > @id</ code > , member , an
906
+ < li > If < em > value</ em > contains < code > @id</ code > or < code > @nest </ code > , members , an
907
907
< a data-link-for ="JsonLdErrorCode "> invalid reverse property</ a >
908
908
error has been detected and processing is aborted.</ li >
909
909
< li > If the value associated with the < code > @reverse</ code > key
@@ -1020,9 +1020,18 @@ <h3>Algorithm</h3>
1020
1020
of < em > definition</ em > to < em > language</ em > .</ li >
1021
1021
</ ol >
1022
1022
</ li >
1023
+ < li class ="changed "> If < em > value</ em > contains the key < code > @nest</ code > :
1024
+ < ol class ="algorithm ">
1025
+ < li > Initialize < em > nest</ em > to the value associated with the
1026
+ < code > @nest</ code > key, which must be a < a > string</ a > and
1027
+ must not be a keyword other than < code > @nest</ code > . Otherwise, an
1028
+ < a data-link-for ="JsonLdErrorCode "> invalid @nest value</ a >
1029
+ error has been detected and processing is aborted.</ li >
1030
+ </ ol >
1031
+ </ li >
1023
1032
< li > If the value contains any key other than < code > @id</ code > ,
1024
1033
< code > @reverse</ code > , < code > @container</ code > ,
1025
- < code > @context</ code > , or < code > @type</ code > , an
1034
+ < code > @context</ code > , < code class =" changed " > @nest </ code > , or < code > @type</ code > , an
1026
1035
< a data-link-for ="JsonLdErrorCode "> invalid term definition</ a > error has
1027
1036
been detected and processing is aborted.</ li >
1028
1037
< li > Set the < a > term definition</ a > of < em > term</ em > in
@@ -1270,7 +1279,7 @@ <h3>Algorithm</h3>
1270
1279
passing < a > active context</ a > and the value of the
1271
1280
< code > @context</ code > key as < a > local context</ a > .</ li >
1272
1281
< li > Initialize an empty < a > JSON object</ a > , < em > result</ em > .</ li >
1273
- < li > For each < em > key</ em > and < em > value</ em > in < em > element</ em > ,
1282
+ < li id =" alg-expand-each-key-value " > For each < em > key</ em > and < em > value</ em > in < em > element</ em > ,
1274
1283
ordered lexicographically by < em > key</ em > :
1275
1284
< ol class ="algorithm ">
1276
1285
< li > If < em > key</ em > is < code > @context</ code > , continue to
@@ -1418,6 +1427,10 @@ <h3>Algorithm</h3>
1418
1427
< li > Continue with the next < em > key</ em > from < em > element</ em > .</ li >
1419
1428
</ ol >
1420
1429
</ li >
1430
+ < li class ="changed "> If < em > expanded property</ em > is < code > @nest</ code > ,
1431
+ add < em > key</ em > to < em > nests</ em > , initializing it to an empty < a > array</ a > ,
1432
+ if necessary.
1433
+ Continue with the next < em > key</ em > from < em > element</ em > .</ li >
1421
1434
< li class ="changed "> When the < code > frame expansion</ code > flag is set,
1422
1435
if < em > expanded property</ em > is any other
1423
1436
framing keyword (< code > @explicit</ code > , < code > @default</ code > ,
@@ -1559,6 +1572,22 @@ <h3>Algorithm</h3>
1559
1572
member of < em > result</ em > .</ li >
1560
1573
</ ol >
1561
1574
</ li >
1575
+ < li class ="changed "> For each key < em > nesting-key</ em > in < em > nests</ em >
1576
+ < ol class ="algorithm ">
1577
+ < li > Set < em > nested values</ em > to the value of < em > nesting-key</ em >
1578
+ in < em > element</ em > , ensuring that it is an < a > array</ a > .</ li >
1579
+ < li > For each < em > nested value</ em > in < em > nested values</ em > :
1580
+ < ol class ="algorithm ">
1581
+ < li > If < em > nested value</ em > is not a < a > JSON object</ a > , or any key within
1582
+ < em > nested value</ em > expands to < code > @value</ code > , an
1583
+ < a data-link-for ="JsonLdErrorCode "> invalid @nest value</ a > error
1584
+ has been detected and processing is aborted.</ li >
1585
+ < li > Recursively repeat < a href ="#alg-expand-each-key-value "> step 7</ a >
1586
+ using < em > nested value</ em > for < em > element</ em > .</ li >
1587
+ </ ol >
1588
+ </ li >
1589
+ </ ol >
1590
+ </ li >
1562
1591
</ ol >
1563
1592
</ li >
1564
1593
< li > If < em > result</ em > contains the key < code > @value</ code > :
@@ -1942,7 +1971,22 @@ <h3>Algorithm</h3>
1942
1971
< em > expanded value</ em > for < em > value</ em > ,
1943
1972
< code > true</ code > for < em > vocab</ em > , and
1944
1973
< em > inside reverse</ em > .</ li >
1945
- < li > If < em > result</ em > does not have the key that equals
1974
+ < li class ="changed "> If the < a > term definition</ a > for < em > item active property</ em >
1975
+ in the < em > active context</ em > has a < code > @nest</ code >
1976
+ member, that value (< em > nest term</ em > ) must be
1977
+ < code > @nest</ code > , or a < a > term definition</ a > in the
1978
+ < em > active context</ em > that expands to < code > @nest</ code > ,
1979
+ otherwise an < a data-link-for ="JsonLdErrorCode "> invalid @nest
1980
+ value</ a > error has been detected, and processing is aborted.
1981
+ If < em > result</ em > does not have the key that equals < em > nest
1982
+ term</ em > , initialize it to an empty JSON object (< em > nest
1983
+ object</ em > ). If < em > nest object</ em > does not have the key
1984
+ that equals < em > item active property</ em > , set this key's
1985
+ value in < em > nest object</ em > to an empty
1986
+ < a > array</ a > .Otherwise, if the key's value is not an
1987
+ < a > array</ a > , then set it to one containing only the
1988
+ value.</ li >
1989
+ < li > Otherwise, if < em > result</ em > does not have the key that equals
1946
1990
< em > item active property</ em > , set this key's value in
1947
1991
< em > result</ em > to an empty < a > array</ a > . Otherwise, if
1948
1992
the key's value is not an < a > array</ a > , then set it
@@ -1962,6 +2006,16 @@ <h3>Algorithm</h3>
1962
2006
< em > expanded item</ em > for < em > value</ em > ,
1963
2007
< code > true</ code > for < em > vocab</ em > , and
1964
2008
< em > inside reverse</ em > .</ li >
2009
+ < li class ="changed "> If the < a > term definition</ a > for < em > item active property</ em >
2010
+ in the < em > active context</ em > has a < code > @nest</ code >
2011
+ member, that value (< em > nest term</ em > ) must be
2012
+ < code > @nest</ code > , or a < a > term definition</ a > in the
2013
+ < em > active context</ em > that expands to < code > @nest</ code > ,
2014
+ otherwise an < a data-link-for ="JsonLdErrorCode "> invalid @nest
2015
+ value</ a > error has been detected, and processing is aborted.
2016
+ Set < em > nest result</ em > to the value of < em > nest term</ em > in < em > result</ em > ,
2017
+ initializing it to a new < a > JSON object</ a > , if necessary; otherwise
2018
+ set < em > nest result</ em > to < em > result</ em > .</ li >
1965
2019
< li > Initialize < em > container</ em > to < code > null</ code > . If there
1966
2020
is a < a > container mapping</ a > for
1967
2021
< em > item active property</ em > in < a > active context</ a > ,
@@ -1999,7 +2053,7 @@ <h3>Algorithm</h3>
1999
2053
</ ol >
2000
2054
</ li >
2001
2055
< li > Otherwise, < em > item active property</ em > must not be a key
2002
- in < em > result</ em > because there cannot be two
2056
+ in < em class =" changed " > nest result</ em > because there cannot be two
2003
2057
< a > list objects</ a > associated
2004
2058
with an < a > active property</ a > that has a
2005
2059
< a > container mapping</ a > ; a
@@ -2013,14 +2067,17 @@ <h3>Algorithm</h3>
2013
2067
or < code > @type</ code > </ span > :
2014
2068
< ol class ="algorithm ">
2015
2069
< li > If < em > item active property</ em > is not a key in
2016
- < em > result</ em > , initialize it to an empty < a > JSON object</ a > .
2070
+ < em class =" changed " > nest result</ em > , initialize it to an empty < a > JSON object</ a > .
2017
2071
Initialize < em > map object</ em > to the value of < em > item active property</ em >
2018
- in < em > result</ em > .</ li >
2072
+ in < em class =" changed " > nest result</ em > .</ li >
2019
2073
< li > Set < em > compacted container</ em > to the result of calling the
2020
2074
< a href ="#iri-compaction "> IRI Compaction algorithm</ a >
2021
2075
passing < a > active context</ a > ,
2022
2076
< em > container</ em > as < em > iri</ em > , and < code > true</ code >
2023
2077
for < em > vocab</ em > .</ li >
2078
+ < li > Initialize < em > map key</ em > to the value associated with
2079
+ with the key that equals < em > container</ em > in
2080
+ < em > expanded item</ em > .</ li >
2024
2081
< li > If < em > container</ em > is < code > @language</ code > and
2025
2082
< em > compacted item</ em > contains the key
2026
2083
< code > @value</ code > , then set < em > compacted item</ em >
@@ -2063,9 +2120,9 @@ <h3>Algorithm</h3>
2063
2120
< li > If < em > item active property</ em > is not a key in
2064
2121
< em > result</ em > then add the key-value pair,
2065
2122
(< em > item active property</ em > -< em > compacted item</ em > ),
2066
- to < em > result</ em > .</ li >
2123
+ to < em class =" changed " > nest result</ em > .</ li >
2067
2124
< li > Otherwise, if the value associated with the key that
2068
- equals < em > item active property</ em > in < em > result</ em >
2125
+ equals < em > item active property</ em > in < em class =" changed " > nest result</ em >
2069
2126
is not an < a > array</ a > , set it to a new
2070
2127
< a > array</ a > containing only the value. Then
2071
2128
append < em > compacted item</ em > to the value if
@@ -4082,6 +4139,7 @@ <h4>JsonLdErrorCode</h4>
4082
4139
"cyclic IRI mapping",
4083
4140
"invalid @id value",
4084
4141
"invalid @index value",
4142
+ "invalid @nest value",
4085
4143
"invalid @reverse value",
4086
4144
"invalid base IRI",
4087
4145
"invalid container mapping",
@@ -4133,6 +4191,8 @@ <h4>JsonLdErrorCode</h4>
4133
4191
< dt > < dfn > invalid @index value</ dfn > </ dt >
4134
4192
< dd > An < code > @index</ code > member was encountered whose value was
4135
4193
not a < a > string</ a > .</ dd >
4194
+ < dt class ="changed "> < dfn > invalid @nest value</ dfn > </ dt >
4195
+ < dd class ="changed "> An invalid value for < code > @nest</ code > has been found.</ dd >
4136
4196
< dt > < dfn > invalid @reverse value</ dfn > </ dt >
4137
4197
< dd > An invalid value for an < code > @reverse</ code > member has been detected,
4138
4198
i.e., the value was not a < a > JSON object</ a > .</ dd >
@@ -4242,6 +4302,12 @@ <h2>Changes since 1.0 Recommendation of 16 January 2014</h2>
4242
4302
< li > A new < a href ="#merge-node-maps " class ="sectionRef "> </ a > is required
4243
4303
for framing, to create a single graph from the < a data-lt ="default graph "> default</ a >
4244
4304
and < a > named graphs</ a > .</ li >
4305
+ < li > An < a > expanded term definition</ a > can now have an
4306
+ < code > @nest</ code > property, which identifies a term expanding to
4307
+ < code > @nest</ code > which is used for containing properties using the same
4308
+ < code > @nest</ code > mapping. When expanding, the values of a property
4309
+ expanding to < code > @nest</ code > are treated as if they were contained
4310
+ within the enclosing < a > node object</ a > directly.</ li >
4245
4311
< li > < code > @container</ code > values within an < a > expanded term definition</ a > may now
4246
4312
include < code > @id</ code > and < code > @type</ code > , corresponding to < a > id maps</ a > and < a > type maps</ a > .</ li >
4247
4313
</ ul >
0 commit comments