Package org.eclipse.rdf4j.sail.memory
Class MemorySailStore.MemorySailSink
java.lang.Object
org.eclipse.rdf4j.sail.memory.MemorySailStore.MemorySailSink
- All Implemented Interfaces:
AutoCloseable
,SailClosable
,SailSink
- Enclosing class:
MemorySailStore
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private final boolean
private int
private Set
<StatementPattern> private boolean
private final MemorySailStore.SnapshotMonitor.ReservedSnapshot
private final int
private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
private MemStatement
addStatement
(Resource subj, IRI pred, Value obj, Resource context, boolean explicit) void
Adds a statement to the store.void
approveAll
(Set<Statement> approved, Set<Resource> approvedContexts) void
Removes all statements from the specified/all contexts.void
Removes all namespace declarations from thisSailSource
.void
close()
Closes this resource, relinquishing any underlying resources.void
Removes a statement.void
deprecateAll
(Set<Statement> deprecated) boolean
deprecateByQuery
(Resource subj, IRI pred, Value obj, Resource[] contexts) Removes all statements with the specified subject, predicate, object, and context.void
flush()
Once this method returns successfully, changes that were made to thisSailSink
will be visible to subsequentSailSource.dataset(IsolationLevel)
.private MemStatementList
getSmallestMemStatementList
(MemResource memSubj, MemIRI memPred, MemValue memObj, MemResource memContext) private void
innerDeprecate
(Statement statement, int nextSnapshot) void
Called to indicate matching statements have been observed and must not change their state until after thisSailSink
is committed, iff this was opened in an isolation level compatible withIsolationLevels.SERIALIZABLE
.void
prepare()
Checks if thisSailSink
is consistent with the isolation level it was created with.private void
void
removeNamespace
(String prefix) Removes a namespace declaration by removing the association between a prefix and a namespace name.void
setNamespace
(String prefix, String name) Sets the prefix for a namespace.private boolean
statementAlreadyExists
(boolean explicit, MemResource memSubj, MemIRI memPred, MemValue memObj, MemResource memContext, int nextSnapshot) toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.rdf4j.sail.base.SailSink
approve, deprecate, observe, observeAll, supportsDeprecateByQuery
-
Field Details
-
closed
private volatile boolean closed -
explicit
private final boolean explicit -
serializable
private final int serializable -
reservedSnapshot
-
nextSnapshot
private int nextSnapshot -
observations
-
txnLock
private volatile boolean txnLock -
requireCleanup
private boolean requireCleanup
-
-
Constructor Details
-
MemorySailSink
- Throws:
SailException
-
-
Method Details
-
toString
-
prepare
Description copied from interface:SailSink
Checks if thisSailSink
is consistent with the isolation level it was created with. If this Sink was created with aIsolationLevels.SERIALIZABLE
and another conflictingSailSink
has already beenSailSink.flush()
ed, this method will throw aSailConflictException
.- Specified by:
prepare
in interfaceSailSink
- Throws:
SailException
-
flush
Description copied from interface:SailSink
Once this method returns successfully, changes that were made to thisSailSink
will be visible to subsequentSailSource.dataset(IsolationLevel)
.- Specified by:
flush
in interfaceSailSink
- Throws:
SailException
-
close
public void close()Description copied from interface:SailClosable
Closes this resource, relinquishing any underlying resources.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceSailClosable
-
releaseLock
private void releaseLock() -
setNamespace
Description copied from interface:SailSink
Sets the prefix for a namespace.- Specified by:
setNamespace
in interfaceSailSink
- Parameters:
prefix
- The new prefix, or an empty string in case of the default namespace.name
- The namespace name that the prefix maps to.
-
removeNamespace
Description copied from interface:SailSink
Removes a namespace declaration by removing the association between a prefix and a namespace name.- Specified by:
removeNamespace
in interfaceSailSink
- Parameters:
prefix
- The namespace prefix, or an empty string in case of the default namespace.
-
clearNamespaces
public void clearNamespaces()Description copied from interface:SailSink
Removes all namespace declarations from thisSailSource
.- Specified by:
clearNamespaces
in interfaceSailSink
-
observe
Description copied from interface:SailSink
Called to indicate matching statements have been observed and must not change their state until after thisSailSink
is committed, iff this was opened in an isolation level compatible withIsolationLevels.SERIALIZABLE
.- Specified by:
observe
in interfaceSailSink
- Parameters:
subj
- A Resource specifying the subject, or null for a wildcard.pred
- A IRI specifying the predicate, or null for a wildcard.obj
- A Value specifying the object, or null for a wildcard.contexts
- The context(s) of the observed statements. Note that this parameter is a vararg and as such is optional. If no contexts are supplied the method operates on all contexts.- Throws:
SailException
- If the triple source failed to observe these statements.
-
clear
Description copied from interface:SailSink
Removes all statements from the specified/all contexts. If no contexts are specified the method operates on the entire repository.- Specified by:
clear
in interfaceSailSink
- 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 specified the method operates on the entire repository. A null value can be used to match context-less statements.
-
approve
Description copied from interface:SailSink
Adds a statement to the store. -
approveAll
- Specified by:
approveAll
in interfaceSailSink
-
deprecateAll
- Specified by:
deprecateAll
in interfaceSailSink
-
deprecate
Description copied from interface:SailSink
Removes a statement.- Specified by:
deprecate
in interfaceSailSink
- Parameters:
statement
- The statement that should be removed- Throws:
SailException
- If the statement could not be removed, for example because no transaction is active.
-
innerDeprecate
-
acquireExclusiveTransactionLock
- Throws:
SailException
-
addStatement
private MemStatement addStatement(Resource subj, IRI pred, Value obj, Resource context, boolean explicit) throws SailException, InterruptedException - Throws:
SailException
InterruptedException
-
statementAlreadyExists
private boolean statementAlreadyExists(boolean explicit, MemResource memSubj, MemIRI memPred, MemValue memObj, MemResource memContext, int nextSnapshot) throws InterruptedException - Throws:
InterruptedException
-
getSmallestMemStatementList
private MemStatementList getSmallestMemStatementList(MemResource memSubj, MemIRI memPred, MemValue memObj, MemResource memContext) -
deprecateByQuery
Description copied from interface:SailSink
Removes all statements with the specified subject, predicate, object, and context. All four parameters may be null.- Specified by:
deprecateByQuery
in interfaceSailSink
-