Package org.apache.any23.writer

## Interface TripleWriter

- All Superinterfaces:
    `AutoCloseable`

      public interface TripleWriter
      extends AutoCloseable

  Base interface for triple writers that don't need an extraction context to write triples
  Author:
    Hans Brende (hansbrende@apache.org)

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `close()` | Releases resources associated with this `TripleWriter`, and flushes (but by default does not close) any underlying `OutputStream`s.
    `void` | `writeNamespace​(String prefix, String uri)` | Writes a prefix-namespace mapping.
    `void` | `writeTriple​(org.eclipse.rdf4j.model.Resource s, org.eclipse.rdf4j.model.IRI p, org.eclipse.rdf4j.model.Value o, org.eclipse.rdf4j.model.Resource g)` | Writes a triple and, optionally, a graph resource name.

- - ### Method Detail

    - #### writeTriple

          void writeTriple​(org.eclipse.rdf4j.model.Resource s,
                           org.eclipse.rdf4j.model.IRI p,
                           org.eclipse.rdf4j.model.Value o,
                           org.eclipse.rdf4j.model.Resource g)
                    throws TripleHandlerException

      Writes a triple and, optionally, a graph resource name.
      Parameters:
        `s` - the subject to write
        `p` - the predicate to write
        `o` - the object to write
        `g` - the graph name to write, or null
      Throws:
        `TripleHandlerException` - if there is an error writing the triple

    - #### writeNamespace

          void writeNamespace​(String prefix,
                              String uri)
                       throws TripleHandlerException

      Writes a prefix-namespace mapping.
      NOTE: this method should be called before writing out any triples. Calling this method after writing out a triple may result in the prefix-namespace mapping being ignored.
      Parameters:
        `prefix` - the namespace prefix
        `uri` - the namespace uri
      Throws:
        `TripleHandlerException` - if there was an error writing out the prefix-namespace mapping

    - #### close

          void close()
              throws TripleHandlerException

      Releases resources associated with this `TripleWriter`, and flushes (but by default does not close) any underlying `OutputStream`s. Future invocations of methods of this writer produce undefined behavior after this method has been called.
      Specified by:
        `close` in interface `AutoCloseable`
      Throws:
        `TripleHandlerException` - if there was an error closing this `TripleWriter`