Class Changeset
java.lang.Object
org.eclipse.rdf4j.sail.base.Changeset
- All Implemented Interfaces:
AutoCloseable, ModelFactory, SailClosable, SailSink
Set of changes applied to an
SailSourceBranch awaiting to be flushed into its backing SailSource.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionAdditional namespaces added.private ModelStatements that have been added as part of a transaction, but has not yet been committed.Set of contexts of theapprovedstatements.private booleanprivate booleanprivate ModelExplicit statements that have been removed as part of a transaction, but have not yet been committed.Set of contexts that were passed toclear(Resource...).private booleanprivate booleanIf all namespaces were removed, other thanaddedNamespaces.private Set<Changeset.SimpleStatementPattern> When inIsolationLevels.SERIALIZABLEthis contains all the observedStatementPatterns that were observed byObservingSailDataset.Changesets that have beenSailSink.flush()ed to the sameSailSourceBranch, since this object wasSailSink.flush()ed.(package private) Semaphore(package private) Changeset.AdderBasedReadWriteLockprivate List<SailDatasetImpl> (package private) Changeset.AdderBasedReadWriteLockNamespace prefixes that were removed.private booleanIf all statements were removed, other thanapproved. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRefback(SailDatasetImpl dataset) voidAdds a statement to the store.voidAdds a statement to the store.voidapproveAll(Set<Statement> approve, Set<Resource> approveContexts) voidRemoves all statements from the specified/all contexts.voidRemoves all namespace declarations from thisSailSource.private <T> Set<T> voidclose()Closes this resource, relinquishing any underlying resources.voidRemoves a statement.voiddeprecateAll(Set<Statement> deprecate) getApprovedStatements(Resource subj, IRI pred, Value obj, Resource[] contexts) getApprovedTriples(Resource subj, IRI pred, Value obj) Deprecated.Use getObserved() instead!(package private) boolean(package private) booleanhasApproved(Resource subj, IRI pred, Value obj, Resource[] contexts) boolean(package private) booleanhasDeprecated(Resource subj, IRI pred, Value obj, Resource[] contexts) (package private) booleanhasDeprecated(Statement statement) (package private) booleanbooleanbooleanbooleanvoidCalled to indicate matching statements have been observed and must not change their state until after thisSailSinkis committed, iff this was opened in an isolation level compatible withIsolationLevels.SERIALIZABLE.voidCalled to indicate matching statements have been observed and must not change their state until after thisSailSinkis committed, iff this was opened in an isolation level compatible withIsolationLevels.SERIALIZABLE.voidobserveAll(Set<Changeset.SimpleStatementPattern> observed) voidprepare()Checks if thisSailSinkis consistent with the isolation level it was created with.void(package private) voidremoveApproved(Statement next) voidremoveNamespace(String prefix) Removes a namespace declaration by removing the association between a prefix and a namespace name.voidremoveRefback(SailDatasetImpl dataset) protected voidsetChangeset(Changeset from) voidsetNamespace(String prefix, String name) Sets the prefix for a namespace.Create a shallow clone of this Changeset.(package private) voidsinkApproved(SailSink sink) (package private) voidsinkDeprecated(SailSink sink) voidsinkObserved(SailSink sink) toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ModelFactory
createEmptyModelMethods inherited from interface SailSink
deprecate, deprecateByQuery, flush, supportsDeprecateByQuery
-
Field Details
-
readWriteLock
Changeset.AdderBasedReadWriteLock readWriteLock -
refBacksReadWriteLock
Changeset.AdderBasedReadWriteLock refBacksReadWriteLock -
prependLock
Semaphore prependLock -
refbacks
-
prepend
Changesets that have beenSailSink.flush()ed to the sameSailSourceBranch, since this object wasSailSink.flush()ed. -
observed
When inIsolationLevels.SERIALIZABLEthis contains all the observedStatementPatterns that were observed byObservingSailDataset. -
approved
Statements that have been added as part of a transaction, but has not yet been committed.DO NOT EXPOSE THE MODEL OUTSIDE OF THIS CLASS BECAUSE IT IS NOT THREAD-SAFE
-
approvedEmpty
private volatile boolean approvedEmpty -
deprecated
Explicit statements that have been removed as part of a transaction, but have not yet been committed.DO NOT EXPOSE THE MODEL OUTSIDE OF THIS CLASS BECAUSE IT IS NOT THREAD-SAFE
-
deprecatedEmpty
private volatile boolean deprecatedEmpty -
approvedContexts
-
deprecatedContexts
Set of contexts that were passed toclear(Resource...). -
addedNamespaces
-
removedPrefixes
-
namespaceCleared
private volatile boolean namespaceClearedIf all namespaces were removed, other thanaddedNamespaces. -
statementCleared
private volatile boolean statementClearedIf all statements were removed, other thanapproved. -
closed
private boolean closed
-
-
Constructor Details
-
Changeset
public Changeset()
-
-
Method Details
-
close
Description copied from interface:SailClosableCloses this resource, relinquishing any underlying resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSailClosable- Throws:
SailException- if this resource cannot be closed
-
prepare
Description copied from interface:SailSinkChecks if thisSailSinkis consistent with the isolation level it was created with. If this Sink was created with aIsolationLevels.SERIALIZABLEand another conflictingSailSinkhas already beenSailSink.flush()ed, this method will throw aSailConflictException.- Specified by:
preparein interfaceSailSink- Throws:
SailException
-
hasApproved
-
hasDeprecated
-
addRefback
-
removeRefback
-
isRefback
public boolean isRefback() -
prepend
-
setNamespace
Description copied from interface:SailSinkSets the prefix for a namespace.- Specified by:
setNamespacein 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:SailSinkRemoves a namespace declaration by removing the association between a prefix and a namespace name.- Specified by:
removeNamespacein interfaceSailSink- Parameters:
prefix- The namespace prefix, or an empty string in case of the default namespace.
-
clearNamespaces
public void clearNamespaces()Description copied from interface:SailSinkRemoves all namespace declarations from thisSailSource.- Specified by:
clearNamespacesin interfaceSailSink
-
observe
public void observe(Resource subj, IRI pred, Value obj, Resource... contexts) throws SailConflictException Description copied from interface:SailSinkCalled to indicate matching statements have been observed and must not change their state until after thisSailSinkis committed, iff this was opened in an isolation level compatible withIsolationLevels.SERIALIZABLE.- Specified by:
observein 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:
SailConflictException
-
observe
public void observe(Resource subj, IRI pred, Value obj, Resource context) throws SailConflictException Description copied from interface:SailSinkCalled to indicate matching statements have been observed and must not change their state until after thisSailSinkis committed, iff this was opened in an isolation level compatible withIsolationLevels.SERIALIZABLE.- Specified by:
observein 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.context- The context of the observed statements.- Throws:
SailConflictException
-
observeAll
- Specified by:
observeAllin interfaceSailSink
-
clear
Description copied from interface:SailSinkRemoves all statements from the specified/all contexts. If no contexts are specified the method operates on the entire repository.- Specified by:
clearin 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
-
approve
Description copied from interface:SailSinkAdds a statement to the store.- Specified by:
approvein interfaceSailSink- 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.ctx- The context to add the statement to.- Throws:
SailException- If the statement could not be added, for example because no transaction is active.
-
deprecate
-
toString
-
setChangeset
-
shallowClone
Create a shallow clone of this Changeset. The shallow clone does not clone the underlying data structures, this means that any changes made to the original will potentially be reflected in the clone and vice versa.- Returns:
- a new Changeset that is a shallow clone of the current Changeset.
-
getObserved
-
getObservations
Deprecated.Use getObserved() instead! -
getApprovedContexts
-
getDeprecatedContexts
-
isStatementCleared
public boolean isStatementCleared() -
getAddedNamespaces
-
getRemovedPrefixes
-
isNamespaceCleared
public boolean isNamespaceCleared() -
hasDeprecated
public boolean hasDeprecated() -
isChanged
boolean isChanged() -
getDeprecatedStatements
-
getApprovedStatements
-
hasDeprecated
-
hasApproved
boolean hasApproved() -
getApprovedStatements
-
getApprovedTriples
-
removeApproved
-
cloneSet
-
sinkApproved
-
sinkDeprecated
-
sinkObserved
-
approveAll
-
deprecateAll
- Specified by:
deprecateAllin interfaceSailSink
-