Package org.eclipse.rdf4j.sail.base
Class SailSourceConnection
- java.lang.Object
-
- org.eclipse.rdf4j.sail.helpers.AbstractSailConnection
-
- org.eclipse.rdf4j.sail.helpers.AbstractNotifyingSailConnection
-
- org.eclipse.rdf4j.sail.base.SailSourceConnection
-
- All Implemented Interfaces:
AutoCloseable,FederatedServiceResolverClient,InferencerConnection,NotifyingSailConnection,SailConnection
public abstract class SailSourceConnection extends AbstractNotifyingSailConnection implements InferencerConnection, FederatedServiceResolverClient
ASailConnectionimplementation that is based on anSailStore.- Author:
- James Leigh
-
-
Field Summary
-
Fields inherited from class org.eclipse.rdf4j.sail.helpers.AbstractSailConnection
connectionLock, updateLock, useConnectionLock
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSailSourceConnection(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddInferredStatement(org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, org.eclipse.rdf4j.model.Resource... contexts)Adds an inferred statement to a specific context.voidaddStatement(UpdateContext op, org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, org.eclipse.rdf4j.model.Resource... contexts)voidclearInferred(org.eclipse.rdf4j.model.Resource... contexts)Removes all inferred statements from the specified/all contexts.protected voidclearInternal(org.eclipse.rdf4j.model.Resource... contexts)protected voidclearNamespacesInternal()protected voidcloseInternal()protected voidcommitInternal()protected voidendUpdateInternal(UpdateContext op)protected org.eclipse.rdf4j.common.iteration.CloseableIteration<? extends BindingSet,QueryEvaluationException>evaluateInternal(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings, boolean includeInferred)Explanationexplain(Explanation.Level level, TupleExpr tupleExpr, Dataset dataset, BindingSet bindings, boolean includeInferred, int timeoutSeconds)voidflushUpdates()Flushes any pending updates to be processed and the resulting changes to be reported to registeredSailConnectionListeners.protected org.eclipse.rdf4j.common.iteration.CloseableIteration<? extends org.eclipse.rdf4j.model.Resource,SailException>getContextIDsInternal()protected EvaluationStrategygetEvaluationStrategy(Dataset dataset, TripleSource tripleSource)FederatedServiceResolvergetFederatedServiceResolver()Returns theFederatedServiceResolverbeing used.protected StringgetNamespaceInternal(String prefix)protected org.eclipse.rdf4j.common.iteration.CloseableIteration<? extends org.eclipse.rdf4j.model.Namespace,SailException>getNamespacesInternal()protected org.eclipse.rdf4j.common.iteration.CloseableIteration<? extends org.eclipse.rdf4j.model.Statement,SailException>getStatementsInternal(org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, boolean includeInferred, org.eclipse.rdf4j.model.Resource... contexts)protected voidprepareInternal()booleanremoveInferredStatement(org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, org.eclipse.rdf4j.model.Resource... contexts)Removes an inferred statement from a specific context.protected voidremoveNamespaceInternal(String prefix)voidremoveStatement(UpdateContext op, org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, org.eclipse.rdf4j.model.Resource... contexts)protected voidrollbackInternal()voidsetFederatedServiceResolver(FederatedServiceResolver resolver)Sets theFederatedServiceResolverto use.protected voidsetNamespaceInternal(String prefix, String name)voidsetTransactionSettings(org.eclipse.rdf4j.common.transaction.TransactionSetting... settings)protected longsizeInternal(org.eclipse.rdf4j.model.Resource... contexts)protected voidstartTransactionInternal()voidstartUpdate(UpdateContext op)-
Methods inherited from class org.eclipse.rdf4j.sail.helpers.AbstractNotifyingSailConnection
addConnectionListener, hasConnectionListeners, notifyStatementAdded, notifyStatementRemoved, removeConnectionListener
-
Methods inherited from class org.eclipse.rdf4j.sail.helpers.AbstractSailConnection
addStatement, addStatementInternal, autoStartTransaction, begin, begin, clear, clearNamespaces, close, commit, endUpdate, evaluate, flush, getContextIDs, getExclusiveConnectionLock, getNamespace, getNamespaces, getSailBase, getSharedConnectionLock, getStatements, getTransactionIsolation, getTransactionLock, hasStatement, hasStatementInternal, isActive, isActiveOperation, isOpen, iterationClosed, pendingAdds, pendingRemovals, prepare, registerIteration, removeNamespace, removeStatements, removeStatementsInternal, rollback, setNamespace, setStatementsAdded, setStatementsRemoved, size, transactionActive, verifyIsActive, verifyIsOpen
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.rdf4j.sail.NotifyingSailConnection
addConnectionListener, removeConnectionListener
-
Methods inherited from interface org.eclipse.rdf4j.sail.SailConnection
addStatement, begin, begin, clear, clearNamespaces, close, commit, endUpdate, evaluate, flush, getContextIDs, getNamespace, getNamespaces, getStatements, hasStatement, isActive, isOpen, pendingRemovals, prepare, prepareQuery, removeNamespace, removeStatements, rollback, setNamespace, size
-
-
-
-
Constructor Detail
-
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 Detail
-
getFederatedServiceResolver
public FederatedServiceResolver getFederatedServiceResolver()
Returns theFederatedServiceResolverbeing used.- Specified by:
getFederatedServiceResolverin interfaceFederatedServiceResolverClient- Returns:
- null if a custom
EvaluationStrategyFactoryis being used.
-
setFederatedServiceResolver
public void setFederatedServiceResolver(FederatedServiceResolver resolver)
Sets theFederatedServiceResolverto use. If a customEvaluationStrategyFactoryis being used then this only has an effect if it implementsFederatedServiceResolverClient.- Specified by:
setFederatedServiceResolverin interfaceFederatedServiceResolverClient
-
getEvaluationStrategy
protected EvaluationStrategy getEvaluationStrategy(Dataset dataset, TripleSource tripleSource)
-
evaluateInternal
protected org.eclipse.rdf4j.common.iteration.CloseableIteration<? extends BindingSet,QueryEvaluationException> 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)
- Specified by:
explainin interfaceSailConnection
-
closeInternal
protected void closeInternal() throws SailException- Specified by:
closeInternalin classAbstractSailConnection- Throws:
SailException
-
getContextIDsInternal
protected org.eclipse.rdf4j.common.iteration.CloseableIteration<? extends org.eclipse.rdf4j.model.Resource,SailException> getContextIDsInternal() throws SailException
- Specified by:
getContextIDsInternalin classAbstractSailConnection- Throws:
SailException
-
getStatementsInternal
protected org.eclipse.rdf4j.common.iteration.CloseableIteration<? extends org.eclipse.rdf4j.model.Statement,SailException> getStatementsInternal(org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, boolean includeInferred, org.eclipse.rdf4j.model.Resource... contexts) throws SailException
- Specified by:
getStatementsInternalin classAbstractSailConnection- Throws:
SailException
-
sizeInternal
protected long sizeInternal(org.eclipse.rdf4j.model.Resource... contexts) throws SailException- Specified by:
sizeInternalin classAbstractSailConnection- Throws:
SailException
-
getNamespacesInternal
protected org.eclipse.rdf4j.common.iteration.CloseableIteration<? extends org.eclipse.rdf4j.model.Namespace,SailException> getNamespacesInternal() throws SailException
- Specified by:
getNamespacesInternalin classAbstractSailConnection- Throws:
SailException
-
getNamespaceInternal
protected String getNamespaceInternal(String prefix) throws SailException
- Specified by:
getNamespaceInternalin classAbstractSailConnection- Throws:
SailException
-
setTransactionSettings
public void setTransactionSettings(org.eclipse.rdf4j.common.transaction.TransactionSetting... settings)
- Specified by:
setTransactionSettingsin interfaceSailConnection
-
startTransactionInternal
protected void startTransactionInternal() throws SailException- Specified by:
startTransactionInternalin classAbstractSailConnection- Throws:
SailException
-
prepareInternal
protected void prepareInternal() throws SailException- Overrides:
prepareInternalin classAbstractSailConnection- Throws:
SailException
-
commitInternal
protected void commitInternal() throws SailException- Specified by:
commitInternalin classAbstractSailConnection- Throws:
SailException
-
rollbackInternal
protected void rollbackInternal() throws SailException- Specified by:
rollbackInternalin classAbstractSailConnection- Throws:
SailException
-
startUpdate
public void startUpdate(UpdateContext op) throws SailException
- Specified by:
startUpdatein interfaceSailConnection- Overrides:
startUpdatein classAbstractSailConnection- Throws:
SailException
-
addStatement
public void addStatement(UpdateContext op, org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, org.eclipse.rdf4j.model.Resource... contexts) throws SailException
- Specified by:
addStatementin interfaceSailConnection- Overrides:
addStatementin classAbstractSailConnection- Throws:
SailException
-
removeStatement
public void removeStatement(UpdateContext op, org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, org.eclipse.rdf4j.model.Resource... contexts) throws SailException
- Specified by:
removeStatementin interfaceSailConnection- Overrides:
removeStatementin classAbstractSailConnection- Throws:
SailException
-
endUpdateInternal
protected void endUpdateInternal(UpdateContext op) throws SailException
- Overrides:
endUpdateInternalin classAbstractSailConnection- Throws:
SailException
-
addInferredStatement
public boolean addInferredStatement(org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, org.eclipse.rdf4j.model.Resource... contexts) throws SailExceptionDescription 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(org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, org.eclipse.rdf4j.model.Resource... contexts) throws SailExceptionDescription 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
protected void clearInternal(org.eclipse.rdf4j.model.Resource... contexts) throws SailException- Specified by:
clearInternalin classAbstractSailConnection- Throws:
SailException
-
clearInferred
public void clearInferred(org.eclipse.rdf4j.model.Resource... contexts) throws SailExceptionDescription 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
public void flushUpdates() throws SailExceptionDescription 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
protected void setNamespaceInternal(String prefix, String name) throws SailException
- Specified by:
setNamespaceInternalin classAbstractSailConnection- Throws:
SailException
-
removeNamespaceInternal
protected void removeNamespaceInternal(String prefix) throws SailException
- Specified by:
removeNamespaceInternalin classAbstractSailConnection- Throws:
SailException
-
clearNamespacesInternal
protected void clearNamespacesInternal() throws SailException- Specified by:
clearNamespacesInternalin classAbstractSailConnection- Throws:
SailException
-
-