-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extending the writer with the possibility to write a comment to the outputStream #439
Comments
If added, it would definitely need to be in The piping I'm not sure. I think it starts getting hacky/unstable. For your purposes, the intended effect can already be achieved just by writing to But then there's also questions surrounding TriG for instance (do we also terminate graphs, maybe yes, maybe no). TL;DR: There are options, this issue is triggering my thoughts on the general concept of the current https://github.com/pietercolpaert/Wurtle.js/ syntax. I'm very much starting to think _:w wurtle:begin 0.
ex:Collection1 a tree:Collection;
rdfs:label "A Collection of 2 subjects"@en;
tree:member ex:Subject1, ex:Subject2 .
_:w wurtle:end 0.
_:w wurtle:begin 1.
ex:Subject1 a ex:Subject ;
rdfs:label "Subject 1" ;
ex:linkedTo [ a ex:Subject ] .
_:w wurtle:begin 1. Or alternatives like wurtle: wurtle:begin 1. or simply wurtle:separator wurtle:separator wurtle:separator. or even :_____ wurtle:separator :_____. and one for the weekend <🥕> wurtle:separator <🥕>. because then all you need is order stability (which, streaming, you have), not comment stability (hacky at best). And bonus points for also working in JSON-LD, which doesn't have comments. And any current or future RDF format or streaming parser, really. |
I don’t believe termination is needed. I.e.: # @group begin
ex:Collection1 a tree:Collection;
rdfs:label "A Collection of 2 subjects"@en;
# @group end
# @group begin
tree:member ex:Subject1 .
ex:Subject1 a ex:Subject ;
rdfs:label "Subject 1" ;
ex:linkedTo [ a ex:Subject ] .
# @group end Is perfectly valid and will return the desired result.
Wrt. Wurtle syntax: while I certainly feel like I could appreciate
You already have syntactic options for JSON-LD profiles there, such as:
|
You're right; you don't need triple completion syntactically. But, your example would then be # @group begin
ex:Collection1 a tree:Collection;
rdfs:label "A Collection of 2 subjects"@en# @group end
# @group begin
;
tree:member ex:Subject1 .
ex:Subject1 a ex:Subject ;
rdfs:label "Subject 1" ;
ex:linkedTo [ a ex:Subject# @group end
]. Ugly but works—and you'd probably want
I do think that your case specifically prevents this, because you are 100% (I think) certain that there is conneg. Namely, Wurtle streams (if I understand correctly) will always be generated by an HTTP server, which means there's always negotiation, which means that clients can specifically ask for Wurtle, which means that the client-side parser can always be configured as Wurtle. I.e., I don't see—but might be mistaken—scenarios where a non-Wurtle client would ever end up eating Wurtles. |
Beauty is in the eye of the beholder of course ;-) I don’t dislike it that way
I don’t think so: you might want to respond with a |
But why though? You're generating this on the fly—or not? (If not, fair enough. Then maybe I don't understand the purpose of the grouping well.)
Oh god no, that should most definitely be a profile, not a content-type: pietercolpaert/TREE-profiles#1
They wouldn't be able to parse it (unless served with |
But in a larger sense, I think the trade-off here is: do we want to change entire parsing infrastructures/pipelines do make comments have meaning (and thus place the onus on the parser), or rather change the interpreter of the RDF? I didn't question this before the creation of this issue; it shows how fiddly it is to pipe comments out-of-band into another stream. Whole range of issues like back-pressure etc. It will absolutely be out of order and not work. 🚨 Actually, yes. I only realize now: what you propose is not possible. The timing of the events will be off, because of buffering. The comments will end up in the wrong places if you chain the events. |
Closing this feature suggestion as it definitely will not work as intended on That's the inherent problem with the current approach: to stream Wurtle properly, it must be one stream of triples and comments, which is what takes care of the synchronization. Currently, it's two separate streams, one an actual Node The "separators as triples" approach would have built-in sync, at the cost indeed of offering non-data triples (which may or may not be an issue). The alternative is to change from |
Recently we added support for optionally parsing comments. We should probably also have a public function in the writer that allows one to write a comment. I.e.:
In the StreamWriter, it could then be listening in on
comment
events from the input.Does this sound reasonable? If so, I can open a PR.
EDIT: we need to be careful about newlines in the comment string
The text was updated successfully, but these errors were encountered: