org.openrdf.rio.n3
Class N3Writer

java.lang.Object
  extended byorg.openrdf.rio.n3.N3Writer
All Implemented Interfaces:
RdfDocumentWriter

public class N3Writer
extends Object
implements RdfDocumentWriter

An implementation of the RdfDocumentWriter interface that writes RDF documents in N3 format. Note: the current implementation simply wraps a TurtleWriter and writes documents in Turtle format, which is a subset of N3.


Constructor Summary
N3Writer(OutputStream out)
          Creates a new N3Writer that will write to the supplied OutputStream.
N3Writer(Writer out)
          Creates a new N3Writer 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

N3Writer

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

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

N3Writer

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

Parameters:
out - The Writer to write the N3 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.