org.semanticweb.owl.util
Class OWLManager

java.lang.Object
  |
  +--org.semanticweb.owl.util.OWLManager

public class OWLManager
extends Object

A manager for factories of OWL Ontologies. This is the central class for getting access to OWLOntology implementations and thereby to OWLOntologies.


Field Summary
static int CAPABILITY_ALWAYS_SAVED
          Capability specifying that model is always saved.
static int CAPABILITY_SUPPORTS_NOTIFICATIONS
          Capability specifying that model supports notifications.
static int CAPABILITY_SUPPORTS_OPTIMIZED_LOADING
          Capability specifying that model supports optimized loading.
static String OWL_CONNECTION
          Parameter specifying the OI-model connection class.
protected static Class[] OWL_CONNECTION_PARAMETERS
          Type specifier for our constructors.
protected static List s_logicalURIResolvers
          The list of registered logical URI resolvers.
static Map s_parametersAPIOnRDF
          The parameters for the RDF connections.
protected static Map s_physicalURIToDefaultParametersResolvers
          The map of registered physical URI resolvers.
 
Constructor Summary
OWLManager()
           
 
Method Summary
static boolean canUseConnectionForParameters(OWLConnection connection, Map parameters)
          Checks if supplied connection can be used for opening a model with given parameters.
static Map getDefaultParametersForPhysicalURI(String physicalURI, Map contextParameters)
          Returns the default parameters for given physical URI.
static OWLConnection getOWLConnection()
          Returns a default implementation of connection which is determined at run time by the following methods: 1.
static OWLConnection getOWLConnection(Map parameters)
          Returns a factory to use for given parameters.
static void registerLogicalURIResolver(LogicalURIResolver resolver)
          Registers a logical URI resolver.
static void registerPhysicalURIToDefaultParametersResolver(PhysicalURIToDefaultParametersResolver resolver)
          Registers a resolver from physical URI to default parameters.
static void registerPhysicalURIToDefaultParametersResolver(String resolverClassName)
          Registers a resolver from physical URI to default parameters by its class name.
static void registerWellKnownRDFOntology(URI wellKnownOIModelPhysicalURI)
          Reegisters a well-known RDF OI-model.
protected static void registerWellKnownRDFOntologyEx(URI wellKnownOIModelPhysicalURI)
          A private version of the method that ignores the exception.
static OWLOntology resolveLogicalURI(OWLConnection OWLConnection, URI logicalURI)
          Tries to resolve a logical URI for the connection.
static void startOWLImplementation(String connectionClassName)
          Starts the OWL API implementation with given name.
static void unregisterLogicalURIResolver(LogicalURIResolver resolver)
          Unregisters a logical URI resolver.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CAPABILITY_ALWAYS_SAVED

public static final int CAPABILITY_ALWAYS_SAVED
Capability specifying that model is always saved.

See Also:
Constant Field Values

CAPABILITY_SUPPORTS_OPTIMIZED_LOADING

public static final int CAPABILITY_SUPPORTS_OPTIMIZED_LOADING
Capability specifying that model supports optimized loading.

See Also:
Constant Field Values

CAPABILITY_SUPPORTS_NOTIFICATIONS

public static final int CAPABILITY_SUPPORTS_NOTIFICATIONS
Capability specifying that model supports notifications.

See Also:
Constant Field Values

OWL_CONNECTION

public static final String OWL_CONNECTION
Parameter specifying the OI-model connection class.

See Also:
Constant Field Values

OWL_CONNECTION_PARAMETERS

protected static final Class[] OWL_CONNECTION_PARAMETERS
Type specifier for our constructors.


s_parametersAPIOnRDF

public static final Map s_parametersAPIOnRDF
The parameters for the RDF connections.


s_physicalURIToDefaultParametersResolvers

protected static final Map s_physicalURIToDefaultParametersResolvers
The map of registered physical URI resolvers.


s_logicalURIResolvers

protected static final List s_logicalURIResolvers
The list of registered logical URI resolvers.

Constructor Detail

OWLManager

public OWLManager()
Method Detail

startOWLImplementation

