Closed rubensworks closed 4 years ago
Following a comment from @BigBlueHat, scoped @context
are also allowed, as long as they appear as first key inside their object/scope.
I think it's only @type
which would be an issue for ordering and scoped contexts. Individual property's scoped contexts are handled when they are processed, and all context information will already have been processed.
So, the suggested ordering within an object (actually, node object or graph object), would be the following:
@context
– if any@id
or alias – if any@type
or alias – if anyNo other properties (including @graph
) need be ordered.
I don't think @type
should be order-dependent. @type
essentially expands to rdf:type
, which makes it processable like any other property/predicate (as long as @id
comes first).
Unless I'm missing something @gkellogg?
Scoped contexts can be triggered on @type
as well as a individual property. If you don’t see @type
early, you may misinterpret the properties.
Ah I see, I wasn't aware of that, thanks for clearing that up! (Link to example for reference)
Is this issue distinct from https://github.com/w3c/json-ld-bp/issues/4?
I would say this is the same as #4. (#4 was moved from another repo)
This issue was discussed in a meeting.
RESOLVED: add json-ld-streaming repo; automate all note repos with echidna to publish on each commit
ACTION: set up json-ld-streaming repo (Ivan Herman)
Everything mentioned here has now been written here: https://github.com/w3c/json-ld-streaming
So I suggest to close this issue.
Works for me! Thanks, @rubensworks!
Following https://github.com/w3c/json-ld-bp/issues/4, we can add guidelines for achieving streaming JSON-LD, and any restrictions it may bring. Here is a summary of the issues discussed in https://github.com/w3c/json-ld-bp/issues/4.
Guidelines:
@context
in a node, it should be the first key.@type
in a node, and its value indicates a type-scoped context, it should come right after an@context
(if there is one), or be the first key.@id
in a node, it should be the first key if there is no@context
or@type
, or the second (or third) key if there is an@context
or@type
.@graph
blocks).@graph
and@id
blocks).@id
blocks).(triple stores may already do these kinds of grouping automatically)
Restrictions:
@context
to appear any in the document. As such, a strict parser may require buffering large portions of the stream. However, since most real-world JSON-LD documents place@context
as first element, streaming parsers may reject any JSON-LD documents that have out-of-order@context
's.@list
arrays, as you can only be certain that@list
can be used once all triples have been read, which requires keeping the whole stream in-memory.