public class TurtleWriter extends AbstractRDFWriter implements RDFWriter, CharSink
| Modifier and Type | Field and Description |
|---|---|
protected ParsedIRI |
baseIRI |
protected org.eclipse.rdf4j.model.Model |
bufferedStatements |
protected org.eclipse.rdf4j.model.IRI |
lastWrittenPredicate |
protected org.eclipse.rdf4j.model.Resource |
lastWrittenSubject |
protected boolean |
statementClosed
Flag indicating whether the last written statement has been closed.
|
protected IndentingWriter |
writer |
namespaceTable, statementConsumer| Constructor and Description |
|---|
TurtleWriter(OutputStream out)
Creates a new TurtleWriter that will write to the supplied OutputStream.
|
TurtleWriter(OutputStream out,
ParsedIRI baseIRI)
Creates a new TurtleWriter that will write to the supplied OutputStream.
|
TurtleWriter(Writer writer)
Creates a new TurtleWriter that will write to the supplied Writer.
|
TurtleWriter(Writer writer,
ParsedIRI baseIRI)
Creates a new TurtleWriter that will write to the supplied Writer.
|
checkWritingStarted, getFileFormat, getWriterConfig, handleStatement, isWritingStarted, set, setWriterConfigclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetWriterConfig, set, setWriterConfighandleStatementacceptsFileFormat, getFileFormatprotected org.eclipse.rdf4j.model.Model bufferedStatements
protected ParsedIRI baseIRI
protected IndentingWriter writer
protected boolean statementClosed
protected org.eclipse.rdf4j.model.Resource lastWrittenSubject
protected org.eclipse.rdf4j.model.IRI lastWrittenPredicate
public TurtleWriter(OutputStream out)
out - The OutputStream to write the Turtle document to.public TurtleWriter(OutputStream out, ParsedIRI baseIRI)
out - The OutputStream to write the Turtle document to.baseIRI - public TurtleWriter(Writer writer)
writer - The Writer to write the Turtle document to.public RDFFormat getRDFFormat()
getRDFFormat in interface RDFWriterpublic Collection<RioSetting<?>> getSupportedSettings()
getSupportedSettings in interface RDFWritergetSupportedSettings in class AbstractRDFWriterpublic void startRDF()
throws RDFHandlerException
startRDF in interface RDFHandlerstartRDF in class AbstractRDFWriterRDFHandlerExceptionpublic void endRDF()
throws RDFHandlerException
endRDF in interface RDFHandlerRDFHandlerExceptionpublic void handleNamespace(String prefix, String name) throws RDFHandlerException
handleNamespace in interface RDFHandlerhandleNamespace in class AbstractRDFWriterRDFHandlerExceptionpublic void setModelFactory(org.eclipse.rdf4j.model.ModelFactory modelFactory)
ModelFactory to use for creating internal Models for statement processing/buffering purposes.modelFactory - a ModelFactory to use for internal buffering / statement processing purposes. May not
be null.protected org.eclipse.rdf4j.model.ModelFactory getModelFactory()
protected void consumeStatement(org.eclipse.rdf4j.model.Statement st) throws RDFHandlerException
consumeStatement in class AbstractRDFWriterRDFHandlerExceptionprotected void handleStatementInternal(org.eclipse.rdf4j.model.Statement st, boolean endRDFCalled, boolean canShortenSubjectBNode, boolean canShortenObjectBNode)
st - The next statement to writeendRDFCalled - True if endRDF has been called before this method is called. This is used to buffer
statements for pretty-printing before dumping them when all statements have been
delivered to us.canShortenSubjectBNode - True if, in the current context, we may be able to shorten the subject of this
statement iff it is an instance of BNode.canShortenObjectBNode - True if, in the current context, we may be able to shorten the object of this
statement iff it is an instance of BNode.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 canShortenSubjectBNode, boolean canShortenObjectBNode) throws IOException
IOExceptionpublic void handleComment(String comment) throws RDFHandlerException
handleComment in interface RDFHandlerRDFHandlerExceptionprotected void writeCommentLine(String line) throws IOException
IOExceptionprotected void writeBase(String baseURI) throws IOException
IOExceptionprotected void writeNamespace(String prefix, String name) throws IOException
IOExceptionprotected void writePredicate(org.eclipse.rdf4j.model.IRI predicate) throws IOException
IOException@Deprecated protected void writeValue(org.eclipse.rdf4j.model.Value val) throws IOException
writeValue(Value, boolean) instead.val - The Value to write.IOExceptionprotected void writeValue(org.eclipse.rdf4j.model.Value val, boolean canShorten) throws IOException
IRI and has a namespace definition that is suitable
for use in this context for shortening or a BNode that has been confirmed to be able to be shortened in
this context.val - The Value to write.canShorten - True if, in the current context, we can shorten this value if it is an instance of
BNode .IOException@Deprecated protected void writeResource(org.eclipse.rdf4j.model.Resource res) throws IOException
writeResource(Resource, boolean) instead.res - The Resource to write.IOExceptionprotected void writeResource(org.eclipse.rdf4j.model.Resource res, boolean canShorten) throws IOException
Resource, optionally shortening it if it is an IRI and has a namespace definition that
is suitable for use in this context for shortening or a BNode that has been confirmed to be able to be
shortened in this context.res - The Resource to write.canShorten - True if, in the current context, we can shorten this value if it is an instance of
BNode .IOExceptionprotected void writeURI(org.eclipse.rdf4j.model.IRI uri) throws IOException
IOException@Deprecated protected void writeBNode(org.eclipse.rdf4j.model.BNode bNode) throws IOException
writeBNode(BNode, boolean) instead.bNode - The BNode to write.IOExceptionprotected void writeBNode(org.eclipse.rdf4j.model.BNode bNode, boolean canShorten) throws IOException
IOExceptionprotected void writeTriple(org.eclipse.rdf4j.model.Triple triple, boolean canShorten) throws IOException
IOExceptionprotected void writeTripleRDFStar(org.eclipse.rdf4j.model.Triple triple, boolean canShorten) throws IOException
IOExceptionprotected void writeLiteral(org.eclipse.rdf4j.model.Literal lit) throws IOException
IOExceptionprotected void closePreviousStatement()
throws IOException
IOExceptionCopyright © 2015-2021 Eclipse Foundation. All Rights Reserved.