public class RDFWriter extends Object
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);
WriterDatasetRIOT
,
WriterGraphRIOT
Modifier and Type | Method and Description |
---|---|
String |
asString()
Write and return as a string.
|
static RDFWriterBuilder |
create()
Create an
RDFWriterBuilder . |
void |
output(OutputStream output)
Write the source to the
OutputStream . |
void |
output(String filename)
Write the source to the file.
|
void |
output(Writer javaWriter)
Deprecated.
Using Java Writers risk corrupting the character set. Only UTF-8 is safe.
|
public static RDFWriterBuilder create()
RDFWriterBuilder
.
Often used in a pattern such as:
RDFWriter.create() .lang(Lang.TTL) .source(graph) .output(System.out);
public String asString()
The Lang
or RDFFormat
must have been set.
public void output(OutputStream output)
OutputStream
.
The Lang
or RDFFormat
must have been set.
output
- @Deprecated public void output(Writer javaWriter)
Writer
.
The Lang
or RDFFormat
must have been set.
javaWriter
- public void output(String filename)
If neither Lang
nor RDFFormat
are set, an attempt to
guess an RDF Syntax is made from the file extension.
Output to "-" goes to stdout.
filename
- Licenced under the Apache License, Version 2.0