org.semanticweb.owl.util
Class OntologyReplicator

java.lang.Object
  |
  +--org.semanticweb.owl.util.OntologyProcessor
        |
        +--org.semanticweb.owl.util.OntologyReplicator

public class OntologyReplicator
extends OntologyProcessor

A utility class for copying one ontology into another.


Nested Class Summary
 
Nested classes inherited from class org.semanticweb.owl.util.OntologyProcessor
OntologyProcessor.NullProgressListener, OntologyProcessor.ObjectProcessor, OntologyProcessor.ProgressListener
 
Field Summary
protected  List m_changeEvents
          The list of events.
protected  Map m_logicalToPhysicalURIs
          The map of logical to physical URI mappings.
protected  OWLOntology m_sourceOWLOntology
          The source OWL Ontology.
protected  Map m_sourceToTarget
          The map of source to target models.
protected  OWLConnection m_targetOWLConnection
          The target KAON connection.
protected  OWLOntology m_targetOWLOntology
          The target OWL Ontology.
static int PHASE_COPY_CONCEPTS
          Phase of copying concepts.
static int PHASE_COPY_INSTANCES
          Phase of copying instances.
static int PHASE_COPY_PROPERTIES
          Phase of copying properties.
static int PHASE_LOAD_CONCEPTS
          Phase of loading concepts.
static int PHASE_LOAD_INSTANCES
          Phase of loading instances.
static int PHASE_LOAD_PROPERTIES
          Phase of loading properties.
 
Fields inherited from class org.semanticweb.owl.util.OntologyProcessor
CHUNK_SIZE, m_progressListener
 
Constructor Summary
OntologyReplicator(OWLOntology sourceOWLOntology, Map logicalToPhysicalURIs, OWLConnection targetKAONConnection)
          Creates an instance of this class.
 
Method Summary
protected  void applyChange(OntologyChange changeEvent)
          Adds an event to be processed.
protected  void copyConcepts(Set concepts)
          Copies the information about the concepts.
protected  void copyInstances(Set instances)
          Copies the information about the instances.
protected  void copyProperties(Set properties)
          Copies the information about the properties.
protected  OWLOntology createTargetOWLOntology(OWLOntology sourceOWLOntology)
          Creates a target model for given source OWL Ontology.
 OWLOntology doReplication()
          Starts the replication of the source model to the target model
protected  void flushChanges()
          Flushes the changes to the OWL Ontology.
protected  Set loadConcepts()
          Loads the concepts.
protected  Set loadInstances()
          Loads the instances.
protected  Set loadProperties()
          Loads the properties.
protected  void processConcepts()
          Processes all concepts.
protected  void processInstances()
          Processes all instances.
protected  void processProperties()
          Processes all properties.
protected  void setUpModelMappings()
          Establishes the map from source to target Ontologies.
 
Methods inherited from class org.semanticweb.owl.util.OntologyProcessor
checkInterrupted, processElements, setProgressListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PHASE_LOAD_CONCEPTS

public static final int PHASE_LOAD_CONCEPTS
Phase of loading concepts.

See Also:
Constant Field Values

PHASE_COPY_CONCEPTS

public static final int PHASE_COPY_CONCEPTS
Phase of copying concepts.

See Also:
Constant Field Values

PHASE_LOAD_PROPERTIES

public static final int PHASE_LOAD_PROPERTIES
Phase of loading properties.

See Also:
Constant Field Values

PHASE_COPY_PROPERTIES

public static final int PHASE_COPY_PROPERTIES
Phase of copying properties.

See Also:
Constant Field Values

PHASE_LOAD_INSTANCES

public static final int PHASE_LOAD_INSTANCES
Phase of loading instances.

See Also:
Constant Field Values

PHASE_COPY_INSTANCES

public static final int PHASE_COPY_INSTANCES
Phase of copying instances.

See Also:
Constant Field Values

m_logicalToPhysicalURIs

protected Map m_logicalToPhysicalURIs
The map of logical to physical URI mappings.


m_sourceOWLOntology

protected OWLOntology m_sourceOWLOntology
The source OWL Ontology.


m_targetOWLOntology

