java.lang.Object
org.apache.jena.riot.RDFWriter
An
RDFWriter is a process that will output triples or quads in an RDF syntax.
RDFWriterBuilder provides the means to setup the writer.
The process is
DatasetGraph dsg = ...
RDFWriter writer = RDFWriter.create().source(dsg).lang(Lang.TTL).build();
OutputStream out =
writer.output(out);
or using abbreviated forms:
RDFWriter.create().source(dsg).lang(Lang.TTL).output(out);
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionasString()Write and return the output as a string.static RDFWriterBuildercreate()Create anRDFWriterBuilder.voidoutput(OutputStream output) Write the source to theOutputStream.voidoutput(StringWriter javaWriter) Write the source to a JavaStringWriter.voidDeprecated.Using Java Writers risks corruption because of mismatch of character set.voidWrite the source to the file.static RDFWriterBuildersource(org.apache.jena.graph.Graph graph) Create anRDFWriterBuilderand set the source of writing to the graph argument.static RDFWriterBuilderCreate anRDFWriterBuilderand set the source of writing to the graph argument.static RDFWriterBuildersource(org.apache.jena.rdf.model.Model model) Create anRDFWriterBuilderand set the source of writing to the graph argument.static RDFWriterBuildersource(DatasetGraph dataset) Create anRDFWriterBuilderand set the source of writing to the graph argument.toString()Write and return the output as a string.
-
Method Details
-
create
Create anRDFWriterBuilder.Often used in a pattern such as:
RDFWriter.create() .lang(Lang.TTL) .source(graph) .output(System.out); -
source
Create anRDFWriterBuilderand set the source of writing to the graph argument.- Parameters:
graph- AGraph.- Returns:
- RDFWriterBuilder
-
source
Create anRDFWriterBuilderand set the source of writing to the graph argument.- Parameters:
model- AModel.- Returns:
- RDFWriterBuilder
-
source
Create anRDFWriterBuilderand set the source of writing to the graph argument.- Parameters:
dataset- ADatasetGraph.- Returns:
- RDFWriterBuilder
-
source
Create anRDFWriterBuilderand set the source of writing to the graph argument.- Parameters:
dataset- ADataset.- Returns:
- RDFWriterBuilder
-
asString
Write and return the output as a string.The
LangorRDFFormatmust have been set. -
toString
Write and return the output as a string. This is the same asasString().The
LangorRDFFormatmust have been set. -
output
Write the source to theOutputStream.The
LangorRDFFormatmust have been set.- Parameters:
output-
-
output
Deprecated.Using Java Writers risks corruption because of mismatch of character set. Only UTF-8 is safe.Write the source to the JavaWriter.The
LangorRDFFormatmust have been set.- Parameters:
javaWriter-
-
output
Write the source to a JavaStringWriter.The
LangorRDFFormatmust have been set.- Parameters:
javaWriter-
-
output
Write the source to the file.If neither
LangnorRDFFormatare set, an attempt to guess an RDF Syntax is made from the file extension.Output to "-" goes to stdout.
- Parameters:
filename-
-