Interface Connection
- All Superinterfaces:
AutoCloseable
,Wrapper
- All Known Implementing Classes:
JenaConnection
,OwlapiConnection
,Rdf4jConnection
-
Method Summary
Modifier and TypeMethodDescriptionvoid
commit()
Commits this connection.Gets handler for RDF containers.boolean
Checks whether the storage contains the specified axiom.Creates a new SPARQL statement.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.void
update
(AxiomValueDescriptor descriptor) Persists the values specified by this descriptor, removing existing property values from the ontology.Methods inherited from interface java.lang.AutoCloseable
close
-
Method Details
-
isOpen
boolean isOpen()Whether this connection is active.- Returns:
- Active status of this connection
-
commit
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.
- Throws:
OntoDriverException
- If an ontology access error occursIllegalStateException
- If called on a closed connection
-
rollback
Rolls back any changes made in the current transaction.If this connection is in auto-commit mode, calling this method has no effect.
- Throws:
OntoDriverException
- If an ontology access error occursIllegalStateException
- If called on a closed connection
-
setAutoCommit
void setAutoCommit(boolean autoCommit) Sets this connection's auto-commit mode to the specified state.- Parameters:
autoCommit
- The new auto-commit state- Throws:
IllegalStateException
- If called on a closed connection
-
isAutoCommit
boolean isAutoCommit()Returns this connection's auto-commit mode.- Returns:
true
if this connection is in auto-commit mode,false
otherwise- Throws:
IllegalStateException
- If called on a closed connection
-
createStatement
Creates a new SPARQL statement.- Returns:
- a
Statement
instance - Throws:
OntoDriverException
- If an ontology access error occursIllegalStateException
- If called on a closed connection
-
prepareStatement
Creates and returns a new prepared SPARQL statement.- Parameters:
sparql
- The query to prepare- Returns:
PreparedStatement
- Throws:
OntoDriverException
- If an ontology access error occursIllegalStateException
- If called on a closed connection
-
isConsistent
Verifies consistency of ontology context with the specified URINote that
null
argument means checking consistency of the whole repository.- Parameters:
context
- Context identifier, can benull
- Returns:
- Consistency status
- Throws:
OntoDriverException
- If an ontology access error occursIllegalStateException
- If called on a closed connection
-
getContexts
Gets a set of currently available contexts in the underlying repository.Note that the default context is not included in the result.
- Returns:
- List of context URIs
- Throws:
OntoDriverException
- If an ontology access error occursIllegalStateException
- If called on a closed connection
-
contains
Checks whether the storage contains the specified axiom.The contexts optionally specify repository contexts in which to look for the axiom.
- 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- Throws:
OntoDriverException
- If an ontology access error occursIllegalStateException
- If called on a closed connection
-
isInferred
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.- 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- Throws:
OntoDriverException
- If an ontology access error occursIllegalStateException
- If called on a closed connection
-
find
Finds axioms with the corresponding subject and properties.- 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 occursIllegalStateException
- If called on a closed connection
-
persist
Persists new individual and its property values specified by the descriptor.- Parameters:
descriptor
- Descriptor of the persisted values- Throws:
OntoDriverException
- If an ontology access error occursIllegalStateException
- If called on a closed connection
-
generateIdentifier
Generates a new unique identifier based on the specified type.The identifier is required to be unique in the whole repository.
- Parameters:
classUri
- OWL class identifier- Returns:
- Unique identifier
- Throws:
OntoDriverException
- If an ontology access error occurs
-
update
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.
- Parameters:
descriptor
- Descriptor of the update values- Throws:
OntoDriverException
- If an ontology access error occursIllegalStateException
- If called on a closed connection
-
remove
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.- Parameters:
descriptor
- Descriptor of contexts and the subject of removal- Throws:
OntoDriverException
- If an ontology access error occursIllegalStateException
- If called on a closed connection
-
lists
Lists lists()Gets ontology lists handler.- Returns:
- Lists handler
-
types
Types types()Gets types handler.- Returns:
- Types handler
-
properties
Properties properties()Gets handler for unmapped properties.- Returns:
- Properties handler
-
containers
Containers containers()Gets handler for RDF containers.- Returns:
- Containers handler
-