Package org.apache.jena.riot.protobuf
Class ProtobufRDF
- java.lang.Object
-
- org.apache.jena.riot.protobuf.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 Summary
Constructors Constructor Description ProtobufRDF()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
apply(java.io.InputStream input, VisitorStreamRowProtoRDF action)
Send the contents of a RDF-encoded protobuf file to an "action"static void
fileToStream(java.lang.String filename, StreamRDF dest)
Decode the contents of the file and send to theStreamRDF
.static void
inputStreamToStreamRDF(java.io.InputStream input, StreamRDF stream)
Read an input stream and send item to theStreamRDF
.static ResultSet
readResultSet(java.io.InputStream input)
Return a streamingResultSet
read from an input stream (with delimiters per row)static StreamRDF
streamToFile(java.lang.String filename)
Create anStreamRDF
for output.static StreamRDF
streamToFile(java.lang.String filename, boolean withValues)
Create anStreamRDF
for output.static StreamRDF
streamToOutputStream(java.io.OutputStream output)
AnStreamRDF
that writes to an output stream.static StreamRDF
streamToOutputStream(java.io.OutputStream output, boolean withValues)
AnStreamRDF
that writes to an output stream.static void
writeResultSet(java.io.OutputStream out, ResultSet resultSet)
Write aResultSet
to an output stream (with delimiters per row)static void
writeResultSet(java.io.OutputStream out, ResultSet resultSet, boolean withValues)
Write aResultSet
to an output stream (with delimiters per row)
-
-
-
Method Detail
-
streamToFile
public static StreamRDF streamToFile(java.lang.String filename)
Create anStreamRDF
for output. A filename ending.gz
will have a gzip compressor added to the output path. A filename of "-" isSystem.out
. The file is closed whenStreamRDF.finish()
is called unless it isSystem.out
. CallStreamRDF.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 anStreamRDF
for output. A filenames ending.gz
or.bz2
will have the respective compressor added to the output path. A filename of "-" isSystem.out
. The file is closed whenStreamRDF.finish()
is called unless it isSystem.out
. CallStreamRDF.start()
...StreamRDF.finish()
.- Parameters:
filename
- The filewithValues
- - whether to encode numeric values as values.- Returns:
- StreamRDF A stream to send to.
-
streamToOutputStream
public static StreamRDF streamToOutputStream(java.io.OutputStream output)
AnStreamRDF
that writes to an output stream. The output stream is written with "writeDelimitedTo".
-
streamToOutputStream
public static StreamRDF streamToOutputStream(java.io.OutputStream output, boolean withValues)
AnStreamRDF
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 theStreamRDF
. A filename ending.gz
will have a gzip decompressor added. A filename of "-" isSystem.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 theStreamRDF
. The input stream will be read with "parseDelimitedTo".- Parameters:
input
- InputStreamstream
- 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
- InputStreamaction
- Code to act on the row.
-
readResultSet
public static ResultSet readResultSet(java.io.InputStream input)
Return a streamingResultSet
read from an input stream (with delimiters per row)
-
writeResultSet
public static void writeResultSet(java.io.OutputStream out, ResultSet resultSet)
Write aResultSet
to an output stream (with delimiters per row)
-
-