@@ -975,16 +975,23 @@ <h2>Context Processing Algorithm</h2>
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
977
the < a > vocabulary mapping</ a > and the < a > default language</ a > . Each
978
- < a > term definition</ a > consists of an < dfn > IRI mapping</ dfn > , a boolean
979
- flag < dfn > reverse property</ dfn > , an optional < dfn > type mapping</ dfn >
980
- or < dfn > language mapping</ dfn > ,
981
- < span class ="changed "> an optional < a > context</ a > </ span > ,
982
- < span class ="changed "> an optional < dfn > nest value</ dfn > ,</ span >
983
- < span class ="changed "> an optional < dfn > prefix flag</ dfn > ,</ span >
984
- < span class ="changed "> an optional < dfn > index mapping</ dfn > ,</ span >
985
- < span class ="changed "> a < dfn > protected</ dfn > , used to mark this as a protected term,</ span >
986
- and an optional < dfn > container mapping</ dfn > .
987
- A < a > term definition</ a > can not only be used to map a < a > term</ a >
978
+ < a > term definition</ a > consists of:</ p >
979
+ < ul >
980
+ < li > an < dfn > IRI mapping</ dfn > ,</ li >
981
+ < 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
+ < li > an optional < dfn > type mapping</ dfn > , or < dfn > language mapping</ dfn > ,</ li >
986
+ < li class ="changed "> an optional < a > context</ a > ,</ li >
987
+ < li class ="changed "> an optional < dfn > nest value</ dfn > ,</ li >
988
+ < li class ="changed "> an optional < dfn > prefix flag</ dfn > ,</ li >
989
+ < li class ="changed "> an optional < dfn > index mapping</ dfn > ,</ li >
990
+ < li class ="changed "> a < dfn > protected</ dfn > , used to mark this as a protected term,</ li >
991
+ < li > and an optional < dfn > container mapping</ dfn > </ li > .
992
+ </ ul >
993
+
994
+ < p > A < a > term definition</ a > can not only be used to map a < a > term</ a >
988
995
to an IRI, but also to map a < a > term</ a > to a < a > keyword</ a > ,
989
996
in which case it is referred to as a < dfn > keyword alias</ dfn > .</ p >
990
997
@@ -1055,13 +1062,15 @@ <h3>Algorithm</h3>
1055
1062
1056
1063
< p > This algorithm specifies how a new < a > active context</ a > is updated
1057
1064
with a < a > local context</ a > . The algorithm takes two required
1058
- < span class ="changed "> and two optional</ span >
1065
+ < span class ="changed "> and three optional</ span >
1059
1066
input variables.
1060
1067
The required inputs are an < var > active context</ var > and a < var > local context</ var > .
1061
1068
The optional inputs are an < a > array</ a > < var > remote contexts</ var > ,
1062
- defaulting to a new empty < a > array</ a > , which is used to detect cyclical context inclusions.
1063
- < span class ="changed "> and < var > from term</ var > , defaulting to < code > false</ code > ,
1064
- which is used to allow changes to protected terms.</ span > .
1069
+ defaulting to a new empty < a > array</ a > , which is used to detect cyclical context inclusions,
1070
+ < span class ="changed "> , < var > from property</ var > , defaulting to < code > false</ code > ,
1071
+ which is used to allow changes to protected terms,
1072
+ and < var > from type</ var > , defaulting to < code > false</ code > ,
1073
+ which is used to mark < a > term definitions</ a > associated with a type-scoped < a > context</ a > .</ span > .
1065
1074
</ p >
1066
1075
1067
1076
< ol >
@@ -1075,7 +1084,7 @@ <h3>Algorithm</h3>
1075
1084
< ol >
1076
1085
< li > If < var > context</ var > is < code > null</ code > :
1077
1086
< ol >
1078
- < li class ="changed "> If < var > from term </ var > is < code > false</ code > and < var > active context</ var >
1087
+ < li class ="changed "> If < var > from property </ var > is < code > false</ code > and < var > active context</ var >
1079
1088
contains any < a > protected</ a > < a > term definitions</ a > ,
1080
1089
an < a data-link-for ="JsonLdErrorCode "> invalid context nullification</ a >
1081
1090
has been detected and processing is aborted.</ li >
@@ -1213,7 +1222,7 @@ <h3>Algorithm</h3>
1213
1222
< var > defined</ var > ,
1214
1223
< span class ="changed "> the value of the < code > @protected</ code >
1215
1224
member from < var > context</ var > , if any, for < var > protected</ var > </ span > ,
1216
- and < var > from term </ var > .</ li >
1225
+ < var > from property </ var > , and < var > from type </ var > .</ li >
1217
1226
</ ol >
1218
1227
</ li >
1219
1228
< li > Return < var > result</ var > .</ li >
@@ -1258,14 +1267,16 @@ <h3>Overview</h3>
1258
1267
< section class ="algorithm ">
1259
1268
< h3 > Algorithm</ h3 >
1260
1269
1261
- < p > The algorithm has four required < span class ="changed "> and two optional</ span > inputs.
1270
+ < p > The algorithm has four required < span class ="changed "> and three optional</ span > inputs.
1262
1271
The required inputs are
1263
1272
an < var > active context</ var > , a < var > local context</ var > ,
1264
1273
a < var > term</ var > , and a map < var > defined</ var > .
1265
1274
< span class ="changed "> The optional inputs are
1266
1275
< var > protected</ var > which defaults to < code > false</ code > ,
1267
- and < var > from term</ var > , defaulting to < code > false</ code > ,
1268
- which is used to allow changes to protected terms.</ span > .
1276
+ < var > from property</ var > , defaulting to < code > false</ code > ,
1277
+ 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 > .
1269
1280
</ p >
1270
1281
< ol >
1271
1282
< li > If < var > defined</ var > contains the < a > member</ a > < var > term</ var > and the associated
@@ -1290,18 +1301,22 @@ <h3>Algorithm</h3>
1290
1301
< var > term</ var > MUST NOT be a < a > keyword</ a > and a
1291
1302
< a data-link-for ="JsonLdErrorCode "> keyword redefinition</ a >
1292
1303
error has been detected and processing is aborted.</ li >
1293
- < li class ="changed "> If < var > from term</ var > is < code > false</ code >
1294
- and < var > active context</ var > has an existing
1295
- < a > term definition</ a > for < var > term</ var > which is protected,
1304
+ < li class ="changed "> Set < var > previous definition</ var > to any existing
1305
+ < a > term definition</ a > for < var > term</ var > in < var > active context</ var > .</ li >
1306
+ < li class ="changed "> If < var > from property</ var > is < code > false</ code >
1307
+ and < var > previous definition</ var > exists and is protected,
1296
1308
a < a data-link-for ="JsonLdErrorCode "> protected term redefinition</ a > error has been detected,
1297
1309
and processing is aborted.</ li >
1298
- < li > Otherwise, remove any existing < a > term definition</ a > for < var > term </ var > in
1310
+ < li > Otherwise, remove any < var > previous definition</ var > from
1299
1311
< var > active context</ var > .</ li >
1300
1312
< li > If < var > value</ var > is < code > null</ code > or < var > value</ var >
1301
1313
is a < a class ="changed "> dictionary</ a > containing the key-value pair
1302
1314
< code > @id</ code > -< code > null</ code > , set the
1303
1315
< a > term definition</ a > in < var > active context</ var > to
1304
- < code > null</ code > , set the value associated with < var > defined</ var > 's
1316
+ < 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
+ and set the value associated with < var > defined</ var > 's
1305
1320
< a > member</ a > < var > term</ var > to < code > true</ code > , and return.</ li >
1306
1321
< li > Otherwise, if < var > value</ var > is a < a > string</ a > , convert it
1307
1322
to a < a class ="changed "> dictionary</ a > consisting of a single < a > member</ a > whose
@@ -1311,7 +1326,9 @@ <h3>Algorithm</h3>
1311
1326
< a data-link-for ="JsonLdErrorCode "> invalid term definition</ a >
1312
1327
error has been detected and processing is aborted.
1313
1328
< span class ="changed "> Set < var > simple term</ var > to < code > false</ code > </ span > .</ li >
1314
- < li > Create a new < a > term definition</ a > , < var > definition</ var > .</ 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 >
1315
1332
< li class ="changed "> If the < code > @protected</ code > member in < var > value</ var >
1316
1333
is < code > true</ code > , or there is no < code > @protected</ code > member in < var > value</ var >
1317
1334
and the < var > protected</ var > parameter is < code > true</ code > ,
@@ -1484,7 +1501,7 @@ <h3>Algorithm</h3>
1484
1501
< code > @context</ code > < a > member</ a > , which is treated as a < var > local context</ var > .</ li >
1485
1502
< li > Invoke the < a href ="#context-processing-algorithm "> Context Processing algorithm</ a >
1486
1503
using the < var > active context</ var > , < var > context</ var > as < var > local context</ var > ,
1487
- and < code > true</ code > for < var > from term </ var > .
1504
+ and < code > true</ code > for < var > from property </ var > .
1488
1505
If any error is detected, an
1489
1506
< a data-link-for ="JsonLdErrorCode "> invalid scoped context</ a > error
1490
1507
has been detected and processing is aborted.</ li >
@@ -1542,6 +1559,34 @@ <h3>Algorithm</h3>
1542
1559
</ section >
1543
1560
</ section > <!-- end of Term Creation -->
1544
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
+
1545
1590
< section >
1546
1591
< h2 > IRI Expansion</ h2 >
1547
1592
@@ -1723,14 +1768,16 @@ <h3>Overview</h3>
1723
1768
< section class ="algorithm ">
1724
1769
< h3 > Algorithm</ h3 >
1725
1770
1726
- < p > The algorithm takes three required < span class ="changed "> and two optional</ span > input variables.
1771
+ < p > The algorithm takes three required < span class ="changed "> and three optional</ span > input variables.
1727
1772
The required inputs are an < var > active context</ var > ,
1728
1773
an < var > active property</ var > , and an < var > element</ var > to be expanded.
1729
1774
< span class ="changed "> The optional inputs are the
1730
1775
< a data-link-for ="JsonLdOptions "> frameExpansion</ a >
1731
1776
flag allowing special forms of input used for < a data-cite ="JSON-LD11-FRAMING#dfn-framing "> frame expansion</ a > ,
1732
- and the < a data-link-for ="JsonLdOptions "> ordered</ a > flag, used to order
1733
- < a > dictionary member</ a > keys lexicographically, where noted</ span > .
1777
+ the < a data-link-for ="JsonLdOptions "> ordered</ a > flag, used to order
1778
+ < a > dictionary member</ a > keys lexicographically, where noted,
1779
+ and the < var > from map</ var > flag, used to control reverting
1780
+ previous < a > term definitions</ a > in the < a > active context</ a > associated with a type-scoped < a > context</ a > .</ span >
1734
1781
To begin, the < var > active property</ var > is set to < code > null</ code > ,
1735
1782
and < var > element</ var > is set to the < a > JSON-LD input</ a > .
1736
1783
< span class ="changed "> If not passed, the both flags are set to < code > false</ code > </ span > .</ p >
@@ -1780,7 +1827,8 @@ <h3>Algorithm</h3>
1780
1827
algorithm recursively, passing < var > active context</ var > ,
1781
1828
< var > active property</ var > , < var > item</ var > as < var > element</ var > ,
1782
1829
< span class ="changed "> the < a data-link-for ="JsonLdOptions "> frameExpansion</ a >
1783
- and < a data-link-for ="JsonLdOptions "> ordered</ a > </ span > flags.</ li >
1830
+ < a data-link-for ="JsonLdOptions "> ordered</ a > </ span > ,
1831
+ and < var > from map</ var > flags.</ li >
1784
1832
< li class ="changed "> If the < a > container mapping</ a >
1785
1833
of < var > active property</ var > includes < code > @list</ code > ,
1786
1834
and < var > expanded item</ var > is an
@@ -1802,6 +1850,10 @@ <h3>Algorithm</h3>
1802
1850
< a href ="#context-processing-algorithm "> Context Processing algorithm</ a > ,
1803
1851
passing < var > active context</ var > and the value of the
1804
1852
< 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 >
1805
1857
< li class ="changed "> For each < var > key</ var > /< var > value</ var > pair in < var > element</ var >
1806
1858
where < var > key</ var > expands to < code > @type</ code > using the
1807
1859
< a href ="#iri-expansion "> IRI Expansion algorithm</ a > ,
@@ -1813,8 +1865,9 @@ <h3>Algorithm</h3>
1813
1865
has a < a > local context</ a > , set < var > active context</ var > to the result
1814
1866
to the result of the
1815
1867
< a href ="#context-processing-algorithm "> Context Processing algorithm</ a > ,
1816
- passing < var > active context</ var > and the value of the
1817
- < var > term</ var > 's < a > local context</ a > as < var > local context</ var > .</ li >
1868
+ passing < var > active context</ var > , the value of the
1869
+ < var > term</ var > 's < a > local context</ a > as < var > local context</ var > ,
1870
+ < span class ="changed "> and < code > true</ code > for < var > from type</ var > </ span > .</ li >
1818
1871
</ ol >
1819
1872
</ li >
1820
1873
< li > Initialize an empty < a class ="changed "> dictionary</ a > , < var > result</ var > .</ li >
@@ -2012,7 +2065,7 @@ <h3>Algorithm</h3>
2012
2065
< a href ="#context-processing-algorithm "> Context Processing algorithm</ a > ,
2013
2066
passing < var > active context</ var > , the value of the
2014
2067
< var > key</ var > 's < a > local context</ a > as < var > local context</ var > ,
2015
- and < code > true</ code > for < var > from term </ var > . Otherwise,
2068
+ and < code > true</ code > for < var > from property </ var > . Otherwise,
2016
2069
set < var > term context</ var > to < var > active context</ var > .</ li >
2017
2070
< li > Set < var > container mapping</ var > to < var > key</ var > 's < a > container mapping</ a > in
2018
2071
< var class ="changed "> term context</ var > .</ li >
@@ -2068,15 +2121,21 @@ <h3>Algorithm</h3>
2068
2121
in < var > value</ var > , ordered lexicographically by < var > index</ var >
2069
2122
< span class ="changed "> if < a data-link-for ="JsonLdOptions "> ordered</ a > is < code > true</ code > </ span > :
2070
2123
< ol >
2071
- < li class ="changed "> If < var > container mapping</ var > includes < code > @type</ code > ,
2072
- and < var > index</ var > 's < a > term definition</ a > in
2073
- < var > term context</ var > has a < a > local context</ a > , set
2074
- < var > map context</ var > to the result of the < a
2075
- href ="#context-processing-algorithm "> Context Processing
2076
- algorithm</ a > , passing < var > term context</ var > as < var > active context</ var > and the
2077
- value of the < var > index</ var > 's < a > local context</ a > as
2078
- < var > local context</ var > . Otherwise, set < var > map context</ var >
2079
- to < var > term context</ var > .</ li >
2124
+ < li class ="changed "> If < var > container mapping</ var > includes < code > @type</ code > :
2125
+ < 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 >
2129
+ < li > If < var > index</ var > 's < a > term definition</ a > in
2130
+ < var > map context</ var > has a < a > local context</ a > , update
2131
+ < var > map context</ var > to the result of the
2132
+ < a href ="#context-processing-algorithm "> Context Processingalgorithm</ a > ,
2133
+ passing < var > map context</ var > as < var > active context</ var >
2134
+ and the value of the < var > index</ var > 's < a > local context</ a >
2135
+ as < var > local context</ var > .</ li >
2136
+ </ ol >
2137
+ </ li >
2138
+ < li > Otherwise, set < var > map context</ var > to < var > term context</ var > .</ li >
2080
2139
< li > Set < var > expanded index</ var > to the result of using the
2081
2140
< a href ="#iri-expansion "> IRI Expansion algorithm</ a > ,
2082
2141
passing < var > active context</ var > , < var > index</ var > , and < code > true</ code >
@@ -2459,7 +2518,7 @@ <h3>Algorithm</h3>
2459
2518
< a href ="#context-processing-algorithm "> Context Processing algorithm</ a > ,
2460
2519
passing < var > active context</ var > , the value of the
2461
2520
< var > active property</ var > 's < a > local context</ a > as < var > local context</ var > ,
2462
- < span class ="changed "> and < code > true</ code > for < var > from term </ var > </ span > .</ li >
2521
+ < span class ="changed "> and < code > true</ code > for < var > from property </ var > </ span > .</ li >
2463
2522
< li > Set < var > inverse context</ var > using the
2464
2523
< a href ="#inverse-context-creation "> Inverse Context Creation algorithm</ a >
2465
2524
using < var > active context</ var > .</ li >
@@ -2517,13 +2576,17 @@ <h3>Algorithm</h3>
2517
2576
< var > active property</ var > equals < code > @reverse</ code > ,
2518
2577
otherwise to < code > false</ code > .</ li >
2519
2578
< li > Initialize < var > result</ var > to an empty < a class ="changed "> dictionary</ a > .</ li >
2579
+ < li > Replace < var > active context</ var > with the result of the
2580
+ < a href ="#revert-type-scoped-terms "> Revert Type Scoped Terms</ a > algorithm,
2581
+ passing < var > active context</ var > .</ li >
2520
2582
< li class ="changed "> If < var > element</ var > has a < code > @type</ code > < a > member</ a > ,
2521
2583
create a new array < var > compacted types</ var > initialized
2522
2584
by transforming each < var > expanded type</ var > of that < a > member</ a >
2523
2585
into it's compacted form using the < a href ="#iri-compaction "> IRI Compaction algorithm</ a > ,
2524
2586
passing < var > active context</ var > , < var > inverse context</ var > ,
2525
- < var > expanded type</ var > for < var > var</ var > , and
2526
- < code > true</ code > for < var > vocab</ var > . Then, for each < var > term</ var >
2587
+ < var > expanded type</ var > for < var > var</ var > , < code > true</ code > for < var > vocab</ var > ,
2588
+ and < code > true</ code > for < var > from type</ var > .
2589
+ Then, for each < var > term</ var >
2527
2590
in < var > compacted types</ var > ordered lexicographically:
2528
2591
< ol >
2529
2592
< li > If the < a > term definition</ a > for < var > term</ var > has a
0 commit comments