Class ThriftRDF

java.lang.Object
org.apache.jena.riot.thrift.ThriftRDF

public class ThriftRDF extends Object
Operations on binary RDF (which uses Apache Thrift). See also ThriftConvert, for specific functions on binary RDF.

Encoding use Protobuf is available in ProtobufRDF.

  • Constructor Details

    • ThriftRDF

      public ThriftRDF()
  • 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 out)
      Create an StreamRDF for output. The OutputStream is closed when StreamRDF.finish() is called unless it is System.out. Call StreamRDF.start()...StreamRDF.finish().
      Parameters:
      out - OutputStream
      Returns:
      StreamRDF A stream to send to.
    • streamToOutputStream

      public static StreamRDF streamToOutputStream(OutputStream out, boolean withValues)
      Create an StreamRDF for output. The OutputStream is closed when StreamRDF.finish() is called unless it is System.out. Call StreamRDF.start()...StreamRDF.finish().
      Parameters:
      out - OutputStream
      withValues - - whether to encode numeric values as values.
      Returns:
      StreamRDF A stream to send to.
    • streamToTProtocol

      public static StreamRDF streamToTProtocol(org.apache.thrift.protocol.TProtocol protocol)
      Create an StreamRDF for output. The OutputStream is closed when StreamRDF.finish() is called unless it is System.out. Call StreamRDF.start()...StreamRDF.finish().
      Parameters:
      protocol - Output and encoding.
      Returns:
      StreamRDF A stream to send to.
    • streamToTProtocol

      public static StreamRDF streamToTProtocol(org.apache.thrift.protocol.TProtocol protocol, boolean withValues)
      Create an StreamRDF for output. The OutputStream is closed when StreamRDF.finish() is called unless it is System.out. Call StreamRDF.start()...StreamRDF.finish().
      Parameters:
      protocol - Output and encoding.
      withValues - - whether to encode numeric values as values.
      Returns:
      StreamRDF A stream to send to.
    • 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
    • inputStreamToStream

      public static void inputStreamToStream(InputStream in, StreamRDF dest)
      Decode the contents of the input stream and send to the StreamRDF.
      Parameters:
      in - InputStream
      dest - StreamRDF
    • protocolToStream

      public static void protocolToStream(org.apache.thrift.protocol.TProtocol protocol, StreamRDF dest)
      Decode the contents of the TProtocol and send to the StreamRDF.
      Parameters:
      protocol - TProtocol
      dest - Sink
    • apply

      public static void apply(org.apache.thrift.protocol.TProtocol protocol, Consumer<RDF_StreamRow> action)
      Send the contents of a RDF-encoded Thrift file to an "action"
      Parameters:
      protocol - TProtocol
      action - Code to act on the row.
    • dump

      public static void dump(OutputStream out, InputStream in)
      Debug help - print details of a Thrift stream. Destructive on the InputStream.
      Parameters:
      out - OutputStream
      in - InputStream
    • readRowSet

      public static RowSet readRowSet(InputStream in)
    • readRowSet

      public static RowSet readRowSet(org.apache.thrift.protocol.TProtocol protocol)
    • writeRowSet

      public static void writeRowSet(OutputStream out, RowSet rowSet)
    • writeRowSet

      public static void writeRowSet(OutputStream out, RowSet rowSet, boolean withValues)
    • writeRowSet

      public static void writeRowSet(org.apache.thrift.protocol.TProtocol protocol, RowSet rowSet)
    • writeRowSet

      public static void writeRowSet(org.apache.thrift.protocol.TProtocol protocol, RowSet rowSet, boolean encodeValues)