org.semanticweb.owl.impl.model
Class OWLConnectionImpl

java.lang.Object
  |
  +--org.semanticweb.owl.impl.model.OWLConnectionImpl
All Implemented Interfaces:
OWLConnection

public class OWLConnectionImpl
extends Object
implements OWLConnection

OWL Connection The class gives access to a concrete implementation of the OWL API

Since:
05.02.2003
Version:
$Id: OWLConnectionImpl.java,v 1.5 2004/03/05 17:34:48 sean_bechhofer Exp $

Nested Class Summary
protected static class OWLConnectionImpl.PhysicalURIResolver
          The resolver for RDF physical URIs.
 
Field Summary
protected  ChangeVisitor m_applyChangeVisitor
          Visitor for change events.
protected  Map m_ontologiesByLogicalURI
          The map of OWL ontologies indexed by the logical URI opened by this connection.
protected  Map m_ontologiesByPhysicalURI
          The map of OWL ontologies indexed by the physical URI opened by this connection.
protected  OWLDataFactory m_owlDataFactory
          Data Factory used to create entities
protected  Map m_parameters
          Parameters of this connection
protected static Map s_defaultParameters
          Default parameters of this connection
 
Constructor Summary
OWLConnectionImpl()
          Creates an instance of this class with default parameters.
OWLConnectionImpl(Map parameters)
          Creates an instance of this class using user defined parameters.
OWLConnectionImpl(Map parameters, Map ontologiesByLogicalURI, Map ontologiesByPhysicalURI)
          Creates an instance of this class.
 
Method Summary
 void applyChanges(List changes)
          Deprecated.  
 void changeOntologyLogicalURI(OWLOntology o, URI uri)
           
 void close()
          Closes all opened ontologies.
 OWLOntology createOntology(URI physicalURI, URI logicalURI)
          Creates an OWLOntology with a given physical and logical URI.
 OWLOntology createOWLOntology(URI physicalURI, URI logicalURI)
          Deprecated. Use createOntology instead.
 Set getAllLogicalURIs()
          Returns the set of logical URIs of all OI-models available at the node represented by this KAON connection.
 Set getAllOntologies()
          Returns the set of OI-models available at the node represented by this KAON connection.
 ChangeVisitor getChangeVisitor(OWLOntology o)
          Given an ontology, returns a change visitor that will enact changes over that ontology.
 OWLConnection getConnection()
          Deprecated.  
 OWLDataFactory getDataFactory()
           
 OWLOntology getOntologyLogical(URI logicalURI)
          Returns an OWLOntology with given logical URI.
 OWLOntology getOntologyPhysical(URI physicalURI)
           
 Set getOpenOWLOntologies()
          Returns the set of all open OWLOntology objects.
 Map getParameters()
          Returns the parameters of this connection.
 boolean isOpen()
          Returns true if this connection is open, i.e. atleast one ontology is open.
 OWLOntology loadOntologyPhysical(URI physicalURI)
          Loads an OWLOntology with given physical URI (in fact an URL), somewhere on the web or in the file system.
 void notifyOntologyDeleted(OWLOntology onto)
          Notifies the connection that the OWLOntology has been deleted.
 OWLOntology openOntologyLogical(URI logicalURI)
          Deprecated.  
 OWLOntology openOntologyPhysical(URI physicalURI)
          Deprecated. Use getOntology instead.
 OWLOntology reloadOntologyPhysical(URI physicalURI)
          Reloads an OWLOntology with given physical URI (in fact an URL), somewhere on the web or in the file system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

s_defaultParameters

protected static final Map s_defaultParameters
Default parameters of this connection


m_parameters

protected Map m_parameters
Parameters of this connection


m_ontologiesByLogicalURI

protected Map m_ontologiesByLogicalURI
The map of OWL ontologies indexed by the logical URI opened by this connection.


m_ontologiesByPhysicalURI

protected Map m_ontologiesByPhysicalURI
The map of OWL ontologies indexed by the physical URI opened by this connection.


