Class SailSourceConnection
- All Implemented Interfaces:
AutoCloseable,FederatedServiceResolverClient,InferencerConnection,NotifyingSailConnection,SailConnection
- Direct Known Subclasses:
ExtensibleStoreConnection,LmdbStoreConnection,MemoryStoreConnection,NativeStoreConnection
SailConnection implementation that is based on an SailStore .- Author:
- James Leigh
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSailSourceConnection(AbstractSail sail, SailStore store, EvaluationStrategyFactory evalStratFactory) Creates a newSailConnection, using the givenSailStoreto manage the state.protectedSailSourceConnection(AbstractSail sail, SailStore store, FederatedServiceResolver resolver) Creates a newSailConnection, using the givenSailStoreto manage the state. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddInferredStatement(Resource subj, IRI pred, Value obj, Resource... contexts) Adds an inferred statement to a specific context.voidaddStatement(UpdateContext op, Resource subj, IRI pred, Value obj, Resource... contexts) The default implementation buffers added statements until the update operation is complete.voidclearInferred(Resource... contexts) Removes all inferred statements from the specified/all contexts.protected voidclearInternal(Resource... contexts) protected voidprotected 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 voidbooleanremoveInferredStatement(Resource subj, IRI pred, Value obj, Resource... contexts) Removes an inferred statement from a specific context.protected 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.protected voidvoidSets theFederatedServiceResolverto use.protected voidsetNamespaceInternal(String prefix, String name) voidsetTransactionSettings(TransactionSetting... settings) Pass any transaction-specific settings to the SailConnection.protected longsizeInternal(Resource... contexts) protected voidvoidSignals the start of an update operation.Methods inherited from class org.eclipse.rdf4j.sail.helpers.AbstractNotifyingSailConnection
addConnectionListener, hasConnectionListeners, notifyStatementAdded, notifyStatementRemoved, removeConnectionListenerMethods inherited from class org.eclipse.rdf4j.sail.helpers.AbstractSailConnection
addStatement, addStatementInternal, autoStartTransaction, begin, begin, clear, clearNamespaces, close, commit, endUpdate, evaluate, flush, getContextIDs, getNamespace, getNamespaces, getOwner, getSailBase, getStatements, getStatements, getTransactionIsolation, hasStatement, hasStatementInternal, isActive, isActiveOperation, isOpen, iterationClosed, pendingAdds, prepare, registerIteration, removeNamespace, removeStatements, removeStatementsInternal, rollback, setNamespace, setStatementsAdded, setStatementsRemoved, size, transactionActive, verifyIsActive, verifyIsOpen, waitForOtherOperationsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.rdf4j.sail.NotifyingSailConnection
addConnectionListener, removeConnectionListenerMethods inherited from interface org.eclipse.rdf4j.sail.SailConnection
addStatement, begin, begin, clear, clearNamespaces, close, commit, endUpdate, evaluate, flush, getContextIDs, getNamespace, getNamespaces, getStatements, getStatements, getSupportedOrders, hasStatement, isActive, isOpen, prepare, prepareQuery, removeNamespace, removeStatements, rollback, setNamespace, size
-
Constructor Details
-
SailSourceConnection
protected SailSourceConnection(AbstractSail sail, SailStore store, FederatedServiceResolver resolver) Creates a newSailConnection, using the givenSailStoreto manage the state.- Parameters:
sail-store-resolver- the FederatedServiceResolver to use with thedefault EvaluationStrategy.
-
SailSourceConnection
protected SailSourceConnection(AbstractSail sail, SailStore store, EvaluationStrategyFactory evalStratFactory) Creates a newSailConnection, using the givenSailStoreto manage the state.- Parameters:
sail-store-evalStratFactory- theEvaluationStrategyFactoryto use.
-
-
Method Details
-
getFederatedServiceResolver
Returns theFederatedServiceResolverbeing used.- Specified by:
getFederatedServiceResolverin interfaceFederatedServiceResolverClient- Returns:
- null if a custom
EvaluationStrategyFactoryis being used.
-
setFederatedServiceResolver
Sets theFederatedServiceResolverto use. If a customEvaluationStrategyFactoryis being used then this only has an effect if it implementsFederatedServiceResolverClient.- Specified by:
setFederatedServiceResolverin interfaceFederatedServiceResolverClient- Parameters:
resolver- The resolver to use.
-
getEvaluationStrategy
-
evaluateInternal
protected CloseableIteration<? extends BindingSet> evaluateInternal(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings, boolean includeInferred) throws SailException - Specified by:
evaluateInternalin classAbstractSailConnection- Throws:
SailException
-
explain
public Explanation explain(Explanation.Level level, TupleExpr tupleExpr, Dataset dataset, BindingSet bindings, boolean includeInferred, int timeoutSeconds) Description copied from interface:SailConnectionExplain 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.
This method is used by the Query interface.
WARNING: This method is experimental and is subject to change or removal without warning. There is currently only partial support for this method in RDF4J and and UnsupportedOperationException where support is lacking.
- Specified by:
explainin interfaceSailConnection- Parameters:
level- the explanation level, eg. OPTIMIZEDtupleExpr- The tuple expression to evaluate. Mutable.dataset- The dataset to use for evaluating the query, null to use the Sail's default dataset.bindings- A set of input parameters for the query evaluation. The keys reference variable names that should be bound to the value they map to.includeInferred- Indicates whether inferred triples are to be considered in the query result. If false, no inferred statements are returned; if true, inferred statements are returned if availabletimeoutSeconds- for explanations that require execution a timeout can be provided in seconds- Returns:
- The resulting tuple expression after being run through the specified level
-
closeInternal
- Specified by:
closeInternalin classAbstractSailConnection- Throws:
SailException
-
getContextIDsInternal
- Specified by:
getContextIDsInternalin classAbstractSailConnection- Throws:
SailException
-
getStatementsInternal
protected CloseableIteration<? extends Statement> getStatementsInternal(Resource subj, IRI pred, Value obj, boolean includeInferred, Resource... contexts) throws SailException - Specified by:
getStatementsInternalin classAbstractSailConnection- Throws:
SailException
-
getStatementsInternal
protected CloseableIteration<? extends Statement> getStatementsInternal(StatementOrder order, Resource subj, IRI pred, Value obj, boolean includeInferred, Resource... contexts) throws SailException - Overrides:
getStatementsInternalin classAbstractSailConnection- Throws:
SailException
-
getComparator
Description copied from interface:SailConnectionDifferent underlying datastructures may have different ways of ordering statements. On-disk stores typically use a long to represent a value and only stores the actual value in a dictionary, in this case the order would be the order that values where inserted into the dictionary. Stores that instead store values in SPARQL-order can return an instance ofValueComparatorwhich may allow for further optimizations.Note that this method is experimental and may be changed or removed without notice.
- Specified by:
getComparatorin interfaceSailConnection- Returns:
- a comparator that matches the order of values in the store
-
sizeInternal
- Specified by:
sizeInternalin classAbstractSailConnection- Throws:
SailException
-
getNamespacesInternal
- Specified by:
getNamespacesInternalin classAbstractSailConnection- Throws:
SailException
-
getNamespaceInternal
- Specified by:
getNamespaceInternalin classAbstractSailConnection- Throws:
SailException
-
setTransactionSettings
Description copied from interface:SailConnectionPass any transaction-specific settings to the SailConnection. This method needs to be called before the transaction isstarted.Sail implementations can override this method to receive the transaction settings (to inspect and/or pass them along to any wrapped sail objects). Remember to call
super.setTransactionSettings(settings)if you override this method.- Specified by:
setTransactionSettingsin interfaceSailConnection- Parameters:
settings- the transaction settings on which the next transaction operates. It may or may not contain the isolation level.
-
startTransactionInternal
- Specified by:
startTransactionInternalin classAbstractSailConnection- Throws:
SailException
-
prepareInternal
- Overrides:
prepareInternalin classAbstractSailConnection- Throws:
SailException
-
commitInternal
- Specified by:
commitInternalin classAbstractSailConnection- Throws:
SailException
-
rollbackInternal
- Specified by:
rollbackInternalin classAbstractSailConnection- Throws:
SailException
-
startUpdate
Description copied from interface:SailConnectionSignals the start of an update operation. The givenopmaybe passed to subsequentSailConnection.addStatement(UpdateContext, Resource, IRI, Value, Resource...)orSailConnection.removeStatement(UpdateContext, Resource, IRI, Value, Resource...)calls beforeSailConnection.endUpdate(UpdateContext)is called.- Specified by:
startUpdatein interfaceSailConnection- Overrides:
startUpdatein classAbstractSailConnection- Throws:
SailException
-
addStatement
public void addStatement(UpdateContext op, Resource subj, IRI pred, Value obj, Resource... contexts) throws SailException Description copied from class:AbstractSailConnectionThe default implementation buffers added statements until the update operation is complete.- Specified by:
addStatementin interfaceSailConnection- Overrides:
addStatementin classAbstractSailConnection- Parameters:
op- operation properties of theUpdateExproperation producing these statements.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 specified, a context-less statement will be added.- Throws:
SailException- If the statement could not be added, for example because no transaction is active.
-
removeStatement
public void removeStatement(UpdateContext op, Resource subj, IRI pred, Value obj, Resource... contexts) throws SailException Description copied from class:AbstractSailConnectionThe default implementation buffers removed statements until the update operation is complete.- Specified by:
removeStatementin interfaceSailConnection- Overrides:
removeStatementin classAbstractSailConnection- Parameters:
op- operation properties of theUpdateExproperation removing these statements.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 statement. Note that this parameter is a vararg and as such is optional. If no contexts are specified the method operates on the entire repository. A null value can be used to match context-less statements.- Throws:
SailException- If the statement could not be removed, for example because no transaction is active.
-
endUpdateInternal
- Overrides:
endUpdateInternalin 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- 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.
-
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- 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
- Specified by:
clearInternalin classAbstractSailConnection- 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- 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.
-
flushUpdates
Description copied from interface:InferencerConnectionFlushes any pending updates to be processed and the resulting changes to be reported to registeredSailConnectionListeners.- Specified by:
flushUpdatesin interfaceInferencerConnection- Throws:
SailException- If the updates could not be processed.
-
setNamespaceInternal
- Specified by:
setNamespaceInternalin classAbstractSailConnection- Throws:
SailException
-
removeNamespaceInternal
- Specified by:
removeNamespaceInternalin classAbstractSailConnection- Throws:
SailException
-
clearNamespacesInternal
- Specified by:
clearNamespacesInternalin classAbstractSailConnection- Throws:
SailException
-