Class OwlapiConnection
- All Implemented Interfaces:
Connection,Wrapper,AutoCloseable
Connection interface for OWLAPI driver.-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidcommit()Commits this connection.voidGets handler for RDF containers.booleanChecks whether the storage contains the specified axiom.Creates a new SPARQL statement.voidCollection<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.booleanReturns this connection's auto-commit mode.booleanisConsistent(URI context) Verifies consistency of ontology context with the specified URIbooleanisInferred(Axiom<?> axiom, Set<URI> contexts) Checks whether the specified axiom is inferred in the underlying repository.booleanisOpen()Whether this connection is active.lists()Gets ontology lists handler.voidpersist(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.voidremove(AxiomDescriptor descriptor) Removes all axioms related to subject specified by the descriptor.voidrollback()Rolls back any changes made in the current transaction.voidsetAutoCommit(boolean autoCommit) Sets this connection's auto-commit mode to the specified state.types()Gets types handler.<T> TReturns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy.voidupdate(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:ConnectionWhether this connection is active.- Specified by:
isOpenin interfaceConnection- Returns:
- Active status of this connection
-
commit
public void commit()Description copied from interface:ConnectionCommits 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:
commitin interfaceConnection
-
ensureOpen
public void ensureOpen() -
rollback
public void rollback()Description copied from interface:ConnectionRolls back any changes made in the current transaction.If this connection is in auto-commit mode, calling this method has no effect.
- Specified by:
rollbackin interfaceConnection
-
setAutoCommit
public void setAutoCommit(boolean autoCommit) Description copied from interface:ConnectionSets this connection's auto-commit mode to the specified state.- Specified by:
setAutoCommitin interfaceConnection- Parameters:
autoCommit- The new auto-commit state
-
isAutoCommit
public boolean isAutoCommit()Description copied from interface:ConnectionReturns this connection's auto-commit mode.- Specified by:
isAutoCommitin interfaceConnection- Returns:
trueif this connection is in auto-commit mode,falseotherwise
-
createStatement
Description copied from interface:ConnectionCreates a new SPARQL statement.- Specified by:
createStatementin interfaceConnection- Returns:
- a
Statementinstance
-
prepareStatement
Description copied from interface:ConnectionCreates and returns a new prepared SPARQL statement.- Specified by:
prepareStatementin interfaceConnection- Parameters:
sparql- The query to prepare- Returns:
PreparedStatement
-
isConsistent
Description copied from interface:ConnectionVerifies consistency of ontology context with the specified URINote that
nullargument means checking consistency of the whole repository.- Specified by:
isConsistentin interfaceConnection- Parameters:
context- Context identifier, can benull- Returns:
- Consistency status
-
getContexts
Description copied from interface:ConnectionGets a set of currently available contexts in the underlying repository.Note that the default context is not included in the result.
- Specified by:
getContextsin interfaceConnection- Returns:
- List of context URIs
-
contains
Description copied from interface:ConnectionChecks whether the storage contains the specified axiom.The contexts optionally specify repository contexts in which to look for the axiom.
- Specified by:
containsin interfaceConnection- Parameters:
axiom- The axiom to look forcontexts- Optional search contexts, an empty set means to look in the default storage context- Returns:
trueif the storage contains matching axiom,falseotherwise
-
isInferred
Description copied from interface:ConnectionChecks 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
falsein case the repository contains the axiom both inferred and asserted.- Specified by:
isInferredin interfaceConnection- Parameters:
axiom- Axiom whose inference to checkcontexts- Optional search contexts, an empty set means to look in the default storage context- Returns:
trueif the repository inferred the specified axiom,falseif the axiom is asserted or not present at all
-
find
Description copied from interface:ConnectionFinds axioms with the corresponding subject and properties.- Specified by:
findin 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:ConnectionPersists new individual and its property values specified by the descriptor.- Specified by:
persistin interfaceConnection- Parameters:
descriptor- Descriptor of the persisted values- Throws:
OntoDriverException- If an ontology access error occurs
-
generateIdentifier
Description copied from interface:ConnectionGenerates a new unique identifier based on the specified type.The identifier is required to be unique in the whole repository.
- Specified by:
generateIdentifierin interfaceConnection- Parameters:
classUri- OWL class identifier- Returns:
- Unique identifier
-
update
Description copied from interface:ConnectionPersists 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:
updatein interfaceConnection- Parameters:
descriptor- Descriptor of the update values- Throws:
OntoDriverException- If an ontology access error occurs
-
remove
Description copied from interface:ConnectionRemoves 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
NamedResourcespecified by the argument stands as value.- Specified by:
removein interfaceConnection- Parameters:
descriptor- Descriptor of contexts and the subject of removal- Throws:
OntoDriverException- If an ontology access error occurs
-
lists
Description copied from interface:ConnectionGets ontology lists handler.- Specified by:
listsin interfaceConnection- Returns:
- Lists handler
-
types
Description copied from interface:ConnectionGets types handler.- Specified by:
typesin interfaceConnection- Returns:
- Types handler
-
properties
Description copied from interface:ConnectionGets handler for unmapped properties.- Specified by:
propertiesin interfaceConnection- Returns:
- Properties handler
-
containers
Description copied from interface:ConnectionGets handler for RDF containers.- Specified by:
containersin interfaceConnection- Returns:
- Containers handler
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
commitIfAuto
public void commitIfAuto() -
unwrap
Description copied from interface:WrapperReturns 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 anOntoDriverExceptionis thrown.- Specified by:
unwrapin 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
-