m_owlDataFactory

protected OWLDataFactory m_owlDataFactory
Data Factory used to create entities


m_applyChangeVisitor

protected ChangeVisitor m_applyChangeVisitor
Visitor for change events.

Constructor Detail

OWLConnectionImpl

public OWLConnectionImpl()
                  throws OWLException
Creates an instance of this class with default parameters.

Throws:
OWLException - thrown if connection cannot be created

OWLConnectionImpl

public OWLConnectionImpl(Map parameters)
                  throws OWLException
Creates an instance of this class using user defined parameters.

Parameters:
parameters - the map of parameters
Throws:
OWLException - thrown if connection cannot be created

OWLConnectionImpl

public OWLConnectionImpl(Map parameters,
                         Map ontologiesByLogicalURI,
                         Map ontologiesByPhysicalURI)
                  throws OWLException
Creates an instance of this class.

Parameters:
parameters - the map of connection parameters
ontologiesByLogicalURI - the map of OWL Ontologies by logical URI
ontologiesByPhysicalURI - the map of OWL Ontologies by physical URI
Throws:
OWLException - thrown if connection cannot be created
Method Detail

getDataFactory

public OWLDataFactory getDataFactory()
Specified by:
getDataFactory in interface OWLConnection

getParameters

public Map getParameters()
Returns the parameters of this connection.

Specified by:
getParameters in interface OWLConnection
Returns:
the parameters of this connection

close

public void close()
Closes all opened ontologies. Involves no saving of changes !!!

Specified by:
close in interface OWLConnection

isOpen

public boolean isOpen()
Description copied from interface: OWLConnection
Returns true if this connection is open, i.e. atleast one ontology is open.

Specified by:
isOpen in interface OWLConnection
Returns:
true if this connection has one opened ontology.

getConnection

public OWLConnection getConnection()
                            throws OWLException
Deprecated.  

Returns a new connection using the parameters of this connection.

Throws:
OWLException - thrown if connection cannot be created

openOntologyPhysical

public OWLOntology openOntologyPhysical(URI physicalURI)
                                 throws OWLException
Deprecated. Use getOntology instead.

Opens an OWL Ontology from a given network-reachable URI, i.e. an URL. Throws an OWLException if the ontology has already be opened.

Specified by:
openOntologyPhysical in interface OWLConnection
Parameters:
physicalURI - the physical URI of the OWLOntology
Returns:
the OWLOntology
Throws:
OWLException - thrown if OWLOntology cannot be opened

openOntologyLogical

public OWLOntology openOntologyLogical(URI logicalURI)
                                throws OWLException
Deprecated.  

Opens an OWLOntology with given logical URI. Can only return an ontology that is already physically opened.

Specified by:
openOntologyLogical in interface OWLConnection
Parameters:
logicalURI - the logical URI of the OWLOntology
Returns:
the OWLOntology
Throws:
OWLException - thrown if OWLOntology cannot be opened

createOWLOntology

public OWLOntology createOWLOntology(URI physicalURI,
                                     URI logicalURI)
                              throws OWLException
Deprecated. Use createOntology instead.

Creates an OWLOntology with given physical and logical URIs. Use createOntology instead.

Specified by:
createOWLOntology in interface OWLConnection
Parameters:
physicalURI - the physical URI of the OWLOntology
logicalURI - the logical URI of the OWLOntology
Returns:
the OWLOntology
Throws:
OWLException - thrown if OWLOntology cannot be opened

notifyOntologyDeleted

public void notifyOntologyDeleted(OWLOntology onto)
                           throws OWLException
Notifies the connection that the OWLOntology has been deleted.

Specified by:
notifyOntologyDeleted in interface OWLConnection
Throws:
OWLException - thrown if there is an error

getOpenOWLOntologies

public Set getOpenOWLOntologies()
Returns the set of all open OWLOntology objects.

