Class ProtobufRDF

java.lang.Object
org.apache.jena.riot.protobuf.ProtobufRDF

public class ProtobufRDF extends Object
Operations on binary RDF using Google Protobuf.

An encoding use Apache Thrift is available in ThriftRDF.

  • Constructor Details

    • ProtobufRDF

      public ProtobufRDF()
  • Method Details

    • streamToFile

      public static StreamRDF streamToFile(String filename)
      Create an StreamRDF for output. A filename ending .gz will have a gzip compressor added to the output path. A filename of "-" is System.out. The file is closed when StreamRDF.finish() is called unless it is System.out. Call StreamRDF.start()...StreamRDF.finish().
      Parameters:
      filename - The file
      Returns:
      StreamRDF A stream to send to.
    • streamToFile

      public static StreamRDF streamToFile(String filename, boolean withValues)
      Create an StreamRDF for output. A filenames ending .gz or .bz2 will have the respective compressor added to the output path. A filename of "-" is System.out. The file is closed when StreamRDF.finish() is called unless it is System.out. Call StreamRDF.start()...StreamRDF.finish().
      Parameters:
      filename - The file
      withValues - - whether to encode numeric values as values.
      Returns:
      StreamRDF A stream to send to.
    • streamToOutputStream

      public static StreamRDF streamToOutputStream(OutputStream output)
      An StreamRDF that writes to an output stream. The output stream is written with "writeDelimitedTo".
    • streamToOutputStream

      public static StreamRDF streamToOutputStream(OutputStream output, boolean withValues)
      An StreamRDF that writes to an output stream. The output stream is written with "writeDelimitedTo".
    • fileToStream

      public static void fileToStream(String filename, StreamRDF dest)
      Decode the contents of the file and send to the StreamRDF. A filename ending .gz will have a gzip decompressor added. A filename of "-" is System.in.
      Parameters:
      filename - The file.
      dest - Sink
    • inputStreamToStreamRDF

      public static void inputStreamToStreamRDF(InputStream input, StreamRDF stream)
      Read an input stream and send item to the StreamRDF. The input stream will be read with "parseDelimitedTo".
      Parameters:
      input - InputStream
      stream - StreamRDF
    • apply

      public static void apply(InputStream input, VisitorStreamRowProtoRDF action)
      Send the contents of a RDF-encoded protobuf file to an "action"
      Parameters:
      input - InputStream
      action - Code to act on the row.
    • readRowSet

      public static RowSet readRowSet(InputStream input)
      Return a streaming RowSet read from an input stream (with delimiters per row)
    • writeRowSet

      public static void writeRowSet(OutputStream out, RowSet rowSet)
      Write a RowSet to an output stream (with delimiters per row)
    • writeRowSet

      public static void writeRowSet(OutputStream out, RowSet rowSet, boolean withValues)
      Write a RowSet to an output stream (with delimiters per row)