Package org.apache.jena.riot
Class RDFWriter
- java.lang.Object
-
- org.apache.jena.riot.RDFWriter
-
public class RDFWriter extends java.lang.ObjectAnRDFWriteris a process that will output triples or quads in an RDF syntax.RDFWriterBuilderprovides 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:
WriterDatasetRIOT,WriterGraphRIOT
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.StringasString()Write and return as a string.static RDFWriterBuildercreate()Create anRDFWriterBuilder.static RDFWriterBuildercreate(Graph graph)Create anRDFWriterBuilderand set the source of writing to the graph argument.static RDFWriterBuildercreate(Dataset dataset)Create anRDFWriterBuilderand set the source of writing to the graph argument.static RDFWriterBuildercreate(Model model)Create anRDFWriterBuilderand set the source of writing to the graph argument.static RDFWriterBuildercreate(DatasetGraph dataset)Create anRDFWriterBuilderand set the source of writing to the graph argument.voidoutput(java.io.OutputStream output)Write the source to theOutputStream.voidoutput(java.io.Writer javaWriter)Deprecated.Using Java Writers risks corruption because of mismatch of character set.voidoutput(java.lang.String filename)Write the source to the file.
-
-
-
Method Detail
-
create
public static RDFWriterBuilder create()
Create anRDFWriterBuilder.Often used in a pattern such as:
RDFWriter.create() .lang(Lang.TTL) .source(graph) .output(System.out);
-
create
public static RDFWriterBuilder create(Graph graph)
Create anRDFWriterBuilderand set the source of writing to the graph argument.- Parameters:
graph- AGraph.- Returns:
- RDFWriterBuilder
-
create
public static RDFWriterBuilder create(Model model)
Create anRDFWriterBuilderand set the source of writing to the graph argument.- Parameters:
model- AModel.- Returns:
- RDFWriterBuilder
-
create
public static RDFWriterBuilder create(DatasetGraph dataset)
Create anRDFWriterBuilderand set the source of writing to the graph argument.- Parameters:
dataset- ADatasetGraph.- Returns:
- RDFWriterBuilder
-
create
public static RDFWriterBuilder create(Dataset dataset)
Create anRDFWriterBuilderand set the source of writing to the graph argument.- Parameters:
dataset- ADataset.- Returns:
- RDFWriterBuilder
-
asString
public java.lang.String asString()
Write and return as a string.The
LangorRDFFormatmust have been set.
-
output
public void output(java.io.OutputStream output)
Write the source to theOutputStream.The
LangorRDFFormatmust have been set.- Parameters:
output-
-
output
@Deprecated public void output(java.io.Writer javaWriter)
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
public void output(java.lang.String filename)
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-
-
-