Specified by:
getOpenOWLOntologies in interface OWLConnection
Returns:
the set of all open OWLOntology objects

getAllOntologies

public Set getAllOntologies()
Returns the set of OI-models available at the node represented by this KAON connection.

Specified by:
getAllOntologies in interface OWLConnection
Returns:
the set of OIModel objects represented by this KAON connection

getAllLogicalURIs

public Set getAllLogicalURIs()
Returns the set of logical URIs of all OI-models available at the node represented by this KAON connection.

Specified by:
getAllLogicalURIs in interface OWLConnection
Returns:
the set of OIModel objects represented by this KAON connection

applyChanges

public void applyChanges(List changes)
                  throws OWLException
Deprecated.  

Applies the list of changes to the models in this connection.

Specified by:
applyChanges in interface OWLConnection
Parameters:
changes - list of changes to the models in the connection
Throws:
OWLException - thrown if there is an error

getChangeVisitor

public ChangeVisitor getChangeVisitor(OWLOntology o)
                               throws OWLException
Given an ontology, returns a change visitor that will enact changes over that ontology. May throw an exception if unable to provide such an implementation.

Specified by:
getChangeVisitor in interface OWLConnection
OWLException

changeOntologyLogicalURI

public void changeOntologyLogicalURI(OWLOntology o,
                                     URI uri)
                              throws OWLException
OWLException

createOntology

public OWLOntology createOntology(URI physicalURI,
                                  URI logicalURI)
                           throws OWLException
Description copied from interface: OWLConnection
Creates an OWLOntology with a given physical and logical URI.

Specified by:
createOntology in interface OWLConnection
Parameters:
physicalURI - the physical URI of the OWLOntology
logicalURI - the logical URI of the OWLOntology
OWLException
See Also:
OWLConnection.createOntology(URI, URI)

getOntologyLogical

public OWLOntology getOntologyLogical(URI logicalURI)
                               throws OWLException
Description copied from interface: OWLConnection
Returns an OWLOntology with given logical URI. The logical URI is the default namespace of an ontology and also used to locate an ontology, e.g. in a database of ontologies

Specified by:
getOntologyLogical in interface OWLConnection
Parameters:
logicalURI - the logical URI of the OWLOntology
OWLException
See Also:
OWLConnection.getOntologyLogical(URI)

getOntologyPhysical

public OWLOntology getOntologyPhysical(URI physicalURI)
                                throws OWLException
Specified by:
getOntologyPhysical in interface OWLConnection
Returns:
Ontology with the given phyiscal URI. Will try to load the ontology, if the ontology has not been opened.
OWLException
See Also:
OWLConnection.getOntologyPhysical(URI)

loadOntologyPhysical

public OWLOntology loadOntologyPhysical(URI physicalURI)
                                 throws OWLException
Description copied from interface: OWLConnection
Loads an OWLOntology with given physical URI (in fact an URL), somewhere on the web or in the file system. In order to learn how to open a local file, just try to open a file with your favorite web browser. On Windows machines the syntax follows the pattern: file:///drive:/directory/file

Specified by:
loadOntologyPhysical in interface OWLConnection
Parameters:
physicalURI - the physical URI of the OWLOntology
OWLException
See Also:
OWLConnection.loadOntologyPhysical(URI)

reloadOntologyPhysical

public OWLOntology reloadOntologyPhysical(URI physicalURI)
                                   throws OWLException
Description copied from interface: OWLConnection
Reloads an OWLOntology with given physical URI (in fact an URL), somewhere on the web or in the file system. Will not safe any changes to the ontology before the reload occurs. In order to learn how to open a local file, just try to open a file with your favorite web browser. On Windows machines the syntax follows the pattern: file:///drive:/directory/file

Specified by:
reloadOntologyPhysical in interface OWLConnection
Parameters:
physicalURI - the physical URI of the OWLOntology
OWLException
See Also:
OWLConnection.reloadOntologyPhysical(URI)


WonderWeb