Replies: 1 comment 6 replies
-
I can see how this would be useful for implementing streaming output from a process that is generating triples. The simple There's 12 formats for RDF that are currently supported by the library (that's not including the GZip variants or any of the SPARQL results formats) so implementing this for all of the formats (and writing the necessary unit tests and documentation) is not a small task (although it should be possible to reuse a lot of the logic from the existing writers as well as make use of the existing formatters) |
Beta Was this translation helpful? Give feedback.
-
Hello, I was wondering what your opinion on having implementations of
IRdfHandler
that actually write the RDF data to a stream in a specific serialization format. Since I had a need for something like this, and because I wanted a bit different style, I made my own:TurtleHandler
(pre-3.0)I am in a situation where triples are produced during the whole operation of the software, and I feel there are not enough options for serializing RDF data in this case. As far as I am aware, there are two possibilities:
IRdfWriter
implementation to serialize it all at once. This can be generalized thanks toMimeTypeDefinition.GetRdfWriter()
, but does not work in a streaming way.ITripleFormatter
and use it together withWriteThroughHandler
. It is possible to obtain the formatter fromIFormatterBasedWriter
, but since all a formatter sees are individual triples, this method cannot offer any compact syntax for groups of triples (unlike myTurtleHandler
which remembers the subject). It also does not work in all situations (for example the formatter for CSV outputs space-separated nodes instead of comma-separated).What I think would be nice is to have something in between those two options, and I think
IRdfHandler
suits it well. Preferably, eachMimeTypeDefinition
should expose the underlying formatter (if suitable for triples), but also a way to createIRdfHandler
toTextWriter
which could do more fancy stuff, and perhaps support other things likeIPrettyPrintingWriter
.I am also planning to write something like this for JSON-LD, which is a bit wild, but we shall see if it works.
Beta Was this translation helpful? Give feedback.
All reactions