Class ProtobufRDF


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

    An encoding use Apache Thrift is available in ThriftRDF.

    • Constructor Detail

      • ProtobufRDF

        public ProtobufRDF()
    • Method Detail

      • streamToFile

        public static StreamRDF streamToFile​(java.lang.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​(java.lang.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​(java.io.OutputStream output)
        An StreamRDF that writes to an output stream. The output stream is written with "writeDelimitedTo".
      • streamToOutputStream

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

        public static void fileToStream​(java.lang.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​(java.io.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​(java.io.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.
      • readResultSet

        public static ResultSet readResultSet​(java.io.InputStream input)
        Return a streaming ResultSet read from an input stream (with delimiters per row)
      • writeResultSet

        public static void writeResultSet​(java.io.OutputStream out,
                                          ResultSet resultSet)
        Write a ResultSet to an output stream (with delimiters per row)
      • writeResultSet

        public static void writeResultSet​(java.io.OutputStream out,
                                          ResultSet resultSet,
                                          boolean withValues)
        Write a ResultSet to an output stream (with delimiters per row)