@@ -767,9 +767,12 @@ <h2>Expansion Algorithm</h2>
767
767
< tref > JSON-LD input</ tref > to be a well-formed JSON-LD document as defined in [[!JSON-LD]].</ p >
768
768
769
769
< 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
771
772
< 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 >
773
776
< li > If < em > element</ em > is an < tref > array</ tref > ,
774
777
< ol class ="algorithm ">
775
778
< li > initialize an empty < tref > array</ tref > < em > result</ em > .</ li >
@@ -782,7 +785,7 @@ <h2>Expansion Algorithm</h2>
782
785
< li > Otherwise, if the expanded < em > item</ em > is an < tref > array</ tref > , merge its
783
786
entries with < em > result's</ em > entries.</ li >
784
787
< 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 >
786
789
</ ol >
787
790
</ li >
788
791
< li > Otherwise, if < em > element</ em > MUST be an object
@@ -811,12 +814,12 @@ <h2>Expansion Algorithm</h2>
811
814
< li > If < em > expanded property</ em > is < code > @id</ code > , < em > value</ em > MUST be a < tref > string</ tref > .
812
815
Set the < code > @id</ code >
813
816
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 >
816
819
< li > If < em > expanded property</ em > is < code > @type</ code > , < em > value</ em > MUST be a < tref > string</ tref >
817
820
or < tref > array</ tref > of < tref title ="string "> strings</ tref > . Set the < code > @type</ code >
818
821
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 >
820
823
and re-labeling < tref title ="blank node "> Blank Nodes</ tref > , unless that result
821
824
is an empty < tref > array</ tref > .</ li >
822
825
< 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>
827
830
Set the < code > @language</ code > member of < em > result</ em > to the lowercased < em > value</ em > .</ li >
828
831
< li > If < em > expanded property</ em > is < code > @annotation</ code > < em > value</ em > MUST be a < tref > string</ tref > .
829
832
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
831
834
< em > expanded property</ em > member of < em > result</ em > to the result of expanding < em > value</ em > by
832
835
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 >
838
839
< li > Continue with the next < em > property</ em > -< em > value</ em > pair from < em > element</ em > .</ li >
839
840
</ ol >
840
841
</ 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 >
843
842
< li > Otherwise, if < em > property's</ em > < tref > container mapping</ tref > is set to < code > @language</ code > :
844
843
< ol class ="algorithm ">
845
844
< li > Initialize a new empty < tref > array</ tref > < em > language map values</ em > .</ li >
@@ -866,7 +865,7 @@ <h2>Expansion Algorithm</h2>
866
865
< ol class ="algorithm ">
867
866
< li > Transform < em > val</ em > to < tref > array</ tref > form, if necessary.</ li >
868
867
< 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 >
870
869
< li > Add to each < em > item</ em > of < em > val</ em > an < code > @annotation</ code > member set to
871
870
< em > key</ em > if no such member exists in < em > item</ em > , and append the resulting
872
871
< tref > JSON object</ tref > to < em > annotation map values</ em > .</ li >
@@ -879,7 +878,7 @@ <h2>Expansion Algorithm</h2>
879
878
copies of the < tref > active context</ tref > and < em > property</ em > as
880
879
< tref > active property</ tref > .</ li >
881
880
< 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 >
883
882
< li > If < em > property's</ em > < tref > container mapping</ tref > is set to < code > @list</ code > and
884
883
< em > value</ em > is not a < tref > JSON object</ tref > or is a < tref > JSON object</ tref >
885
884
without a < code > @list</ code > member, replace < em > value</ em > with a
@@ -901,7 +900,10 @@ <h2>Expansion Algorithm</h2>
901
900
</ ol >
902
901
</ li >
903
902
< 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
905
907
< ol class ="algorithm ">
906
908
< li > Remove any < code > @type</ code > or < code > @language</ code > members with < tref > null</ tref > or empty values.</ li >
907
909
< 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>
915
917
< code > @annotation</ code > .
916
918
Set < em > element</ em > to the value of < code > @set</ code > ; leave < code > @list</ code > untouched.</ li >
917
919
< 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 >
918
921
</ ol >
919
922
</ li >
920
923
</ ol >
@@ -965,7 +968,7 @@ <h2 id="context">Context Processing</h2>
965
968
< li > Otherwise, < em > context</ em > MUST be a < tref > JSON object</ tref > , perform the following steps:
966
969
< ol class ="algorithm ">
967
970
< 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 >
969
972
< li > If < em > context</ em > has a < code > @vocab</ code > member, it MUST have a value of a
970
973
simple < tref > string</ tref > with the lexical form of < tref > absolute IRI</ tref > ,
971
974
< tref > Blank Node identifier</ tref > , or < tref > null</ tref > .
@@ -1553,8 +1556,8 @@ <h2>Flattening Algorithm</h2>
1553
1556
</ ol >
1554
1557
</ section >
1555
1558
1556
- < section >
1557
- < h2 > Node Map Generation</ h2 >
1559
+ < section id =" node-map-generation " >
1560
+ < h2 > Node Map Generation Algorithm </ h2 >
1558
1561
< p > The Node Map Generation algorithm takes as input an expanded JSON-LD document and results in a < tref > JSON object</ tref >
1559
1562
< 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
1560
1563
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>
1608
1611
a new array < em > flattenedList</ em > as < em > list</ em > . Create a new < tref > JSON object</ tref > with the
1609
1612
property < code > @list</ code > set to < em > flattenedList</ em > and add it to < em > node</ em > for
1610
1613
< 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 >
1614
1620
< li > Otherwise, add < em > v</ em > to < em > node</ em > for < em > property</ em > .</ li >
1615
1621
</ ol >
1616
1622
</ li >
0 commit comments