Class PrettyTurtleWriter

  • All Implemented Interfaces:
    RDFHandler, RDFWriter

    public class PrettyTurtleWriter
    extends TurtleWriter
    implements RDFWriter

    An Turtle writer that abbreviates bnodes and lists. This writer requires to buffer all the triples in memory before writing so no output will be printed until end() is called. If the number of triples exceed a limit, the writer prints them as TurtleWriter, i.e. without bnode and list shortcuts.

    Since:
    1.0
    Version:
    1.0
    Author:
    Michael Grove
    Implementation Notes:
    Comments are not supported with this writer
    • Constructor Detail

      • PrettyTurtleWriter

        public PrettyTurtleWriter​(java.io.OutputStream theWriter,
                                  Options theOptions)
    • Method Detail

      • end

        public void end()
        Signals the writing process is completed. The underlying InputStream is *not* closed, but the caller should not call additional methods on this writer as that will normally yield syntax errors in the output.
        Specified by:
        end in interface RDFHandler
        Specified by:
        end in interface RDFWriter
        Overrides:
        end in class TurtleWriter
      • comment

        public void comment​(@Nonnull
                            java.lang.String theComment)
        Write a comment to the output. Writing need not be started at this point; comments can be written prior to any actual serialized RDF
        Specified by:
        comment in interface RDFWriter
        Overrides:
        comment in class TurtleWriter
        Parameters:
        theComment - the comment to write
      • namespace

        public void namespace​(@Nonnull
                              java.lang.String thePrefix,
                              @Nonnull
                              java.lang.String theIRI)
        Description copied from class: TurtleWriter
        Provide a namespace to the writer. This method can be called before writing has started, in which case, the namespace bindings are buffered and written when appropriate after writing has begun.
        Specified by:
        namespace in interface RDFHandler
        Specified by:
        namespace in interface RDFWriter
        Overrides:
        namespace in class TurtleWriter
        Parameters:
        thePrefix - the namespace prefix
        theIRI - the associated IRI