edu.stanford.smi.protegex.owl.model.triplestore
Class DelegatingTripleWriter

java.lang.Object
  extended byedu.stanford.smi.protegex.owl.model.triplestore.DelegatingTripleWriter
All Implemented Interfaces:
TripleWriter
Direct Known Subclasses:
TripleStoreFilterTripleWriter

public class DelegatingTripleWriter
extends Object
implements TripleWriter

A TripleWriter that forwards all calls into a delegate TripleWriter. This can be used to chain writers, e.g. to insert a filter in front of a delegate.

Author:
Holger Knublauch

Field Summary
private  TripleWriter delegate
           
 
Constructor Summary
DelegatingTripleWriter(TripleWriter delegate)
           
 
Method Summary
 void addImport(String uri)
          Adds an owl:imports statement to the default ontology in this writer.
 void close()
          Tells the writer that we're finished.
 TripleWriter getDelegate()
           
 void init(String baseURI)
          Initializes this writer to work with a given base URI.
 void setDelegate(TripleWriter delegate)
           
 void write(RDFResource resource, RDFProperty property, Object object)
          Writes a given Triples into this writer.
 void writePrefix(String prefix, String namespace)
          Writes a prefix declaration into this writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

delegate

private TripleWriter delegate
Constructor Detail

DelegatingTripleWriter

public DelegatingTripleWriter(TripleWriter delegate)
Method Detail

addImport

public void addImport(String uri)
Description copied from interface: TripleWriter
Adds an owl:imports statement to the default ontology in this writer. This is a convenience method because the same can typically be achieved by adding a corresponding triple.

Specified by:
addImport in interface TripleWriter
Parameters:
uri - the URI to add

close

public void close()
           throws Exception
Description copied from interface: TripleWriter
Tells the writer that we're finished. This method should be called at the end of a writing process. After this method has been called, no other calls to this object are permitted.

Specified by:
close in interface TripleWriter
Throws:
Exception

getDelegate

public TripleWriter getDelegate()

init

public void init(String baseURI)
Description copied from interface: TripleWriter
Initializes this writer to work with a given base URI. This URI will also be the URI of the default ontology in this file, and future calls of addImport will add to this ontology.

Specified by:
init in interface TripleWriter
Parameters:
baseURI - the base URI, such as http://www.a.com/ontology.owl

setDelegate

public void setDelegate(TripleWriter delegate)

write

public void write(RDFResource resource,
                  RDFProperty property,
                  Object object)
           throws Exception
Description copied from interface: TripleWriter
Writes a given Triples into this writer.

Specified by:
write in interface TripleWriter
Throws:
Exception

writePrefix

public void writePrefix(String prefix,
                        String namespace)
                 throws Exception
Description copied from interface: TripleWriter
Writes a prefix declaration into this writer. Since namespace declarations are typically written to the beginning of a file, implementations of this method may require that any calls to this method are done before the first triple is written out.

Specified by:
writePrefix in interface TripleWriter
Parameters:
prefix - the prefix to define ("" for the default namespace)
namespace - the namespace to assign to the prefix
Throws:
Exception