Open elf-pavlik opened 2 years ago
I think streaming text/turtle
should be pretty straight forward. For application/ld+json
we might want to reference https://www.w3.org/TR/json-ld11-streaming/
From what I have read, I don't think using text/turtle
conforms to HTTP specifications. What you are streaming are multiple instances of text/turtle
and you would thus require something like multipart/mixed
.
I don't know much about it myself, and hence was asking around for an expert on the subject for guidance.
References:
I think we should be able to define chunks in a way that what is being streamed is a valid document for that content type. AFAIK in turtle prefixes can appear anywhere as long they are defined before they get used, which means that concatenating multiple text/turtle
documents will still be valid text/turtle
.
For JSON-LD we will need to be more careful since in the simplest case we will need to have an array of notification objects, separated by commas.
Ok, if you want to do the text/turtle
thing, I believe that there is a proper way to set headers for that as well, except I don't know how. From what I understand, you cannot just get away with setting Content-Type
.
However, I don't want to discard the multipart/*
approach either (at least for now) because we might also want to support diffs which might not play as nicely.
@elf-pavlik FYI: https://www.ietf.org/rfc/rfc2387
AFAIK in turtle prefixes can appear anywhere as long they are defined before they get used, which means that concatenating multiple text/turtle documents will still be valid text/turtle.
Yes, that is correct. PREFIX
or @prefix
lines may appear anywhere in a Turtle document, and affect all following lines.
It's probably also worth noting that a later PREFIX
declaration may change a previous declaration for subsequent triples — i.e., an early PREFIX ex: <https://example.com/#>
which is active for some number of triples may be changed by a later @prefix ex: <https://example.org/#> .
which is then active for following triples, until either the end of the document or another PREFIX ex: <URL>
declaration.
This should streamline the processing of the stream by the client and parsing notifications.