Class TurtleTriGWriter

java.lang.Object
tech.oxfordsemantic.jrdfox.formats.TurtleTriGWriter

public class TurtleTriGWriter
extends java.lang.Object
A class for writing RDF triples and quads in the Turtle and TriG formats.
  • Constructor Summary

    Constructors 
    Constructor Description
    TurtleTriGWriter​(Prefixes prefixes, java.io.OutputStream outputStream)
    Creates a new TurtleTriGWriter object that writes to the specified output stream.
  • Method Summary

    Modifier and Type Method Description
    void close()
    Flushes, then closes the output stream.
    void flush()
    Flushes the output stream.
    void writeQuad​(Resource subject, Resource predicate, Resource object, Resource graph)
    Writes an RDF quad to the output stream.
    void writeTriple​(Resource subject, Resource predicate, Resource object)
    Writes an RDF triple to the output stream.

    Methods inherited from class java.lang.Object

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

    • TurtleTriGWriter

      public TurtleTriGWriter​(Prefixes prefixes, java.io.OutputStream outputStream)
      Creates a new TurtleTriGWriter object that writes to the specified output stream.
      Parameters:
      prefixes - the prefixes to be used for writing the RDF data
      outputStream - the output stream to which the RDF data will be written (using UTF8 encoding)
  • Method Details

    • writeTriple

      public void writeTriple​(Resource subject, Resource predicate, Resource object)
      Writes an RDF triple to the output stream.
      Parameters:
      subject - the subject of the triple
      predicate - the predicate of the triple
      object - the object of the triple
    • writeQuad

      public void writeQuad​(Resource subject, Resource predicate, Resource object, Resource graph)
      Writes an RDF quad to the output stream.
      Parameters:
      subject - the subject of the quad
      predicate - the predicate of the quad
      object - the object of the quad
      graph - the graph of the quad
    • flush

      public void flush() throws java.io.IOException
      Flushes the output stream.
      Throws:
      java.io.IOException - if an error occurs while writing to the output stream
    • close

      public void close() throws java.io.IOException
      Flushes, then closes the output stream.
      Throws:
      java.io.IOException - if an error occurs