Package org.eclipse.rdf4j.rio.trig
Class TriGWriter
- java.lang.Object
-
- org.eclipse.rdf4j.rio.helpers.AbstractRDFWriter
-
- org.eclipse.rdf4j.rio.turtle.TurtleWriter
-
- org.eclipse.rdf4j.rio.trig.TriGWriter
-
- All Implemented Interfaces:
org.eclipse.rdf4j.common.io.CharSink,org.eclipse.rdf4j.common.io.Sink,RDFHandler,RDFWriter
- Direct Known Subclasses:
TriGStarWriter
public class TriGWriter extends TurtleWriter
An extension ofTurtleWriterthat writes RDF documents in TriG format by adding graph scopes to the Turtle document.- Author:
- Arjohn Kampman
-
-
Field Summary
-
Fields inherited from class org.eclipse.rdf4j.rio.turtle.TurtleWriter
baseIRI, bufferedStatements, lastWrittenPredicate, lastWrittenSubject, statementClosed, writer
-
Fields inherited from class org.eclipse.rdf4j.rio.helpers.AbstractRDFWriter
namespaceTable, statementConsumer
-
-
Constructor Summary
Constructors Constructor Description TriGWriter(OutputStream out)Creates a new TriGWriter that will write to the supplied OutputStream.TriGWriter(OutputStream out, org.eclipse.rdf4j.common.net.ParsedIRI baseIRI)Creates a new TriGWriter that will write to the supplied OutputStream.TriGWriter(Writer writer)Creates a new TriGWriter that will write to the supplied Writer.TriGWriter(Writer writer, org.eclipse.rdf4j.common.net.ParsedIRI baseIRI)Creates a new TriGWriter that will write to the supplied Writer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcloseActiveContext()voidendRDF()RDFFormatgetRDFFormat()voidstartRDF()protected voidwriteNamespace(String prefix, String name)protected voidwriteStatement(org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, org.eclipse.rdf4j.model.Resource context, boolean canShortenSubject, boolean canShortenObject)-
Methods inherited from class org.eclipse.rdf4j.rio.turtle.TurtleWriter
closePreviousStatement, consumeStatement, getModelFactory, getSupportedSettings, getWriter, handleComment, handleNamespace, handleStatementInternal, setModelFactory, writeBase, writeBNode, writeBNode, writeCommentLine, writeLiteral, writePredicate, writeResource, writeResource, writeTriple, writeTripleRDFStar, writeURI, writeValue, writeValue
-
Methods inherited from class org.eclipse.rdf4j.rio.helpers.AbstractRDFWriter
checkWritingStarted, getFileFormat, getWriterConfig, handleStatement, isWritingStarted, set, setWriterConfig
-
-
-
-
Constructor Detail
-
TriGWriter
public TriGWriter(OutputStream out)
Creates a new TriGWriter that will write to the supplied OutputStream.- Parameters:
out- The OutputStream to write the TriG document to.
-
TriGWriter
public TriGWriter(OutputStream out, org.eclipse.rdf4j.common.net.ParsedIRI baseIRI)
Creates a new TriGWriter that will write to the supplied OutputStream.- Parameters:
out- The OutputStream to write the TriG document to.baseIRI-
-
TriGWriter
public TriGWriter(Writer writer)
Creates a new TriGWriter that will write to the supplied Writer.- Parameters:
writer- The Writer to write the TriG document to.
-
TriGWriter
public TriGWriter(Writer writer, org.eclipse.rdf4j.common.net.ParsedIRI baseIRI)
Creates a new TriGWriter that will write to the supplied Writer.- Parameters:
writer- The Writer to write the TriG document to.baseIRI-
-
-
Method Detail
-
getRDFFormat
public RDFFormat getRDFFormat()
- Specified by:
getRDFFormatin interfaceRDFWriter- Overrides:
getRDFFormatin classTurtleWriter
-
startRDF
public void startRDF() throws RDFHandlerException- Specified by:
startRDFin interfaceRDFHandler- Overrides:
startRDFin classTurtleWriter- Throws:
RDFHandlerException
-
endRDF
public void endRDF() throws RDFHandlerException- Specified by:
endRDFin interfaceRDFHandler- Overrides:
endRDFin classTurtleWriter- Throws:
RDFHandlerException
-
writeStatement
protected void writeStatement(org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, org.eclipse.rdf4j.model.Resource context, boolean canShortenSubject, boolean canShortenObject) throws IOException- Overrides:
writeStatementin classTurtleWriter- Throws:
IOException
-
writeNamespace
protected void writeNamespace(String prefix, String name) throws IOException
- Overrides:
writeNamespacein classTurtleWriter- Throws:
IOException
-
closeActiveContext
protected void closeActiveContext() throws IOException- Throws:
IOException
-
-