Class MemoryStoreConnection
java.lang.Object
org.eclipse.rdf4j.sail.helpers.AbstractSailConnection
org.eclipse.rdf4j.sail.helpers.AbstractNotifyingSailConnection
org.eclipse.rdf4j.sail.base.SailSourceConnection
org.eclipse.rdf4j.sail.memory.MemoryStoreConnection
- All Implemented Interfaces:
AutoCloseable, FederatedServiceResolverClient, ThreadSafetyAware, InferencerConnection, NotifyingSailConnection, SailConnection
Implementation of a Sail Connection for memory stores.
- Author:
- Arjohn Kampman, jeen
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddInferredStatement(Resource subj, IRI pred, Value obj, Resource... contexts) Adds an inferred statement to a specific context.protected voidaddStatementInternal(Resource subj, IRI pred, Value obj, Resource... contexts) voidclearInferred(Resource... contexts) Removes all inferred statements from the specified/all contexts.protected voidclearInternal(Resource... contexts) protected voidgetSail()booleanremoveInferredStatement(Resource subj, IRI pred, Value obj, Resource... contexts) Removes an inferred statement from a specific context.protected voidremoveStatementsInternal(Resource subj, IRI pred, Value obj, Resource... contexts) protected voidprotected voidbooleanA class may support concurrent reads from multiple threads against the same object.Methods inherited from class SailSourceConnection
addStatement, clearNamespacesInternal, closeInternal, endUpdateInternal, evaluateInternal, explain, flushUpdates, getComparator, getContextIDsInternal, getEvaluationStrategy, getFederatedServiceResolver, getNamespaceInternal, getNamespacesInternal, getStatementsInternal, getStatementsInternal, prepareInternal, removeNamespaceInternal, removeStatement, setFederatedServiceResolver, setNamespaceInternal, setTransactionSettings, sizeInternal, startUpdateModifier and TypeMethodDescriptionvoidaddStatement(UpdateContext op, Resource subj, IRI pred, Value obj, Resource... contexts) The default implementation buffers added statements until the update operation is complete.protected voidprotected voidprotected voidprotected CloseableIteration<? extends BindingSet> evaluateInternal(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings, boolean includeInferred) explain(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.voidFlushes any pending updates to be processed and the resulting changes to be reported to registeredSailConnectionListeners.Different underlying datastructures may have different ways of ordering statements.protected CloseableIteration<? extends Resource> protected EvaluationStrategygetEvaluationStrategy(Dataset dataset, TripleSource tripleSource) Returns theFederatedServiceResolverbeing used.protected StringgetNamespaceInternal(String prefix) protected CloseableIteration<? extends Namespace> protected CloseableIteration<? extends Statement> getStatementsInternal(StatementOrder order, Resource subj, IRI pred, Value obj, boolean includeInferred, Resource... contexts) protected CloseableIteration<? extends Statement> getStatementsInternal(Resource subj, IRI pred, Value obj, boolean includeInferred, Resource... contexts) protected voidprotected 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.voidSets theFederatedServiceResolverto use.protected voidsetNamespaceInternal(String prefix, String name) voidsetTransactionSettings(TransactionSetting... settings) Pass any transaction-specific settings to the SailConnection.protected longsizeInternal(Resource... contexts) voidSignals the start of an update operation.Methods inherited from class AbstractNotifyingSailConnection
addConnectionListener, hasConnectionListeners, notifyStatementAdded, notifyStatementAdded, notifyStatementRemoved, notifyStatementRemoved, removeConnectionListenerModifier 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, autoStartTransaction, begin, begin, bulkAddStatementsInternal, clear, clearNamespaces, close, commit, endUpdate, evaluate, flush, getContextIDs, getNamespace, getNamespaces, getOwner, getSailBase, getStatements, getStatements, getTransactionIsolation, hasActiveIterations, hasStatement, hasStatementInternal, isActive, isActiveOperation, isOpen, iterationClosed, pendingAdds, prepare, recordDataImportMetricsStatementsAdded, registerIteration, removeNamespace, removeStatements, rollback, setNamespace, setStatementsAdded, setStatementsRemoved, size, transactionActive, verifyIsActive, verifyIsOpen, waitForOtherOperationsModifier and TypeMethodDescriptionfinal voidaddStatement(Resource subj, IRI pred, Value obj, Resource... contexts) Adds a statement to the store.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.final voidRemoves all namespace declarations from the repository.final voidclose()Closes the connection.final voidcommit()Commits any updates that have been performed since the last timeSailConnection.commit()orSailConnection.rollback()was called.final voidIndicates that the givenopwill not be used in any call again.final 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.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.final StringgetNamespace(String prefix) Gets the namespace that is associated with the specified prefix, if any.final CloseableIteration<? extends Namespace> Gets the namespaces relevant to the data contained in this Sail object.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 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 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.final voidremoveStatements(Resource subj, IRI pred, Value obj, Resource... contexts) Removes all statements matching the specified subject, predicate and object from the repository.final voidrollback()Rolls back the transaction, discarding any uncommitted changes that have been made in this SailConnection.final voidsetNamespace(String prefix, String name) Sets the prefix for a namespace.protected voidprotected voidfinal longReturns the number of (explicit) statements in the store, or in specific contexts.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
getSupportedOrders, prepareQueryModifier and TypeMethodDescriptiondefault 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.
-
Field Details
-
sail
-
-
Constructor Details
-
MemoryStoreConnection
-
-
Method Details
-
startTransactionInternal
- Overrides:
startTransactionInternalin classSailSourceConnection- Throws:
SailException
-
commitInternal
- Overrides:
commitInternalin classSailSourceConnection- Throws:
SailException
-
rollbackInternal
- Overrides:
rollbackInternalin classSailSourceConnection- Throws:
SailException
-
addStatementInternal
protected void addStatementInternal(Resource subj, IRI pred, Value obj, Resource... contexts) throws SailException - Specified by:
addStatementInternalin classAbstractSailConnection- Throws:
SailException
-
addInferredStatement
public boolean addInferredStatement(Resource subj, IRI pred, Value obj, Resource... contexts) throws SailException Description copied from interface:InferencerConnectionAdds an inferred statement to a specific context.- Specified by:
addInferredStatementin interfaceInferencerConnection- Overrides:
addInferredStatementin classSailSourceConnection- Parameters:
subj- The subject of the statement to add.pred- The predicate of the statement to add.obj- The object of the statement to add.contexts- The context(s) to add the statement to. Note that this parameter is a vararg and as such is optional. If no contexts are supplied the method operates on the entire repository.- Throws:
SailException- If the statement could not be added.
-
removeStatementsInternal
protected void removeStatementsInternal(Resource subj, IRI pred, Value obj, Resource... contexts) throws SailException - Specified by:
removeStatementsInternalin classAbstractSailConnection- Throws:
SailException
-
removeInferredStatement
public boolean removeInferredStatement(Resource subj, IRI pred, Value obj, Resource... contexts) throws SailException Description copied from interface:InferencerConnectionRemoves an inferred statement from a specific context.- Specified by:
removeInferredStatementin interfaceInferencerConnection- Overrides:
removeInferredStatementin classSailSourceConnection- Parameters:
subj- The subject of the statement that should be removed.pred- The predicate of the statement that should be removed.obj- The object of the statement that should be removed.contexts- The context(s) from which to remove the statements. Note that this parameter is a vararg and as such is optional. If no contexts are supplied the method operates on the entire repository.- Throws:
SailException- If the statement could not be removed.
-
clearInternal
- Overrides:
clearInternalin classSailSourceConnection- Throws:
SailException
-
clearInferred
Description copied from interface:InferencerConnectionRemoves all inferred statements from the specified/all contexts. If no contexts are specified the method operates on the entire repository.- Specified by:
clearInferredin interfaceInferencerConnection- Overrides:
clearInferredin classSailSourceConnection- Parameters:
contexts- The context(s) from which to remove the statements. Note that this parameter is a vararg and as such is optional. If no contexts are supplied the method operates on the entire repository.- Throws:
SailException- If the statements could not be removed.
-
getSail
-
supportsConcurrentReads
public boolean supportsConcurrentReads()Description copied from interface:ThreadSafetyAwareA class may support concurrent reads from multiple threads against the same object. This ability may change based on an object's current state.- Specified by:
supportsConcurrentReadsin interfaceThreadSafetyAware- Returns:
- true if this object supports concurrent reads
-
AbstractSailConnection.verifyIsActive()instead.