@@ -974,14 +974,13 @@ <h2>Context Processing Algorithm</h2>
974
974
< p > The < a > active context</ a > contains the active
975
975
< a > term definitions</ a > which specify how
976
976
keys and values have to be interpreted as well as the current < a > base IRI</ a > ,
977
- the < a > vocabulary mapping</ a > and the < a > default language</ a > . Each
978
- < a > term definition</ a > consists of:</ p >
977
+ the < a > vocabulary mapping</ a > , the < a > default language</ a > ,
978
+ < span class ="changed "> and an optional < dfn > previous context</ dfn > ,
979
+ used when a type-scoped < a > context</ a > is defined</ span > .
980
+ Each < a > term definition</ a > consists of:</ p >
979
981
< ul >
980
982
< li > an < dfn > IRI mapping</ dfn > ,</ li >
981
983
< li > a boolean flag < dfn > reverse property</ dfn > ,</ li >
982
- < li class ="changed "> a boolean flag < dfn > from type</ dfn > ,</ li >
983
- < li class ="changed "> a < dfn > previous definition</ dfn >
984
- used to record any previous < a > term definition</ a > ,</ li >
985
984
< li > an optional < dfn > type mapping</ dfn > , or < dfn > language mapping</ dfn > ,</ li >
986
985
< li class ="changed "> an optional < a > context</ a > ,</ li >
987
986
< li class ="changed "> an optional < dfn > nest value</ dfn > ,</ li >
@@ -1079,6 +1078,10 @@ <h3>Algorithm</h3>
1079
1078
< li > If < var > local context</ var > is not an < a > array</ a > ,
1080
1079
set it to an < a > array</ a > containing only
1081
1080
< var > local context</ var > .</ li >
1081
+ < li class ="changed ">
1082
+ If < var > from type</ var > is < code > true</ code > , and < var > result</ var >
1083
+ does not have a < a > previous context</ a > , set < a > previous context</ a >
1084
+ in < var > result</ var > to < var > active context</ var > .</ li >
1082
1085
< li >
1083
1086
For each item < var > context</ var > in < var > local context</ var > :
1084
1087
< ol >
@@ -1089,8 +1092,10 @@ <h3>Algorithm</h3>
1089
1092
an < a data-link-for ="JsonLdErrorCode "> invalid context nullification</ a >
1090
1093
has been detected and processing is aborted.</ li >
1091
1094
< li > Otherwise, set < var > result</ var > to a
1092
- newly-initialized < var > active context</ var > and continue with the
1093
- next < var > context</ var > .
1095
+ newly-initialized < var > active context</ var > ,
1096
+ < span class ="changed "> setting < a > previous context</ a > in < var > result</ var >
1097
+ to the previous value of < var > result</ var > if < var > from type</ var > is < code > true</ code > </ span > .
1098
+ Continue with the next < var > context</ var > .
1094
1099
< span class ="note "> In JSON-LD 1.0, the < a > base IRI</ a > was given
1095
1100
a default value here; this is now described conditionally
1096
1101
in < a href ="#the-application-programming-interface " class ="sectionRef "> </ a > .</ span > </ li >
@@ -1275,8 +1280,7 @@ <h3>Algorithm</h3>
1275
1280
< var > protected</ var > which defaults to < code > false</ code > ,
1276
1281
< var > from property</ var > , defaulting to < code > false</ code > ,
1277
1282
which is used to allow changes to protected terms,
1278
- and < var > from type</ var > , defaulting to < code > false</ code > ,
1279
- which is used to mark < a > term definitions</ a > associated with a type-scoped < a > context</ a > .</ span > .
1283
+ and < var > from type</ var > , defaulting to < code > false</ code > .</ span > .
1280
1284
</ p >
1281
1285
< ol >
1282
1286
< li > If < var > defined</ var > contains the < a > member</ a > < var > term</ var > and the associated
@@ -1314,8 +1318,6 @@ <h3>Algorithm</h3>
1314
1318
< code > @id</ code > -< code > null</ code > , set the
1315
1319
< a > term definition</ a > in < var > active context</ var > to
1316
1320
< code > null</ code > ,
1317
- < span class ="changed "> along with < a > from type</ a > from < var > from type</ var >
1318
- and < a > previous definition</ a > from < var > previous definition</ var > ,</ span >
1319
1321
and set the value associated with < var > defined</ var > 's
1320
1322
< a > member</ a > < var > term</ var > to < code > true</ code > , and return.</ li >
1321
1323
< li > Otherwise, if < var > value</ var > is a < a > string</ a > , convert it
@@ -1326,9 +1328,7 @@ <h3>Algorithm</h3>
1326
1328
< a data-link-for ="JsonLdErrorCode "> invalid term definition</ a >
1327
1329
error has been detected and processing is aborted.
1328
1330
< span class ="changed "> Set < var > simple term</ var > to < code > false</ code > </ span > .</ li >
1329
- < li > Create a new < a > term definition</ a > , < var > definition</ var > ,
1330
- including < a > from type</ a > from < var > from type</ var >
1331
- and < a > previous definition</ a > from < var > previous definition</ var > .</ li >
1331
+ < li > Create a new < a > term definition</ a > , < var > definition</ var > .</ li >
1332
1332
< li class ="changed "> If the < code > @protected</ code > member in < var > value</ var >
1333
1333
is < code > true</ code > , or there is no < code > @protected</ code > member in < var > value</ var >
1334
1334
and the < var > protected</ var > parameter is < code > true</ code > ,
@@ -1559,34 +1559,6 @@ <h3>Algorithm</h3>
1559
1559
</ section >
1560
1560
</ section > <!-- end of Term Creation -->
1561
1561
1562
- < section class ="changed algorithm "> < h2 > Revert Type Scoped Terms</ h2 >
1563
- < p > This algorithm returns a new < a > context</ a > based on the < a > active context</ a >
1564
- where any < a > term definitions</ a > which were created as part of a type-scoped < a > context</ a >
1565
- are replaced with any previous term definitions, or removed.</ p >
1566
-
1567
- < p > The algorithm takes a single required parameter < var > active context</ var > </ p >
1568
- < ol >
1569
- < li > If < var > active context</ var > contains no < a > term definitions</ a >
1570
- where < var > from type</ var > is < code > true</ code > , return < var > active context</ var > .</ li >
1571
- < li > Initialize < var > result</ var > to the result of cloning < var > active context</ var > .</ li >
1572
- < li > For each < a > member</ a > < a > term definition</ a > with key < var > term</ var > and value < var > definition</ var > in < var > result</ var > :
1573
- < ol >
1574
- < li > If < var > definition</ var > has < var > from type</ var > with a value of < code > true</ code > :
1575
- < ol >
1576
- < li > Set < var > previous definition</ var > to any < a > previous definition</ a >
1577
- in < var > definition</ var > .</ li >
1578
- < li > If < var > previous definition</ var > is undefined,
1579
- remove < var > term</ var > and < var > definition</ var > from < var > result</ var > .</ li >
1580
- < li > Otherwise, update the < a > member</ a > value for < var > term</ var > in < var > result</ var >
1581
- with < var > previous definition</ var > .</ li >
1582
- </ ol >
1583
- </ li >
1584
- </ ol >
1585
- </ li >
1586
- < li > Return < var > result</ var > .</ li >
1587
- </ ol >
1588
- </ section >
1589
-
1590
1562
< section >
1591
1563
< h2 > IRI Expansion</ h2 >
1592
1564
@@ -1808,10 +1780,16 @@ <h3>Algorithm</h3>
1808
1780
< li > If < var > element</ var > is < code > null</ code > , return < code > null</ code > .</ li >
1809
1781
< li class ="changed "> If < var > active property</ var > is < code > @default</ code > ,
1810
1782
set the < a data-link-for ="JsonLdOptions "> frameExpansion</ a > flag to < code > false</ code > .</ li >
1783
+ < li class ="changed "> If < var > active property</ var > has a < a > term definition</ a > in < var > active context</ var >
1784
+ has a < a > local context</ a > , set < var > property scoped context</ var > to the that < a > local context</ a > .</ li >
1811
1785
< li > If < var > element</ var > is a < a > scalar</ a > ,
1812
1786
< ol >
1813
1787
< li > If < var > active property</ var > is < code > null</ code > or < code > @graph</ code > ,
1814
1788
drop the free-floating < a > scalar</ a > by returning < code > null</ code > .</ li >
1789
+ < li class ="changed "> If < var > property scoped context</ var > is defined,
1790
+ set < var > active context</ var > to the result of the
1791
+ < a href ="#context-processing-algorithm "> Context Processing algorithm</ a > ,
1792
+ passing < var > active context</ var > and < var > property scoped context</ var > as < var > local context</ var > .</ li >
1815
1793
< li > Return the result of the
1816
1794
< a href ="#value-expansion "> Value Expansion algorithm</ a > , passing the
1817
1795
< var > active context</ var > , < var > active property</ var > , and
@@ -1845,15 +1823,25 @@ <h3>Algorithm</h3>
1845
1823
</ ol >
1846
1824
</ li >
1847
1825
< li > Otherwise < var > element</ var > is a < a class ="changed "> dictionary</ a > .</ li >
1826
+ < li class ="changed "> If < var > active context</ var > has a < a > previous context</ a > ,
1827
+ the < a > context</ a > is type-scoped.
1828
+ If < var > from map</ var > is undefined or < code > false</ code > ,
1829
+ and < var > element</ var > does not contain a < a > member</ a > expanding to < code > @value</ code > ,
1830
+ and < var > element</ var > does not consist of a single member expanding to < code > @id</ code > ,
1831
+ set < var > active context</ var > to < a > previous context</ a > from < var > active context</ var > ,
1832
+ as the scope of a term-scoped < a > context</ a > does not apply when processing new < a > node objects</ a > .</ li >
1833
+ < li class ="changed "> If < var > property scoped context</ var > is defined,
1834
+ set < var > active context</ var > to the result of the
1835
+ < a href ="#context-processing-algorithm "> Context Processing algorithm</ a > ,
1836
+ passing < var > active context</ var > and < var > property scoped context</ var > as < var > local context</ var > .</ li >
1848
1837
< li > If < var > element</ var > contains the < a > member</ a > < code > @context</ code > , set
1849
1838
< var > active context</ var > to the result of the
1850
1839
< a href ="#context-processing-algorithm "> Context Processing algorithm</ a > ,
1851
1840
passing < var > active context</ var > and the value of the
1852
1841
< code > @context</ code > < a > member</ a > as < var > local context</ var > .</ li >
1853
- < li > Unless the < var > from map</ var > flag is true,
1854
- replace < var > active context</ var > with the result of the
1855
- < a href ="#revert-type-scoped-terms "> Revert Type Scoped Terms</ a > algorithm,
1856
- passing < var > active context</ var > .</ li >
1842
+ < li class ="changed "> Set < var > type scoped context</ var > to < var > active context</ var > .
1843
+ This is used for expanding values that may be relevant to any previous
1844
+ type-scoped < a > context</ a > .</ li >
1857
1845
< li class ="changed "> For each < var > key</ var > /< var > value</ var > pair in < var > element</ var >
1858
1846
where < var > key</ var > expands to < code > @type</ code > using the
1859
1847
< a href ="#iri-expansion "> IRI Expansion algorithm</ a > ,
@@ -1918,7 +1906,8 @@ <h3>Algorithm</h3>
1918
1906
error has been detected and processing is aborted. Otherwise,
1919
1907
set < var > expanded value</ var > to the result of using the
1920
1908
< a href ="#iri-expansion "> IRI Expansion algorithm</ a > , passing
1921
- < var > active context</ var > , < code > true</ code > for < var > vocab</ var > ,
1909
+ < var class ="changed "> type scoped context</ var > for < var > active context</ var > ,
1910
+ < code > true</ code > for < var > vocab</ var > ,
1922
1911
and < code > true</ code > for < var > document relative</ var > to expand the < var > value</ var >
1923
1912
or each of its items.
1924
1913
< span class ="changed ">
@@ -2060,15 +2049,8 @@ <h3>Algorithm</h3>
2060
2049
< li > Continue with the next < var > key</ var > from < var > element</ var > .</ li >
2061
2050
</ ol >
2062
2051
</ li >
2063
- < li class ="changed "> If < var > key</ var > 's < a > term definition</ a > in < var > active context</ var >
2064
- has a < a > local context</ a > , set < var > term context</ var > to the result of the
2065
- < a href ="#context-processing-algorithm "> Context Processing algorithm</ a > ,
2066
- passing < var > active context</ var > , the value of the
2067
- < var > key</ var > 's < a > local context</ a > as < var > local context</ var > ,
2068
- and < code > true</ code > for < var > from property</ var > . Otherwise,
2069
- set < var > term context</ var > to < var > active context</ var > .</ li >
2070
2052
< li > Set < var > container mapping</ var > to < var > key</ var > 's < a > container mapping</ a > in
2071
- < var class =" changed " > term context</ var > .</ li >
2053
+ < var > active context</ var > .</ li >
2072
2054
< li class ="changed "> If < var > key</ var > 's < a > term definition</ a > in < var > active context</ var >
2073
2055
has a < a > type mapping</ a > of < code > @json</ code > ,
2074
2056
set < var > expanded value</ var > to a new < a > dictionary</ a > , set the < a > member</ a >
@@ -2123,9 +2105,8 @@ <h3>Algorithm</h3>
2123
2105
< ol >
2124
2106
< li class ="changed "> If < var > container mapping</ var > includes < code > @type</ code > :
2125
2107
< ol >
2126
- < li > Set < var > map context</ var > to the result of calling the
2127
- < a href ="#revert-type-scoped-terms "> Revert Type Scoped Terms</ a > algorithm
2128
- passing < var > term context</ var > as < var > active context</ var > .</ li >
2108
+ < li > Set < var > map context</ var > to the < a > previous context</ a >
2109
+ from < var > active context</ var > if it exists, or < var > active context</ var > otherwise.</ li >
2129
2110
< li > If < var > index</ var > 's < a > term definition</ a > in
2130
2111
< var > map context</ var > has a < a > local context</ a > , update
2131
2112
< var > map context</ var > to the result of the
@@ -2135,7 +2116,7 @@ <h3>Algorithm</h3>
2135
2116
as < var > local context</ var > .</ li >
2136
2117
</ ol >
2137
2118
</ li >
2138
- < li > Otherwise, set < var > map context</ var > to < var > term context</ var > .</ li >
2119
+ < li > Otherwise, set < var > map context</ var > to < var > active context</ var > .</ li >
2139
2120
< li > Set < var > expanded index</ var > to the result of using the
2140
2121
< a href ="#iri-expansion "> IRI Expansion algorithm</ a > ,
2141
2122
passing < var > active context</ var > , < var > index</ var > , and < code > true</ code >
@@ -2195,7 +2176,7 @@ <h3>Algorithm</h3>
2195
2176
</ ol >
2196
2177
</ li >
2197
2178
< li > Otherwise, initialize < var > expanded value</ var > to the result of
2198
- using this algorithm recursively, passing < var class =" changed " > term context </ var > as < var > active context</ var > ,
2179
+ using this algorithm recursively, passing < var > active context</ var > ,
2199
2180
< var > key</ var > for < var > active property</ var > , < var > value</ var > for < var > element</ var > ,
2200
2181
< span class ="changed "> and the < a data-link-for ="JsonLdOptions "> frameExpansion</ a >
2201
2182
and < a data-link-for ="JsonLdOptions "> ordered</ a > flags</ span > .</ li >
0 commit comments