org.openrdf.rio.turtle
Class TurtleWriter

java.lang.Object
  extended byorg.openrdf.rio.turtle.TurtleWriter
All Implemented Interfaces:
RdfDocumentWriter

public class TurtleWriter
extends Object
implements RdfDocumentWriter

An implementation of the RdfDocumentWriter interface that writes RDF documents in Turtle format. The Turtle format is defined in in this document.


Constructor Summary
TurtleWriter(OutputStream out)
          Creates a new TurtleWriter that will write to the supplied OutputStream.
TurtleWriter(Writer out)
          Creates a new TurtleWriter that will write to the supplied Writer.
 
Method Summary
 void endDocument()
          Ends the document writing.
 void setNamespace(String prefix, String name)
          Sets a mapping from a namespace prefix to a namespace name.
 void startDocument()
          Starts the document writing.
 void writeComment(String comment)
          Writes a comment to the document.
 void writeStatement(Resource subj, URI pred, Value obj)
          Writes a statement to the document.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TurtleWriter

public TurtleWriter(OutputStream out)
Creates a new TurtleWriter that will write to the supplied OutputStream.

Parameters:
out - The OutputStream to write the Turtle document to.

TurtleWriter

public TurtleWriter(Writer out)
Creates a new TurtleWriter that will write to the supplied Writer.

Parameters:
out - The Writer to write the Turtle document to.
Method Detail

setNamespace

public void setNamespace(String prefix,
                         String name)
                  throws IOException
Description copied from interface: RdfDocumentWriter
Sets a mapping from a namespace prefix to a namespace name. Some implementations of this interface may require that namespace are set before the document writing starts (i.e. before startDocument() is called). Note that a mapping can only be defined once for a given namespace name. The RdfDocumentWriter will ignore an attempt to define a mapping for a namespace it already has a mapping for.

Specified by:
setNamespace in interface RdfDocumentWriter
Throws:
IOException

startDocument

public void startDocument()
                   throws IOException
Description copied from interface: RdfDocumentWriter
Starts the document writing.

Specified by:
startDocument in interface RdfDocumentWriter
Throws:
IOException

endDocument

public void endDocument()
                 throws IOException
Description copied from interface: RdfDocumentWriter
Ends the document writing.

Specified by:
endDocument in interface RdfDocumentWriter
Throws:
IOException

writeStatement

public void writeStatement(Resource subj,
                           URI pred,
                           Value obj)
                    throws IOException
Description copied from interface: RdfDocumentWriter
Writes a statement to the document. The startDocument() method should have been called before.

Specified by:
writeStatement in interface RdfDocumentWriter
Throws:
IOException

writeComment

public void writeComment(String comment)
                  throws IOException
Description copied from interface: RdfDocumentWriter
Writes a comment to the document. An implementation may ignore these calls if the format doesn't support comments.

Specified by:
writeComment in interface RdfDocumentWriter
Throws:
IOException


Copyright © 2002-2006 Aduna BV, GNU LGPL License applies.