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 RDFWriterBuilder
create()
Create anRDFWriterBuilder
.void
output
(OutputStream output) Write the source to theOutputStream
.void
output
(StringWriter javaWriter) Write the source to a JavaStringWriter
.void
Deprecated.Using Java Writers risks corruption because of mismatch of character set.void
Write the source to the file.static RDFWriterBuilder
source
(org.apache.jena.graph.Graph graph) Create anRDFWriterBuilder
and set the source of writing to the graph argument.static RDFWriterBuilder
Create anRDFWriterBuilder
and set the source of writing to the graph argument.static RDFWriterBuilder
source
(org.apache.jena.rdf.model.Model model) Create anRDFWriterBuilder
and set the source of writing to the graph argument.static RDFWriterBuilder
source
(DatasetGraph dataset) Create anRDFWriterBuilder
and 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 anRDFWriterBuilder
and set the source of writing to the graph argument.- Parameters:
graph
- AGraph
.- Returns:
- RDFWriterBuilder
-
source
Create anRDFWriterBuilder
and set the source of writing to the graph argument.- Parameters:
model
- AModel
.- Returns:
- RDFWriterBuilder
-
source
Create anRDFWriterBuilder
and set the source of writing to the graph argument.- Parameters:
dataset
- ADatasetGraph
.- Returns:
- RDFWriterBuilder
-
source
Create anRDFWriterBuilder
and set the source of writing to the graph argument.- Parameters:
dataset
- ADataset
.- Returns:
- RDFWriterBuilder
-
asString
Write and return the output as a string.The
Lang
orRDFFormat
must have been set. -
toString
Write and return the output as a string. This is the same asasString()
.The
Lang
orRDFFormat
must have been set. -
output
Write the source to theOutputStream
.The
Lang
orRDFFormat
must 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
Lang
orRDFFormat
must have been set.- Parameters:
javaWriter
-
-
output
Write the source to a JavaStringWriter
.The
Lang
orRDFFormat
must have been set.- Parameters:
javaWriter
-
-
output
Write the source to the file.If neither
Lang
norRDFFormat
are set, an attempt to guess an RDF Syntax is made from the file extension.Output to "-" goes to stdout.
- Parameters:
filename
-
-