Class OwlapiConnection
- All Implemented Interfaces:
Connection
,Wrapper
,AutoCloseable
Connection
interface for OWLAPI driver.-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
commit()
Commits this connection.void
Gets handler for RDF containers.boolean
Checks whether the storage contains the specified axiom.Creates a new SPARQL statement.void
Collection<Axiom<?>>
find
(AxiomDescriptor descriptor) Finds axioms with the corresponding subject and properties.generateIdentifier
(URI classUri) Generates a new unique identifier based on the specified type.Gets a set of currently available contexts in the underlying repository.boolean
Returns this connection's auto-commit mode.boolean
isConsistent
(URI context) Verifies consistency of ontology context with the specified URIboolean
isInferred
(Axiom<?> axiom, Set<URI> contexts) Checks whether the specified axiom is inferred in the underlying repository.boolean
isOpen()
Whether this connection is active.lists()
Gets ontology lists handler.void
persist
(AxiomValueDescriptor descriptor) Persists new individual and its property values specified by the descriptor.prepareStatement
(String sparql) Creates and returns a new prepared SPARQL statement.Gets handler for unmapped properties.void
remove
(AxiomDescriptor descriptor) Removes all axioms related to subject specified by the descriptor.void
rollback()
Rolls back any changes made in the current transaction.void
setAutoCommit
(boolean autoCommit) Sets this connection's auto-commit mode to the specified state.types()
Gets types handler.<T> T
Returns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy.void
update
(AxiomValueDescriptor descriptor) Persists the values specified by this descriptor, removing existing property values from the ontology.
-
Method Details
-
isOpen
public boolean isOpen()Description copied from interface:Connection
Whether this connection is active.- Specified by:
isOpen
in interfaceConnection
- Returns:
- Active status of this connection
-
commit
public void commit()Description copied from interface:Connection
Commits this connection.This effectively makes persistent any changes made since the last commit/rollback or since this connection was opened.
If this connection is in auto-commit mode, calling this method has no effect.
- Specified by:
commit
in interfaceConnection
-
ensureOpen
public void ensureOpen() -
rollback
public void rollback()Description copied from interface:Connection
Rolls back any changes made in the current transaction.If this connection is in auto-commit mode, calling this method has no effect.
- Specified by:
rollback
in interfaceConnection
-
setAutoCommit
public void setAutoCommit(boolean autoCommit) Description copied from interface:Connection
Sets this connection's auto-commit mode to the specified state.- Specified by:
setAutoCommit
in interfaceConnection
- Parameters:
autoCommit
- The new auto-commit state
-
isAutoCommit
public boolean isAutoCommit()Description copied from interface:Connection
Returns this connection's auto-commit mode.- Specified by:
isAutoCommit
in interfaceConnection
- Returns:
true
if this connection is in auto-commit mode,false
otherwise
-
createStatement
Description copied from interface:Connection
Creates a new SPARQL statement.- Specified by:
createStatement
in interfaceConnection
- Returns:
- a
Statement
instance
-
prepareStatement
Description copied from interface:Connection
Creates and returns a new prepared SPARQL statement.- Specified by:
prepareStatement
in interfaceConnection
- Parameters:
sparql
- The query to prepare- Returns:
PreparedStatement
-
isConsistent
Description copied from interface:Connection
Verifies consistency of ontology context with the specified URINote that
null
argument means checking consistency of the whole repository.- Specified by:
isConsistent
in interfaceConnection
- Parameters:
context
- Context identifier, can benull
- Returns:
- Consistency status
-
getContexts
Description copied from interface:Connection
Gets a set of currently available contexts in the underlying repository.Note that the default context is not included in the result.
- Specified by:
getContexts
in interfaceConnection
- Returns:
- List of context URIs
-
contains
Description copied from interface:Connection
Checks whether the storage contains the specified axiom.The contexts optionally specify repository contexts in which to look for the axiom.
- Specified by:
contains
in interfaceConnection
- Parameters:
axiom
- The axiom to look forcontexts
- Optional search contexts, an empty set means to look in the default storage context- Returns:
true
if the storage contains matching axiom,false
otherwise
-
isInferred
Description copied from interface:Connection
Checks whether the specified axiom is inferred in the underlying repository.The contexts optionally specify repository contexts in which to look for the axiom. However, note that different triple stores treat inference differently and inferred statements may be stored in a special context. In this case, the implementation may choose to ignore the provided set of contexts.
Also note that since most underlying repository access implementations do not allow retrieving inferred statements only and instead provide either only asserted or asserted + inferred statements, this method may return
false
in case the repository contains the axiom both inferred and asserted.- Specified by:
isInferred
in interfaceConnection
- Parameters:
axiom
- Axiom whose inference to checkcontexts
- Optional search contexts, an empty set means to look in the default storage context- Returns:
true
if the repository inferred the specified axiom,false
if the axiom is asserted or not present at all
-
find
Description copied from interface:Connection
Finds axioms with the corresponding subject and properties.- Specified by:
find
in interfaceConnection
- Parameters:
descriptor
- Loading descriptor specifies subject, properties to load and possible contexts to work with- Returns:
- Collection of axioms matching the specified criteria
- Throws:
OntoDriverException
- If an ontology access error occurs
-
persist
Description copied from interface:Connection
Persists new individual and its property values specified by the descriptor.- Specified by:
persist
in interfaceConnection
- Parameters:
descriptor
- Descriptor of the persisted values- Throws:
OntoDriverException
- If an ontology access error occurs
-
generateIdentifier
Description copied from interface:Connection
Generates a new unique identifier based on the specified type.The identifier is required to be unique in the whole repository.
- Specified by:
generateIdentifier
in interfaceConnection
- Parameters:
classUri
- OWL class identifier- Returns:
- Unique identifier
-
update
Description copied from interface:Connection
Persists the values specified by this descriptor, removing existing property values from the ontology.This method removes original values of properties specified in the descriptor and persists new values specified therein.
- Specified by:
update
in interfaceConnection
- Parameters:
descriptor
- Descriptor of the update values- Throws:
OntoDriverException
- If an ontology access error occurs
-
remove
Description copied from interface:Connection
Removes all axioms related to subject specified by the descriptor.The descriptor may also specify contexts from which property assertion axioms should be removed.
Note that this method will cause also removal of axioms in which the
NamedResource
specified by the argument stands as value.- Specified by:
remove
in interfaceConnection
- Parameters:
descriptor
- Descriptor of contexts and the subject of removal- Throws:
OntoDriverException
- If an ontology access error occurs
-
lists
Description copied from interface:Connection
Gets ontology lists handler.- Specified by:
lists
in interfaceConnection
- Returns:
- Lists handler
-
types
Description copied from interface:Connection
Gets types handler.- Specified by:
types
in interfaceConnection
- Returns:
- Types handler
-
properties
Description copied from interface:Connection
Gets handler for unmapped properties.- Specified by:
properties
in interfaceConnection
- Returns:
- Properties handler
-
containers
Description copied from interface:Connection
Gets handler for RDF containers.- Specified by:
containers
in interfaceConnection
- Returns:
- Containers handler
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
commitIfAuto
public void commitIfAuto() -
unwrap
Description copied from interface:Wrapper
Returns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy. If the receiver implements the interface then the result is the receiver or a proxy for the receiver. If the receiver is a wrapper and the wrapped object implements the interface then the result is the wrapped object or a proxy for the wrapped object. Otherwise return the the result of calling unwrap recursively on the wrapped object or a proxy for that result. If the receiver is not a wrapper and does not implement the interface, then anOntoDriverException
is thrown.- Specified by:
unwrap
in interfaceWrapper
- Type Parameters:
T
- The type of the class modeled by this Class object- Parameters:
cls
- The type of the required result- Returns:
- An object implementing the interface
- Throws:
OntoDriverException
- If no matching object is found
-