|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openrdf.rio.turtle.TurtleWriter
public class TurtleWriter
An implementation of the RDFWriter interface that writes RDF documents in Turtle format. The Turtle format is defined in in this document.
| Field Summary | |
|---|---|
protected String |
baseURI
|
protected URI |
lastWrittenPredicate
|
protected Resource |
lastWrittenSubject
|
protected Map<String,String> |
namespaceTable
Table mapping namespace names (key) to namespace prefixes (value). |
protected boolean |
statementClosed
Flag indicating whether the last written statement has been closed. |
protected IndentingWriter |
writer
|
protected boolean |
writingStarted
|
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
protected void |
closePreviousStatement()
|
void |
endRDF()
Signals the end of the RDF data. |
RDFFormat |
getRDFFormat()
Gets the RDF format that this RDFWriter uses. |
void |
handleComment(String comment)
Handles a comment. |
void |
handleNamespace(String prefix,
String name)
Handles a namespace declaration/definition. |
void |
handleStatement(Statement st)
Handles a statement. |
void |
setBaseURI(String baseURI)
The baseURI that should be used in the output. |
void |
startRDF()
Signals the start of the RDF data. |
protected void |
writeBNode(BNode bNode)
|
protected void |
writeCommentLine(String line)
|
protected void |
writeLiteral(Literal lit)
|
protected void |
writeNamespace(String prefix,
String name)
|
protected void |
writePredicate(URI predicate)
|
protected void |
writeResource(Resource res)
|
protected void |
writeURI(URI uri)
|
protected void |
writeValue(Value val)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected String baseURI
protected IndentingWriter writer
protected Map<String,String> namespaceTable
protected boolean writingStarted
protected boolean statementClosed
protected Resource lastWrittenSubject
protected URI lastWrittenPredicate
| Constructor Detail |
|---|
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.| Method Detail |
|---|
public RDFFormat getRDFFormat()
RDFWriter
getRDFFormat in interface RDFWriterpublic void setBaseURI(String baseURI)
RDFWriter
setBaseURI in interface RDFWriterbaseURI - The URI associated with the data.
public void startRDF()
throws RDFHandlerException
RDFHandler
startRDF in interface RDFHandlerRDFHandlerException - If the RDF handler has encountered an unrecoverable error.
public void endRDF()
throws RDFHandlerException
RDFHandler
endRDF in interface RDFHandlerRDFHandlerException - If the RDF handler has encountered an unrecoverable error.
public void handleNamespace(String prefix,
String name)
throws RDFHandlerException
RDFHandler
handleNamespace in interface RDFHandlerprefix - The prefix for the namespace, or an empty string in case of a
default namespace.name - The URI that the prefix maps to.
RDFHandlerException - If the RDF handler has encountered an unrecoverable error.
public void handleStatement(Statement st)
throws RDFHandlerException
RDFHandler
handleStatement in interface RDFHandlerst - The statement.
RDFHandlerException - If the RDF handler has encountered an unrecoverable error.
public void handleComment(String comment)
throws RDFHandlerException
RDFHandler
handleComment in interface RDFHandlercomment - The comment.
RDFHandlerException - If the RDF handler has encountered an unrecoverable error.
protected void writeCommentLine(String line)
throws IOException
IOException
protected void writeNamespace(String prefix,
String name)
throws IOException
IOException
protected void writePredicate(URI predicate)
throws IOException
IOException
protected void writeValue(Value val)
throws IOException
IOException
protected void writeResource(Resource res)
throws IOException
IOException
protected void writeURI(URI uri)
throws IOException
IOException
protected void writeBNode(BNode bNode)
throws IOException
IOException
protected void writeLiteral(Literal lit)
throws IOException
IOException
protected void closePreviousStatement()
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||