public class TriGWriter extends TurtleWriter
TurtleWriter
that writes RDF documents in
TriG format by adding graph scopes to the Turtle
document.baseIRI, lastWrittenPredicate, lastWrittenSubject, prettyPrintModel, statementClosed, writer, writingStarted
namespaceTable
Constructor and Description |
---|
TriGWriter(OutputStream out)
Creates a new TriGWriter that will write to the supplied OutputStream.
|
TriGWriter(OutputStream out,
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,
ParsedIRI baseIRI)
Creates a new TriGWriter that will write to the supplied Writer.
|
Modifier and Type | Method and Description |
---|---|
protected void |
closeActiveContext() |
void |
endRDF()
Signals the end of the RDF data.
|
RDFFormat |
getRDFFormat()
Gets the RDF format that this RDFWriter uses.
|
void |
handleStatement(Statement st)
Handles a statement.
|
protected void |
handleStatementInternal(Statement st,
boolean endRDFCalled,
boolean canShortenSubject,
boolean canShortenObject)
Internal method that differentiates between the pretty-print and streaming writer cases.
|
void |
startRDF()
Signals the start of the RDF data.
|
protected void |
writeCommentLine(String line) |
protected void |
writeNamespace(String prefix,
String name) |
closePreviousStatement, handleComment, handleNamespace, writeBase, writeBNode, writeBNode, writeLiteral, writePredicate, writeResource, writeResource, writeURI, writeValue, writeValue
getSupportedSettings, getWriterConfig, set, setWriterConfig
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSupportedSettings, getWriterConfig, set, setWriterConfig
public TriGWriter(OutputStream out)
out
- The OutputStream to write the TriG document to.public TriGWriter(OutputStream out, ParsedIRI baseIRI)
out
- The OutputStream to write the TriG document to.public TriGWriter(Writer writer)
writer
- The Writer to write the TriG document to.public RDFFormat getRDFFormat()
RDFWriter
getRDFFormat
in interface RDFWriter
getRDFFormat
in class TurtleWriter
public void startRDF() throws RDFHandlerException
RDFHandler
startRDF
in interface RDFHandler
startRDF
in class TurtleWriter
RDFHandlerException
- If the RDF handler has encountered an unrecoverable error.public void endRDF() throws RDFHandlerException
RDFHandler
endRDF
in interface RDFHandler
endRDF
in class TurtleWriter
RDFHandlerException
- If the RDF handler has encountered an unrecoverable error.public void handleStatement(Statement st) throws RDFHandlerException
RDFHandler
handleStatement
in interface RDFHandler
handleStatement
in class TurtleWriter
st
- The statement.RDFHandlerException
- If the RDF handler has encountered an unrecoverable error.protected void handleStatementInternal(Statement st, boolean endRDFCalled, boolean canShortenSubject, boolean canShortenObject)
TurtleWriter
handleStatementInternal
in class TurtleWriter
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.canShortenSubject
- True if, in the current context, we may be able to shorten the subject of this
statement iff it is an instance of BNode
.canShortenObject
- 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 writeCommentLine(String line) throws IOException
writeCommentLine
in class TurtleWriter
IOException
protected void writeNamespace(String prefix, String name) throws IOException
writeNamespace
in class TurtleWriter
IOException
protected void closeActiveContext() throws IOException
IOException
Copyright © 2015-2019 Eclipse Foundation. All Rights Reserved.