org.semanticweb.owl.util
Class OntologyProcessor

java.lang.Object
  |
  +--org.semanticweb.owl.util.OntologyProcessor
Direct Known Subclasses:
OntologyReplicator

public abstract class OntologyProcessor
extends Object

A utility class for processing OWLOntologies in chunks. The progress of the processing can be monitored by attaching a ProgressListener.


Nested Class Summary
protected static class OntologyProcessor.NullProgressListener
          Empty progress listener.
protected static interface OntologyProcessor.ObjectProcessor
          Processor for loaded objects.
static interface OntologyProcessor.ProgressListener
          The interface receiving notification about the progress of the processor.
 
Field Summary
protected static int CHUNK_SIZE
          The size of the chunks for processing.
protected  OntologyProcessor.ProgressListener m_progressListener
          The progress listener of the processor.
 
Constructor Summary
OntologyProcessor()
          Creates an instance of this class.
 
Method Summary
protected  void checkInterrupted()
          Checks whether the thread has been interrupted and throws an exception.
protected  void processElements(Set set, OWLOntology ontology, int loadFlag, OntologyProcessor.ObjectProcessor objectProcessor, int progressPhase)
          Loads and processes elements from the given set in chunks.
 void setProgressListener(OntologyProcessor.ProgressListener progressListener)
          Registers a progress listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHUNK_SIZE

protected static final int CHUNK_SIZE
The size of the chunks for processing.

See Also:
Constant Field Values

m_progressListener

protected OntologyProcessor.ProgressListener m_progressListener
The progress listener of the processor.

Constructor Detail

OntologyProcessor

public OntologyProcessor()
Creates an instance of this class.

Method Detail

setProgressListener

public void setProgressListener(OntologyProcessor.ProgressListener progressListener)
Registers a progress listener.

Parameters:
progressListener - the listener for processor progress

processElements

protected void processElements(Set set,
                               OWLOntology ontology,
                               int loadFlag,
                               OntologyProcessor.ObjectProcessor objectProcessor,
                               int progressPhase)
                        throws OWLException,
                               InterruptedException
Loads and processes elements from the given set in chunks.

Parameters:
set - the original set of objects
ontology - the OWLOntology that loads elements (may be null - loading is then not done)
loadFlag - the flag specifying which information should be loaded
objectProcessor - receives objects to be processed
progressPhase - the phase of the replication
Throws:
OWLException - thrown if there is an error
InterruptedException - thrown if the replicator has been interrupted

checkInterrupted

protected void checkInterrupted()
                         throws InterruptedException
Checks whether the thread has been interrupted and throws an exception.

Throws:
InterruptedException - thrown if the replicator has been interrupted


WonderWeb