json-ld-api icon indicating copy to clipboard operation
json-ld-api copied to clipboard

missing instructions in Node Map generation

Open pchampin opened this issue 3 years ago • 2 comments

I believe that an instruction is missing from step 6.10 of Node Map Generation, namely:

  • if node map does not contain an id entry, create one and initialize its value to an empty map

before recursively invoking the algorithm. Indeed, in step 2 of the invoked algorithm, that entry is assumed to already exist:

Reference the map which is the value of the active graph entry of node map")

(edited wrong markup, which made the suggested sentence potentially harder to understand)

pchampin avatar Oct 08 '22 17:10 pchampin

Sorry, a bit confused. Step 6.10 is the following:

6.10) If _element+ has an @graph entry, recursively invoke this algorithm passing the value of the @graph entry for element, node map, and id for active graph before removing the @graph entry from element.

In fact, when searching the document (both TR and ED), I can't find a sentence "if node map does not contain an id entry, create one and initialize its value to an empty map".

The algorithm takes node map as an input argument, so it definitely must already exist. The places which recursively invoke the algorithm pass the existing node map, so I don't see the specific issue.

gkellogg avatar Oct 08 '22 21:10 gkellogg

The sentence I wrote ("if node map does not contain an id entry...") is what I suggest to add to step 6.10 . So indeed, it is currently not in the spec :-)

Of course node map always exists. What does not always exist, when entering 6.10, is an entry in node map whose key is id. When the algorithm is recursively invoked, passing node map and passing id for active graph, this entry is assumed to exist at step 2.

By adding the suggested sentence in 6.10 before the recursive invocation, we ensure that this assumption in the invoked step 2 is satisfied.

pchampin avatar Oct 12 '22 12:10 pchampin