You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Claus Stadler (Jira)" <ji...@apache.org> on 2020/09/14 11:24:00 UTC

[jira] [Created] (JENA-1965) Writing streams of RDF

Claus Stadler created JENA-1965:
-----------------------------------

             Summary: Writing streams of RDF
                 Key: JENA-1965
                 URL: https://issues.apache.org/jira/browse/JENA-1965
             Project: Apache Jena
          Issue Type: New Feature
          Components: RIOT
    Affects Versions: Jena 3.16.0
            Reporter: Claus Stadler


For streams of Model and Datesets (or Graphs and DatasetGraphs) there does not appear to be a 'push'-based RDF Writer.

Although there exists the deprecated method:
{code:java}
WriterDatasetRIOT ds = RDFDataMgr.createDatasetWriter(RDFFormat.TURTLE_PRETTY);
{code}
The documentation states that the returned object is for one-time use only.

The feature request is to make it possible to write out streams of Datasets in a  push-based manner. Thereby the writer should maintain state information such that prefixes and base IRIs are not written out redundantly.

{code:java}

try(OutputStream out = ...} {
  StreamWriterDatasetRIOT sink = RDFDataMgr.createStreamDatasetWriter(out,   RDFFormat.TURTLE_PRETTY);

  sink.start(); // May immediately trigger a write on the output stream
  for (Dataset ds : streamOfDatasets) {
    sink.send(ds);
    sink.flush();
  }
  sink.finish(); // Write out footer and free resources 
  // Is tthere is a need for sink.close()?

} // close resources
{code}





--
This message was sent by Atlassian Jira
(v8.3.4#803005)