Package com.stardog.stark.io
Class RDFWriters
java.lang.Object
com.stardog.stark.io.RDFWriters
Utility methods for working with RDFWriter
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Michael Grove
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic RDFWriters.RDFWriterConfigto(OutputStream theStream) to(OutputStream theOutput, RDFFormat theFormat) to(OutputStream theOutput, RDFFormat theFormat, Options theWriterOptions) to(OutputStream theOutput, RDFFormat theFormat, Iterable<Namespace> theNamespaces) static Stringstatic Stringstatic longWrite the given statements to thewriterstatic longWrite the given statements and namespaces to thewriterstatic longwrite(OutputStream theStream, RDFFormat theFormat, Iterable<Statement> theStmts) Writes the statements similar towrite(RDFWriter, Iterable, Iterable).static longwrite(OutputStream theStream, RDFFormat theFormat, Iterable<Statement> theStmts, Iterable<Namespace> theNamespaces) Writes the statements similar towrite(RDFWriter, Iterable, Iterable).static longWrites the statements similar towrite(RDFWriter, Iterable, Iterable)but first groups the statements by their subjects and predicates so the output will look better (if the writer supports this kind of optimization).static longwriteGrouped(OutputStream theStream, RDFFormat theFormat, Iterable<Statement> theStmts, Iterable<Namespace> theNamespaces) Writes the statements similar towrite(RDFWriter, Iterable, Iterable)but first groups the statements by their subjects and predicates so the output will look better (if the writer supports this kind of optimization).
-
Method Details
-
to
- Parameters:
theOutput- the output to write totheFormat- the format to write in- Returns:
- the `RDFWriter` to use for writing
- See Also:
- Implementation Notes:
- The `OutputStream` is *not* closed when writing is complete
-
to
public static Optional<RDFWriter> to(@Nonnull OutputStream theOutput, @Nonnull RDFFormat theFormat, @Nonnull Iterable<Namespace> theNamespaces) - Parameters:
theOutput- the output to write totheFormat- the format to write intheNamespaces- the namespaces for writing- Returns:
- the `RDFWriter` to use for writing
- See Also:
- Implementation Notes:
- The `OutputStream` is *not* closed when writing is complete
-
to
public static Optional<RDFWriter> to(@Nonnull OutputStream theOutput, @Nonnull RDFFormat theFormat, @Nonnull Options theWriterOptions) - Parameters:
theOutput- the output to write totheFormat- the format to write intheWriterOptions- the options for writing- Returns:
- the `RDFWriter` to use for writing
- See Also:
- Implementation Notes:
- The `OutputStream` is *not* closed when writing is complete
-
write
Write the given statements to thewriter -
write
public static long write(@Nonnull RDFWriter theWriter, @Nonnull Iterable<Statement> theStmts, @Nonnull Iterable<Namespace> theNamespaces) Write the given statements and namespaces to thewriter -
write
public static long write(@Nonnull OutputStream theStream, @Nonnull RDFFormat theFormat, @Nonnull Iterable<Statement> theStmts) Writes the statements similar towrite(RDFWriter, Iterable, Iterable).- Returns:
- the number of statements written (duplicate statements will be counted as many times as they appear)
- Throws:
IllegalArgumentException- if a writer supporting the given format is not found
-
write
public static long write(@Nonnull OutputStream theStream, @Nonnull RDFFormat theFormat, @Nonnull Iterable<Statement> theStmts, @Nonnull Iterable<Namespace> theNamespaces) Writes the statements similar towrite(RDFWriter, Iterable, Iterable).- Returns:
- the number of statements written (duplicate statements will be counted as many times as they appear)
- Throws:
IllegalArgumentException- if a writer supporting the given format is not found
-
writeGrouped
public static long writeGrouped(@Nonnull OutputStream theStream, @Nonnull RDFFormat theFormat, @Nonnull Iterable<Statement> theStmts, @Nonnull Iterable<Namespace> theNamespaces) Writes the statements similar towrite(RDFWriter, Iterable, Iterable)but first groups the statements by their subjects and predicates so the output will look better (if the writer supports this kind of optimization).- Returns:
- the number of statements written (duplicate statements will be counted as many times as they appear)
-
writeGrouped
public static long writeGrouped(@Nonnull RDFWriter theWriter, @Nonnull Iterable<Statement> theStmts, @Nonnull Iterable<Namespace> theNamespaces) Writes the statements similar towrite(RDFWriter, Iterable, Iterable)but first groups the statements by their subjects and predicates so the output will look better (if the writer supports this kind of optimization).- Returns:
- the number of statements written (duplicate statements will be counted as many times as they appear)
-
toString
@Nonnull public static String toString(@Nonnull Iterable<Statement> theStatements, @Nonnull RDFFormat theFormat) - Parameters:
theStatements- the statements to serializetheFormat- the RDF format to serialize into- Returns:
- the statements serialized in the given RDF format
- See Also:
- Implementation Notes:
- Since this serializes the statements into a String in-memory, this is not suitable for serialization of large graphs
-
toString
@Nonnull public static String toString(@Nonnull Iterable<Statement> theStatements, @Nonnull RDFFormat theFormat, @Nonnull Iterable<Namespace> theNamespaces) - Parameters:
theStatements- the statements to serializetheFormat- the RDF format to serialize intotheNamespaces- the namespaces to use for converting IRIs to QNames- Returns:
- the statements serialized in the given RDF format
- See Also:
- Implementation Notes:
- Since this serializes the statements into a String in-memory, this is not suitable for serialization of large graphs
-
to
-