public class TurtleWriter extends AbstractRDFWriter implements RDFWriter
| Modifier and Type | Field and Description |
|---|---|
protected IRI |
lastWrittenPredicate |
protected Resource |
lastWrittenSubject |
protected Model |
prettyPrintModel
A
Model that is only used if pretty printing is enabled before startRDF is called; |
protected boolean |
statementClosed
Flag indicating whether the last written statement has been closed.
|
protected IndentingWriter |
writer |
protected boolean |
writingStarted |
namespaceTable| Constructor and Description |
|---|
TurtleWriter(OutputStream out)
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.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
closePreviousStatement() |
void |
endRDF() |
RDFFormat |
getRDFFormat() |
void |
handleComment(String comment) |
void |
handleNamespace(String prefix,
String name) |
void |
handleStatement(Statement st) |
protected void |
handleStatementInternal(Statement st,
boolean endRDFCalled,
boolean canShortenSubjectBNode,
boolean canShortenObjectBNode)
Internal method that differentiates between the pretty-print and streaming writer cases.
|
void |
startRDF() |
protected void |
writeBNode(BNode bNode)
Deprecated.
Use
writeBNode(BNode, boolean) instead. |
protected void |
writeBNode(BNode bNode,
boolean canShorten) |
protected void |
writeCommentLine(String line) |
protected void |
writeLiteral(Literal lit) |
protected void |
writeNamespace(String prefix,
String name) |
protected void |
writePredicate(IRI predicate) |
protected void |
writeResource(Resource res)
Deprecated.
Use
writeResource(Resource, boolean) instead. |
protected void |
writeResource(Resource res,
boolean canShorten)
|
protected void |
writeURI(IRI uri) |
protected void |
writeValue(Value val)
Deprecated.
Use
writeValue(Value, boolean) instead. |
protected void |
writeValue(Value val,
boolean canShorten)
|
getSupportedSettings, getWriterConfig, set, setWriterConfigclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetSupportedSettings, getWriterConfig, set, setWriterConfigprotected IndentingWriter writer
protected boolean writingStarted
protected boolean statementClosed
protected Resource lastWrittenSubject
protected IRI lastWrittenPredicate
public TurtleWriter(OutputStream out)
out - The OutputStream to write the Turtle document to.public TurtleWriter(Writer writer)
writer - The Writer to write the Turtle document to.public RDFFormat getRDFFormat()
getRDFFormat in interface RDFWriterpublic void startRDF()
throws RDFHandlerException
startRDF in interface RDFHandlerRDFHandlerExceptionpublic void endRDF()
throws RDFHandlerException
endRDF in interface RDFHandlerRDFHandlerExceptionpublic void handleNamespace(String prefix, String name) throws RDFHandlerException
handleNamespace in interface RDFHandlerhandleNamespace in class AbstractRDFWriterRDFHandlerExceptionpublic void handleStatement(Statement st) throws RDFHandlerException
handleStatement in interface RDFHandlerRDFHandlerExceptionprotected void handleStatementInternal(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.public void handleComment(String comment) throws RDFHandlerException
handleComment in interface RDFHandlerRDFHandlerExceptionprotected void writeCommentLine(String line) throws IOException
IOExceptionprotected void writeNamespace(String prefix, String name) throws IOException
IOExceptionprotected void writePredicate(IRI predicate) throws IOException
IOException@Deprecated protected void writeValue(Value val) throws IOException
writeValue(Value, boolean) instead.val - The Value to write.IOExceptionprotected void writeValue(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(Resource res) throws IOException
writeResource(Resource, boolean) instead.res - The Resource to write.IOExceptionprotected void writeResource(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(IRI uri) throws IOException
IOException@Deprecated protected void writeBNode(BNode bNode) throws IOException
writeBNode(BNode, boolean) instead.bNode - The BNode to write.IOExceptionprotected void writeBNode(BNode bNode, boolean canShorten) throws IOException
IOExceptionprotected void writeLiteral(Literal lit) throws IOException
IOExceptionprotected void closePreviousStatement()
throws IOException
IOExceptionCopyright © 2015-2017 Eclipse Foundation. All Rights Reserved.