Class RdfTurtleWriter


  • public class RdfTurtleWriter
    extends GraphHandler
    Handler of RDF content according to the N3 notation.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Context context
      The current context object.
      private Reference precPredicate
      The preceding predicate used for factorization matter.
      private Reference precSource
      The preceding source used for factorization matter.
      private java.io.Writer writer
      Buffered writer.
      private boolean writingExtraDot
      Indicates if the end of the statement is to be written.
    • Constructor Summary

      Constructors 
      Constructor Description
      RdfTurtleWriter​(java.io.Writer writer)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void endGraph()
      Callback method used after the graph is parsed or written.
      void link​(Reference source, Reference typeRef, Reference target)
      Callback method used when a link is parsed or written.
      void link​(Reference source, Reference typeRef, Literal target)
      Callback method used when a link is parsed or written.
      void link​(Graph source, Reference typeRef, Reference target)
      Callback method used when a link is parsed or written.
      void link​(Graph source, Reference typeRef, Literal target)
      Callback method used when a link is parsed or written.
      void startGraph()
      Callback method used before the graph is parsed or written.
      private void write​(Reference reference, java.util.Map<java.lang.String,​java.lang.String> prefixes)
      Writes the representation of a given reference.
      private void write​(Graph linkset)
      Write the representation of the given graph of links.
      private void write​(Literal literal)
      Writes the representation of a literal.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • context

        private Context context
        The current context object.
      • precPredicate

        private Reference precPredicate
        The preceding predicate used for factorization matter.
      • precSource

        private Reference precSource
        The preceding source used for factorization matter.
      • writer

        private java.io.Writer writer
        Buffered writer.
      • writingExtraDot

        private boolean writingExtraDot
        Indicates if the end of the statement is to be written.
    • Constructor Detail

      • RdfTurtleWriter

        public RdfTurtleWriter​(java.io.Writer writer)
                        throws java.io.IOException
        Constructor.
        Parameters:
        writer - The character writer.
        Throws:
        java.io.IOException
    • Method Detail

      • endGraph

        public void endGraph()
                      throws java.io.IOException
        Description copied from class: GraphHandler
        Callback method used after the graph is parsed or written. Does nothing by default.
        Overrides:
        endGraph in class GraphHandler
        Throws:
        java.io.IOException
      • link

        public void link​(Graph source,
                         Reference typeRef,
                         Literal target)
        Description copied from class: GraphHandler
        Callback method used when a link is parsed or written.
        Specified by:
        link in class GraphHandler
        Parameters:
        source - The source or subject of the link.
        typeRef - The type reference of the link.
        target - The target or object of the link.
      • link

        public void link​(Graph source,
                         Reference typeRef,
                         Reference target)
        Description copied from class: GraphHandler
        Callback method used when a link is parsed or written.
        Specified by:
        link in class GraphHandler
        Parameters:
        source - The source or subject of the link.
        typeRef - The type reference of the link.
        target - The target or object of the link.
      • link

        public void link​(Reference source,
                         Reference typeRef,
                         Literal target)
        Description copied from class: GraphHandler
        Callback method used when a link is parsed or written.
        Specified by:
        link in class GraphHandler
        Parameters:
        source - The source or subject of the link.
        typeRef - The type reference of the link.
        target - The target or object of the link.
      • link

        public void link​(Reference source,
                         Reference typeRef,
                         Reference target)
        Description copied from class: GraphHandler
        Callback method used when a link is parsed or written.
        Specified by:
        link in class GraphHandler
        Parameters:
        source - The source or subject of the link.
        typeRef - The type reference of the link.
        target - The target or object of the link.
      • startGraph

        public void startGraph()
        Description copied from class: GraphHandler
        Callback method used before the graph is parsed or written. Does nothing by default.
        Overrides:
        startGraph in class GraphHandler
      • write

        private void write​(Graph linkset)
                    throws java.io.IOException
        Write the representation of the given graph of links.
        Parameters:
        linkset - the given graph of links.
        Throws:
        java.io.IOException
      • write

        private void write​(Literal literal)
                    throws java.io.IOException
        Writes the representation of a literal.
        Parameters:
        literal - The literal to write.
        Throws:
        java.io.IOException
      • write

        private void write​(Reference reference,
                           java.util.Map<java.lang.String,​java.lang.String> prefixes)
                    throws java.io.IOException
        Writes the representation of a given reference.
        Parameters:
        reference - The reference to write.
        prefixes - The map of known namespaces.
        Throws:
        java.io.IOException