w3c / cogai

for work by the Cognitive AI community group
Other
54 stars 25 forks source link

Add example of chunk without identifier in section 4.2 #22

Open tidoust opened 4 years ago

tidoust commented 4 years ago

See related comment from @ngcharithperera::

 (3) In Section 4.2, you mentioned that identifier is optional. Is it possible to give an example to show how it looks like?

@draggett replied that:

The spec should further say something to the effect that the chunk ID is optional, and if missing, will be automatically assigned when adding the chunk to a graph. If the graph already has a chunk with the same ID, it will be replaced by this one.

Re. automatically assigning an identifier, where would that info be exposed? That is, if someone loads a chunk that was defined without identifier in a module buffer, will they see the automatically assigned identifier? If they don't, why mention it?

draggett commented 4 years ago

Re. automatically assigning an identifier, where would that info be exposed?

Yes, the identifier is accessible via the scripting API after the chunk is added to the module's graph, and would be visible when outputting the graph to a text string.

tidoust commented 4 years ago

Yes, the identifier is accessible via the scripting API after the chunk is added to the module's graph, and would be visible when outputting the graph to a text string.

The scripting API is out of scope of the initial document. Custom operations that could be used to serialize chunks are out of scope too (also, the serialization of the graph to a text string could omit identifiers that have been automatically assigned. After all, they did not exist in the initial graph, why would serialization return them?).

I'm more wondering whether an application can bind the automatically assigned identifier to a variable through @id and then re-use it later on.

draggett commented 4 years ago

I'm more wondering whether an application can bind the automatically assigned identifier to a variable through @id and then re-use it later on.

Yes that should indeed work as the variable will bind to the chunk's ID which is automatically generated when the chunk is added to a module if it doesn't already have one.