Class NTripleWriter

  • All Implemented Interfaces:
    RDFWriterI

    public class NTripleWriter
    extends java.lang.Object
    implements RDFWriterI
    Writes out an XML serialization of a model.
    • Constructor Summary

      Constructors 
      Constructor Description
      NTripleWriter()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getPrefixFor​(java.lang.String uri)  
      RDFErrorHandler setErrorHandler​(RDFErrorHandler errHandler)
      Set an error handler.
      void setNsPrefix​(java.lang.String prefix, java.lang.String ns)  
      java.lang.Object setProperty​(java.lang.String propName, java.lang.Object propValue)
      Set a property to control the writer's behaviour.
      void write​(Model model, java.io.OutputStream out, java.lang.String base)
      Serialize Model model to OutputStream out.
      static void write​(Model model, java.io.PrintWriter writer)  
      void write​(Model model, java.io.Writer writer, java.lang.String base)
      Caution: Serialize Model model to Writer out.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NTripleWriter

        public NTripleWriter()
    • Method Detail

      • write

        public void write​(Model model,
                          java.io.OutputStream out,
                          java.lang.String base)
        Description copied from interface: RDFWriterI
        Serialize Model model to OutputStream out. The implementation chooses the character encoding, utf-8 is preferred.
        Specified by:
        write in interface RDFWriterI
        Parameters:
        model - The model to be written.
        out - The OutputStream to which the serialization should be sent.
        base - the base URI for relative URI calculations. null means use only absolute URI's. This is used for relative URIs that would be resolved against the document retrieval URL. Particular writers may include this value in the output.
      • write

        public void write​(Model model,
                          java.io.Writer writer,
                          java.lang.String base)
        Description copied from interface: RDFWriterI
        Caution: Serialize Model model to Writer out. It is often better to use an OutputStream and permit Jena to choose the character encoding. The charset restrictions on the Writer are defined by the different implementations of this interface. Typically using an OutputStreamWriter (e.g. a FileWriter) at least permits the implementation to examine the encoding. With an arbitrary Writer implementations assume a utf-8 encoding.
        Specified by:
        write in interface RDFWriterI
        Parameters:
        model - The model to be written.
        writer - The Writer to which the serialization should be sent.
        base - the base URI for relative URI calculations. null means use only absolute URI's.
      • setProperty

        public java.lang.Object setProperty​(java.lang.String propName,
                                            java.lang.Object propValue)
        Set a property to control the writer's behaviour.

        This writer currently recognises no properties. Invoking this method always causes an UnknownPropertyException to be raised.

        ?
        Specified by:
        setProperty in interface RDFWriterI
        Parameters:
        propName - The name of the property to be set
        propValue - The new value of the property
        Returns:
        the previous value of the property
      • setNsPrefix

        public void setNsPrefix​(java.lang.String prefix,
                                java.lang.String ns)
      • getPrefixFor

        public java.lang.String getPrefixFor​(java.lang.String uri)
      • write

        public static void write​(Model model,
                                 java.io.PrintWriter writer)