Class TurtleTriGWriter

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

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

    • TurtleTriGWriter

      public TurtleTriGWriter(Prefixes prefixes, 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 IOException
      Flushes the output stream.
      Throws:
      IOException - if an error occurs while writing to the output stream
    • close

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