public static void startOWLImplementation(String connectionClassName)
                                   throws OWLException
Starts the OWL API implementation with given name.

Parameters:
connectionClassName - the name of the KAON Connection class
Throws:
OWLException - thrown if the implementation cannot be started

getOWLConnection

public static OWLConnection getOWLConnection(Map parameters)
                                      throws OWLException
Returns a factory to use for given parameters.

Parameters:
parameters - parameters specifying the class
Returns:
the KAON connection for given parameters
Throws:
OWLException - thrown if parameters are incorrect

getOWLConnection

public static OWLConnection getOWLConnection()
                                      throws OWLException
Returns a default implementation of connection which is determined at run time by the following methods: 1. If System Property org.semanticweb.owl.util.OWLConnection is set, this determines the class to use 2. If not, search the resource paths for the key org.semanticweb.owl.util.OWLConnection in META-INF/services. 2.1 If the resource is found, the file is read and the class is instantiated. 2.2 If an exception is thrown while reading the file then the class is instantiated to org.semanticweb.owl.impl.model.OWLConnectionImpl.

OWLException

getDefaultParametersForPhysicalURI

public static Map getDefaultParametersForPhysicalURI(String physicalURI,
                                                     Map contextParameters)
                                              throws OWLException
Returns the default parameters for given physical URI. This method is useful for opening models from any URI. If default parameters cannot be created, an exception is thrown.

Parameters:
physicalURI - the physical URI
contextParameters - the parameters that are used for missing elements (may be null)
Returns:
the default parameters for accessing given physical URI (never null)
Throws:
OWLException - thrown if givan physical URI cannot be accessed

registerPhysicalURIToDefaultParametersResolver

public static void registerPhysicalURIToDefaultParametersResolver(PhysicalURIToDefaultParametersResolver resolver)
Registers a resolver from physical URI to default parameters. Only one resolver of each class can be registered.

Parameters:
resolver - the resolver

registerPhysicalURIToDefaultParametersResolver

public static void registerPhysicalURIToDefaultParametersResolver(String resolverClassName)
                                                           throws OWLException
Registers a resolver from physical URI to default parameters by its class name.

Parameters:
resolverClassName - the name of the resolver class
Throws:
OWLException - thrown if resolver cannot be registered

resolveLogicalURI

public static OWLOntology resolveLogicalURI(OWLConnection OWLConnection,
                                            URI logicalURI)
                                     throws OWLException
Tries to resolve a logical URI for the connection. This method is called when a connection is unable to obtain a model with given logical URI. It then tries to resolve the logical URI to parameters and the physical URI. If model cannot be opened through the same connection, then model is replicated.

Parameters:
OWLConnection - the connection
logicalURI - the logical URI
Returns:
the OI-model (null if logical URI cannot be resolved)
Throws:
OWLException - thrown if there is an error

registerLogicalURIResolver

public static void registerLogicalURIResolver(LogicalURIResolver resolver)
Registers a logical URI resolver.

Parameters:
resolver - the resolver

unregisterLogicalURIResolver

public static void unregisterLogicalURIResolver(LogicalURIResolver resolver)
Unregisters a logical URI resolver.

Parameters:
resolver - the resolver

registerWellKnownRDFOntology

public static void registerWellKnownRDFOntology(URI wellKnownOIModelPhysicalURI)
                                         throws OWLException
Reegisters a well-known RDF OI-model.

Parameters:
wellKnownOIModelPhysicalURI - the physical URI of the well-known model
Throws:
OWLException - thrown if there is an error

canUseConnectionForParameters

public static boolean canUseConnectionForParameters(OWLConnection connection,
                                                    Map parameters)
Checks if supplied connection can be used for opening a model with given parameters.

Parameters:
connection - the connection that is checked if it can be reused
parameters - the parameters that are checked
Returns:
true if the supplied connection can be reused for given parameters

registerWellKnownRDFOntologyEx

protected static void registerWellKnownRDFOntologyEx(URI wellKnownOIModelPhysicalURI)
A private version of the method that ignores the exception.

Parameters:
wellKnownOIModelPhysicalURI - the physical URI of the well-known model


WonderWeb