@@ -767,9 +767,12 @@ <h2>Expansion Algorithm</h2>
767767 < tref > JSON-LD input</ tref > to be a well-formed JSON-LD document as defined in [[!JSON-LD]].</ p >
768768
769769 < ol class ="algorithm ">
770- < li > If < em > element</ em > is a < tref > scalar</ tref > or < tref > null</ tref > , expand it according to the
770+ < li > If < em > element</ em > is a < tref > scalar</ tref > or < tref > null</ tref > ,
771+ set < em > element</ em > to the result of expanding it according to the
771772 < a href ="#value-expansion "> Value Expansion</ a > algorithm, passing copies of the
772- < tref > active context</ tref > and < tref > active property</ tref > and return.</ li >
773+ < tref > active context</ tref > and < tref > active property</ tref > and return. If the
774+ < tref > active property</ tref > is < tref > null</ tref > or < code > @graph</ code >
775+ return < tref > null</ tref > .</ li >
773776 < li > If < em > element</ em > is an < tref > array</ tref > ,
774777 < ol class ="algorithm ">
775778 < li > initialize an empty < tref > array</ tref > < em > result</ em > .</ li >
@@ -782,7 +785,7 @@ <h2>Expansion Algorithm</h2>
782785 < li > Otherwise, if the expanded < em > item</ em > is an < tref > array</ tref > , merge its
783786 entries with < em > result's</ em > entries.</ li >
784787 < li > Otherwise, append < em > item</ em > to < em > result</ em > .</ li >
785- < li > Finally, set < em > element </ em > to < em > result</ em > and return .</ li >
788+ < li > Finally, return < em > result</ em > .</ li >
786789 </ ol >
787790 </ li >
788791 < li > Otherwise, if < em > element</ em > MUST be an object
@@ -811,12 +814,12 @@ <h2>Expansion Algorithm</h2>
811814 < li > If < em > expanded property</ em > is < code > @id</ code > , < em > value</ em > MUST be a < tref > string</ tref > .
812815 Set the < code > @id</ code >
813816 member in < em > result</ em > to the result of expanding < em > value</ em >
814- according the < a href ="#iri-expansion "> IRI Expansion algorithm</ a > (passing < code > true </ code >
815- for the < em > documentRelative </ em > and < em > relabelBlankNodes </ em > flags) .</ li >
817+ according the < a href ="#iri-expansion "> IRI Expansion algorithm</ a > relative to the
818+ < em > document base </ em > and re-labeling < tref title =" blank node " > Blank Nodes </ tref > .</ li >
816819 < li > If < em > expanded property</ em > is < code > @type</ code > , < em > value</ em > MUST be a < tref > string</ tref >
817820 or < tref > array</ tref > of < tref title ="string "> strings</ tref > . Set the < code > @type</ code >
818821 member of < em > result</ em > to the result of expanding < em > value</ em >
819- according the < a href ="#iri-expansion "> IRI Expansion algorithm</ a > relative to the document base
822+ according the < a href ="#iri-expansion "> IRI Expansion algorithm</ a > relative to the < em > document base</ em >
820823 and re-labeling < tref title ="blank node "> Blank Nodes</ tref > , unless that result
821824 is an empty < tref > array</ tref > .</ li >
822825 < li > If < em > expanded property</ em > is < code > @value</ code > , < em > value</ em > MUST be a < tref > scalar</ tref >
@@ -827,19 +830,15 @@ <h2>Expansion Algorithm</h2>
827830 Set the < code > @language</ code > member of < em > result</ em > to the lowercased < em > value</ em > .</ li >
828831 < li > If < em > expanded property</ em > is < code > @annotation</ code > < em > value</ em > MUST be a < tref > string</ tref > .
829832 Set the < code > @annotation</ code > member of < em > result</ em > to < em > value</ em > .</ li >
830- < li > If < em > expanded property</ em > is < code > @set</ code > or < code > @list </ code > , set the
833+ < li > If < em > expanded property</ em > is < code > @set</ code > , < code > @list </ code > , or < code > @graph </ code > , set the
831834 < em > expanded property</ em > member of < em > result</ em > to the result of expanding < em > value</ em > by
832835 recursively using this algorithm, along with the < tref > active context</ tref > and
833- < tref > active property</ tref > .</ li >
834- < li > If < em > expanded property</ em > id < code > @graph</ code > , set the < code > @graph</ code >
835- member of < em > result</ em > to the result of expanding < em > value</ em > by
836- recursively using this algorithm, along with the < tref > active context</ tref > and
837- < code > @graph</ code > as < tref > active property</ tref > .</ li >
836+ < tref > active property</ tref > . If < em > expanded property</ em > is < code > @list</ code >
837+ and < tref > active property</ tref > is < tref > null</ tref > or
838+ < code > @graph</ code > , pass < code > @list</ code > as < tref > active property</ tref > instead.</ li >
838839 < li > Continue with the next < em > property</ em > -< em > value</ em > pair from < em > element</ em > .</ li >
839840 </ ol >
840841 </ li >
841- < li > If < em > expanded property</ em > does not have the form of < tref > blank node identifier</ tref > or an
842- < tref > absolute IRI</ tref > , continue with the next member from < em > element</ em > .</ li >
843842 < li > Otherwise, if < em > property's</ em > < tref > container mapping</ tref > is set to < code > @language</ code > :
844843 < ol class ="algorithm ">
845844 < li > Initialize a new empty < tref > array</ tref > < em > language map values</ em > .</ li >
@@ -866,7 +865,7 @@ <h2>Expansion Algorithm</h2>
866865 < ol class ="algorithm ">
867866 < li > Transform < em > val</ em > to < tref > array</ tref > form, if necessary.</ li >
868867 < li > Expand < em > val</ em > by recursively using this algorithm, using
869- the < tref > active context</ tref > and < tref > active property</ tref > .</ li >
868+ the < tref > active context</ tref > and < em > property</ em > .</ li >
870869 < li > Add to each < em > item</ em > of < em > val</ em > an < code > @annotation</ code > member set to
871870 < em > key</ em > if no such member exists in < em > item</ em > , and append the resulting
872871 < tref > JSON object</ tref > to < em > annotation map values</ em > .</ li >
@@ -879,7 +878,7 @@ <h2>Expansion Algorithm</h2>
879878 copies of the < tref > active context</ tref > and < em > property</ em > as
880879 < tref > active property</ tref > .</ li >
881880 < li > Continue to the next < em > property</ em > -< em > value</ em > pair from < em > element</ em >
882- if < em > value</ em > is < tref > null</ tref > .</ li >
881+ if < em > value</ em > is < tref > null</ tref > and < em > property </ em > .</ li >
883882 < li > If < em > property's</ em > < tref > container mapping</ tref > is set to < code > @list</ code > and
884883 < em > value</ em > is not a < tref > JSON object</ tref > or is a < tref > JSON object</ tref >
885884 without a < code > @list</ code > member, replace < em > value</ em > with a
@@ -901,7 +900,10 @@ <h2>Expansion Algorithm</h2>
901900 </ ol >
902901 </ li >
903902 < li > Set < em > element</ em > to < em > result</ em > .</ li >
904- < li > If the processed < em > element</ em > has an < code > @value</ code > property
903+ < li > If the < tref > active property</ tref > is < tref > null</ tref > or < code > @graph</ code > and
904+ < em > element</ em > has a < code > @value</ code > member without an < code > @annotation</ code > member,
905+ or < em > element</ em > consists of only an < code > @id</ code > member, set < em > element</ em > to < tref > null</ tref > .</ li >
906+ < li > Otherwise, if the processed < em > element</ em > has an < code > @value</ code > property
905907 < ol class ="algorithm ">
906908 < li > Remove any < code > @type</ code > or < code > @language</ code > members with < tref > null</ tref > or empty values.</ li >
907909 < li > Other than < code > @annotation</ code > , < em > element</ em > MUST NOT have more than one other member,
@@ -915,6 +917,7 @@ <h2>Expansion Algorithm</h2>
915917 < code > @annotation</ code > .
916918 Set < em > element</ em > to the value of < code > @set</ code > ; leave < code > @list</ code > untouched.</ li >
917919 < li > If < em > element</ em > has just a < code > @language</ code > property, set < em > element</ em > to < tref > null</ tref > .</ li >
920+ < li > Return < em > element</ em > .</ li >
918921 </ ol >
919922 </ li >
920923 </ ol >
@@ -965,7 +968,7 @@ <h2 id="context">Context Processing</h2>
965968 < li > Otherwise, < em > context</ em > MUST be a < tref > JSON object</ tref > , perform the following steps:
966969 < ol class ="algorithm ">
967970 < li > If the < tref > local context</ tref > does not have a < tref > vocabulary mapping</ tref > , initialize
968- it to the document base.</ li >
971+ it to the < em > document base</ em > .</ li >
969972 < li > If < em > context</ em > has a < code > @vocab</ code > member, it MUST have a value of a
970973 simple < tref > string</ tref > with the lexical form of < tref > absolute IRI</ tref > ,
971974 < tref > Blank Node identifier</ tref > , or < tref > null</ tref > .
@@ -1553,8 +1556,8 @@ <h2>Flattening Algorithm</h2>
15531556 </ ol >
15541557</ section >
15551558
1556- < section >
1557- < h2 > Node Map Generation</ h2 >
1559+ < section id =" node-map-generation " >
1560+ < h2 > Node Map Generation Algorithm </ h2 >
15581561 < p > The Node Map Generation algorithm takes as input an expanded JSON-LD document and results in a < tref > JSON object</ tref >
15591562 < em > nodeMap</ em > holding a flat representation of the graphs and < tref title ="node "> nodes</ tref > represented in the document. All < tref title ="node "> nodes</ tref > that are not
15601563 uniquely identified by an IRI get assigned a (new) < tref > blank node identifier</ tref > . The resulting < em > nodeMap</ em >
@@ -1608,9 +1611,12 @@ <h2>Node Map Generation</h2>
16081611 a new array < em > flattenedList</ em > as < em > list</ em > . Create a new < tref > JSON object</ tref > with the
16091612 property < code > @list</ code > set to < em > flattenedList</ em > and add it to < em > node</ em > for
16101613 < em > property</ em > .</ li >
1611- < li > Otherwise, if < em > property</ em > is < code > @type</ code > and < em > v</ em > is not an < tref > IRI</ tref > ,
1612- generate a < a href ="#generate-blank-node-identifier "> new blank node identifier</ a > and add it
1613- to < em > node</ em > for < em > property</ em > .</ li >
1614+ < li > If < tref > active property</ tref > is < tref > null</ tref > or < code > @graph</ code > ,
1615+ < a href ="#generate-blank-node-identifier "> generate a blank node identifier</ a > < em > id</ em >
1616+ and store < em > result</ em > as value of the member < em > id</ em > in < em > activeGraph</ em > .</ li >
1617+ < li > Otherwise, if < em > property</ em > is < code > @type</ code > and < em > v</ em > is not an < tref > IRI</ tref > ,
1618+ generate a < a href ="#generate-blank-node-identifier "> new blank node identifier</ a > and add it
1619+ to < em > node</ em > for < em > property</ em > .</ li >
16141620 < li > Otherwise, add < em > v</ em > to < em > node</ em > for < em > property</ em > .</ li >
16151621 </ ol >
16161622 </ li >
0 commit comments