protected OWLOntology m_targetOWLOntology
The target OWL Ontology.


m_targetOWLConnection

protected OWLConnection m_targetOWLConnection
The target KAON connection.


m_changeEvents

protected List m_changeEvents
The list of events.


m_sourceToTarget

protected Map m_sourceToTarget
The map of source to target models.

Constructor Detail

OntologyReplicator

public OntologyReplicator(OWLOntology sourceOWLOntology,
                          Map logicalToPhysicalURIs,
                          OWLConnection targetKAONConnection)
Creates an instance of this class.

Parameters:
sourceOWLOntology - the source OWL Ontology
logicalToPhysicalURIs - the map of logical to physical URIs
targetKAONConnection - the target KAON connection
Method Detail

doReplication

public OWLOntology doReplication()
                          throws OWLException,
                                 InterruptedException
Starts the replication of the source model to the target model

Returns:
the target model
Throws:
OWLException - thrown if there is an error
InterruptedException - thrown if the replicator has been interrupted

setUpModelMappings

protected void setUpModelMappings()
                           throws OWLException,
                                  InterruptedException
Establishes the map from source to target Ontologies.

Throws:
OWLException - thrown it there is an error
InterruptedException - thrown if the replicator has been interrupted

createTargetOWLOntology

protected OWLOntology createTargetOWLOntology(OWLOntology sourceOWLOntology)
                                       throws OWLException
Creates a target model for given source OWL Ontology.

Parameters:
sourceOWLOntology - the source OWL Ontology
Returns:
the OWL Ontology generated for given source OWL Ontology
Throws:
OWLException - thrown it there is an error

processConcepts

protected void processConcepts()
                        throws OWLException,
                               InterruptedException
Processes all concepts.

Throws:
OWLException - thrown if there is an error
InterruptedException - thrown if the replicator has been interrupted

processProperties

protected void processProperties()
                          throws OWLException,
                                 InterruptedException
Processes all properties.

Throws:
OWLException - thrown if there is an error
InterruptedException - thrown if the replicator has been interrupted

processInstances

protected void processInstances()
                         throws OWLException,
                                InterruptedException
Processes all instances.

Throws:
OWLException - thrown if there is an error
InterruptedException - thrown if the replicator has been interrupted

loadConcepts

protected Set loadConcepts()
                    throws OWLException,
                           InterruptedException
Loads the concepts.

Returns:
the set of concepts
Throws:
OWLException - thrown if there is an error
InterruptedException - thrown if the replicator has been interrupted

loadProperties

protected Set loadProperties()
                      throws OWLException,
                             InterruptedException
Loads the properties.

Returns:
the set of properties
Throws:
OWLException - thrown if there is an error
InterruptedException - thrown if the replicator has been interrupted

loadInstances

protected Set loadInstances()
                     throws OWLException,
                            InterruptedException
Loads the instances.

Returns:
the set of instances
Throws:
OWLException - thrown if there is an error
InterruptedException - thrown if the replicator has been interrupted

copyConcepts

protected void copyConcepts(Set concepts)
                     throws OWLException,
                            InterruptedException
Copies the information about the concepts.

Parameters:
concepts - the set of concepts
Throws:
OWLException - thrown if there is an error
InterruptedException - thrown if the replicator has been interrupted

copyProperties

protected void copyProperties(Set properties)
                       throws OWLException,
                              InterruptedException
Copies the information about the properties.

Parameters:
properties - the set of properties
Throws:
OWLException - thrown if there is an error
InterruptedException - thrown if the replicator has been interrupted

copyInstances

protected void copyInstances(Set instances)
                      throws OWLException,
                             InterruptedException
Copies the information about the instances.

Parameters:
instances - the set of instances
Throws:
OWLException - thrown if there is an error
InterruptedException - thrown if the replicator has been interrupted

applyChange

protected void applyChange(OntologyChange changeEvent)
                    throws OWLException
Adds an event to be processed.

Parameters:
changeEvent - the event
Throws:
OWLException - thrown if there is an error

flushChanges

protected void flushChanges()
                     throws OWLException
Flushes the changes to the OWL Ontology.

Throws:
OWLException - thrown if there is an error


WonderWeb