Class AbstractNotifyingSailConnection
java.lang.Object
org.eclipse.rdf4j.sail.helpers.AbstractSailConnection
org.eclipse.rdf4j.sail.helpers.AbstractNotifyingSailConnection
- All Implemented Interfaces:
AutoCloseable, NotifyingSailConnection, SailConnection
- Direct Known Subclasses:
SailSourceConnection
public abstract class AbstractNotifyingSailConnection
extends AbstractSailConnection
implements NotifyingSailConnection
Abstract Class offering base functionality for SailConnection implementations.
- Author:
- Arjohn Kampman, Jeen Broekstra
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConnectionListener(SailConnectionListener listener) Registers a SailConnection listener with this SailConnection.protected booleanprotected voidDeprecated, for removal: This API element is subject to removal in a future version.protected voidnotifyStatementAdded(Statement st, boolean inferred) protected voidDeprecated, for removal: This API element is subject to removal in a future version.protected voidnotifyStatementRemoved(Statement st, boolean inferred) voidDeregisters a SailConnection listener with this SailConnection.Methods inherited from class AbstractSailConnection
addStatement, addStatement, addStatementInternal, autoStartTransaction, begin, begin, bulkAddStatementsInternal, clear, clearInternal, clearNamespaces, clearNamespacesInternal, close, closeInternal, commit, commitInternal, endUpdate, endUpdateInternal, evaluate, evaluateInternal, flush, getContextIDs, getContextIDsInternal, getNamespace, getNamespaceInternal, getNamespaces, getNamespacesInternal, getOwner, getSailBase, getStatements, getStatements, getStatementsInternal, getStatementsInternal, getTransactionIsolation, hasActiveIterations, hasStatement, hasStatementInternal, isActive, isActiveOperation, isOpen, iterationClosed, pendingAdds, prepare, prepareInternal, recordDataImportMetricsStatementsAdded, registerIteration, removeNamespace, removeNamespaceInternal, removeStatement, removeStatements, removeStatementsInternal, rollback, rollbackInternal, setNamespace, setNamespaceInternal, setStatementsAdded, setStatementsRemoved, setTransactionSettings, size, sizeInternal, startTransactionInternal, startUpdate, transactionActive, verifyIsActive, verifyIsOpen, waitForOtherOperationsModifier and TypeMethodDescriptionfinal voidaddStatement(Resource subj, IRI pred, Value obj, Resource... contexts) Adds a statement to the store.voidaddStatement(UpdateContext op, Resource subj, IRI pred, Value obj, Resource... contexts) The default implementation buffers added statements until the update operation is complete.protected abstract voidaddStatementInternal(Resource subj, IRI pred, Value obj, Resource... contexts) protected voidDeprecated.voidbegin()Begins a transaction requiringSailConnection.commit()orSailConnection.rollback()to be called to close the transaction.voidbegin(IsolationLevel isolationLevel) Begins a transaction with the specifiedIsolationLevellevel, requiringSailConnection.commit()orSailConnection.rollback()to be called to close the transaction.protected voidbulkAddStatementsInternal(Collection<? extends Statement> statements) final voidRemoves all statements from the specified/all contexts.protected abstract voidclearInternal(Resource... contexts) final voidRemoves all namespace declarations from the repository.protected abstract voidfinal voidclose()Closes the connection.protected abstract voidfinal voidcommit()Commits any updates that have been performed since the last timeSailConnection.commit()orSailConnection.rollback()was called.protected abstract voidfinal voidIndicates that the givenopwill not be used in any call again.protected voidfinal CloseableIteration<? extends BindingSet> evaluate(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings, boolean includeInferred) Evaluates the supplied TupleExpr on the data contained in this Sail object, using the (optional) dataset and supplied bindings as input parameters.protected abstract CloseableIteration<? extends BindingSet> evaluateInternal(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings, boolean includeInferred) voidflush()Flushes any pending updates and notify changes to listeners as appropriate.final CloseableIteration<? extends Resource> Returns the set of all unique context identifiers that are used to store statements.protected abstract CloseableIteration<? extends Resource> final StringgetNamespace(String prefix) Gets the namespace that is associated with the specified prefix, if any.protected abstract StringgetNamespaceInternal(String prefix) final CloseableIteration<? extends Namespace> Gets the namespaces relevant to the data contained in this Sail object.protected abstract CloseableIteration<? extends Namespace> getOwner()This is for internal use only.protected AbstractSailfinal CloseableIteration<? extends Statement> getStatements(StatementOrder order, Resource subj, IRI pred, Value obj, boolean includeInferred, Resource... contexts) Gets all statements from the specified contexts that have a specific subject, predicate and/or object.final CloseableIteration<? extends Statement> getStatements(Resource subj, IRI pred, Value obj, boolean includeInferred, Resource... contexts) Gets all statements from the specified contexts that have a specific subject, predicate and/or object.protected CloseableIteration<? extends Statement> getStatementsInternal(StatementOrder order, Resource subj, IRI pred, Value obj, boolean includeInferred, Resource... contexts) protected abstract CloseableIteration<? extends Statement> getStatementsInternal(Resource subj, IRI pred, Value obj, boolean includeInferred, Resource... contexts) protected IsolationLevelRetrieve the currently setIsolationLevel.booleanfinal booleanhasStatement(Resource subj, IRI pred, Value obj, boolean includeInferred, Resource... contexts) Determines if the store contains any statements from the specified contexts that have a specific subject, predicate and/or object.protected booleanhasStatementInternal(Resource subj, IRI pred, Value obj, boolean includeInferred, Resource[] contexts) booleanisActive()Indicates if a transaction is currently active on the connection.protected booleanfinal booleanisOpen()Checks whether this SailConnection is open.protected voiditerationClosed(org.eclipse.rdf4j.sail.helpers.SailBaseIteration<?, ?> iter) Called bySailBaseIterationto indicate that it has been closed.protected booleanfinal voidprepare()Checks for an error state in the active transaction that would force the transaction to be rolled back.protected voidprotected final voidrecordDataImportMetricsStatementsAdded(Resource... contexts) protected <T, E extends Exception>
CloseableIteration<T> registerIteration(CloseableIteration<T> iter) Registers an iteration as active by wrapping it in aSailBaseIterationobject and adding it to the list of active iterations.final voidremoveNamespace(String prefix) Removes a namespace declaration by removing the association between a prefix and a namespace name.protected abstract voidremoveNamespaceInternal(String prefix) voidremoveStatement(UpdateContext op, Resource subj, IRI pred, Value obj, Resource... contexts) The default implementation buffers removed statements until the update operation is complete.final voidremoveStatements(Resource subj, IRI pred, Value obj, Resource... contexts) Removes all statements matching the specified subject, predicate and object from the repository.protected abstract voidremoveStatementsInternal(Resource subj, IRI pred, Value obj, Resource... contexts) final voidrollback()Rolls back the transaction, discarding any uncommitted changes that have been made in this SailConnection.protected abstract voidfinal voidsetNamespace(String prefix, String name) Sets the prefix for a namespace.protected abstract voidsetNamespaceInternal(String prefix, String name) protected voidprotected voidvoidsetTransactionSettings(TransactionSetting... settings) Pass any transaction-specific settings to the SailConnection.final longReturns the number of (explicit) statements in the store, or in specific contexts.protected abstract longsizeInternal(Resource... contexts) protected abstract voidvoidSignals the start of an update operation.protected final booleanprotected voidVerifies if a transaction is currently active.protected voidvoidwaitForOtherOperations(boolean interrupt) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface SailConnection
explain, getComparator, getSupportedOrders, prepareQueryModifier and TypeMethodDescriptiondefault Explanationexplain(Explanation.Level level, TupleExpr tupleExpr, Dataset dataset, BindingSet bindings, boolean includeInferred, int timeoutSeconds) Explain how the TupleExpr will be (or has been) executed/evaluated by returning a TupleExpr (which may or may not be the provided TupleExpr) that has gone through zero or more of the stages prior to and also including execution as specified by the provided level.default Comparator<Value> Different underlying datastructures may have different ways of ordering statements.default Set<StatementOrder> getSupportedOrders(Resource subj, IRI pred, Value obj, Resource... contexts) The underlying store may support some, but not all, statement orders based on the statement pattern.prepareQuery(QueryLanguage ql, Query.QueryType type, String query, String baseURI) Allows the SailConnection to bypass the standard query parser and provide its own internalTupleExprimplementation.
-
Constructor Details
-
AbstractNotifyingSailConnection
-
-
Method Details
-
addConnectionListener
Description copied from interface:NotifyingSailConnectionRegisters a SailConnection listener with this SailConnection. The listener should be notified of any statements that are added or removed as part of this SailConnection.- Specified by:
addConnectionListenerin interfaceNotifyingSailConnection- Parameters:
listener- A SailConnectionListener.
-
removeConnectionListener
Description copied from interface:NotifyingSailConnectionDeregisters a SailConnection listener with this SailConnection.- Specified by:
removeConnectionListenerin interfaceNotifyingSailConnection- Parameters:
listener- A SailConnectionListener.
-
hasConnectionListeners
protected boolean hasConnectionListeners() -
notifyStatementAdded
Deprecated, for removal: This API element is subject to removal in a future version. -
notifyStatementAdded
-
notifyStatementRemoved
Deprecated, for removal: This API element is subject to removal in a future version. -
notifyStatementRemoved
-
AbstractSailConnection.verifyIsActive()instead.