de.fuberlin.wiwiss.ng4j.trig
Class TriGWriter

java.lang.Object
  extended by de.fuberlin.wiwiss.ng4j.trig.TriGWriter
All Implemented Interfaces:
NamedGraphSetWriter

public class TriGWriter
extends Object
implements NamedGraphSetWriter

Serializes a NamedGraphSet as a TriG file (see TriG specification).

This class is typically not used directly, but through the NamedGraphSet.write methods.

When used directly, custom namespace prefixes can be defined:

TriGWriter writer = new TriGWriter();
 writer.addNamespace("ex", "http://example.org/");
 writer.write(myNamedGraphSet, System.out, "http://example.org/baseURI");

Author:
Richard Cyganiak (richard@cyganiak.de)

Constructor Summary
TriGWriter()
           
 
Method Summary
 void addNamespace(String prefix, String namespaceURI)
          Adds a custom namespace prefix.
 void write(NamedGraphSet set, OutputStream out, String baseURI)
          Writes a NamedGraphSet to an OutputStream.
 void write(NamedGraphSet set, Writer out, String baseURI)
          Writes a NamedGraphSet to a Writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TriGWriter

public TriGWriter()
Method Detail

write

public void write(NamedGraphSet set,
                  Writer out,
                  String baseURI)
Writes a NamedGraphSet to a Writer. The base URI is optional.

Specified by:
write in interface NamedGraphSetWriter
Parameters:
set - The NamedGraphSet to be serialized
out - The destination
baseURI - A base URI, or null if none is known or needed

write

public void write(NamedGraphSet set,
                  OutputStream out,
                  String baseURI)
Writes a NamedGraphSet to an OutputStream. The base URI is optional.

Specified by:
write in interface NamedGraphSetWriter
Parameters:
set - The NamedGraphSet to be serialized
out - The destination
baseURI - A base URI, or null if none is known or needed

addNamespace

public void addNamespace(String prefix,
                         String namespaceURI)
Adds a custom namespace prefix.

Parameters:
prefix - The namespace prefix
namespaceURI - The full namespace URI