Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-1965

Writing streams of RDF

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Information Provided
    • Jena 3.16.0
    • None
    • RIOT
    • None

    Description

      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:

      WriterDatasetRIOT ds = RDFDataMgr.createDatasetWriter(RDFFormat.TURTLE_PRETTY);
      

      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.

      
      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
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            Aklakan Claus Stadler
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: