Package org.eclipse.rdf4j.sail.base
Class Changeset
- java.lang.Object
-
- org.eclipse.rdf4j.sail.base.Changeset
-
- All Implemented Interfaces:
AutoCloseable,ModelFactory,SailClosable,SailSink
@InternalUseOnly public abstract class Changeset extends Object implements SailSink, ModelFactory
Set of changes applied to anSailSourceBranchawaiting to be flushed into its backingSailSource.- Author:
- James Leigh
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classChangeset.SimpleStatementPattern
-
Constructor Summary
Constructors Constructor Description Changeset()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddRefback(org.eclipse.rdf4j.sail.base.SailDatasetImpl dataset)voidapprove(Resource subj, IRI pred, Value obj, Resource ctx)Adds a statement to the store.voidapprove(Statement statement)Adds a statement to the store.voidapproveAll(Set<Statement> approve, Set<Resource> approveContexts)voidclear(Resource... contexts)Removes all statements from the specified/all contexts.voidclearNamespaces()Removes all namespace declarations from thisSailSource.voidclose()Closes this resource, relinquishing any underlying resources.voiddeprecate(Statement statement)Removes a statement.voiddeprecateAll(Set<Statement> deprecate)Map<String,String>getAddedNamespaces()Set<Resource>getApprovedContexts()Set<Resource>getDeprecatedContexts()Set<StatementPattern>getObservations()Deprecated.Use getObserved() instead!Set<Changeset.SimpleStatementPattern>getObserved()Set<String>getRemovedPrefixes()booleanhasDeprecated()booleanisNamespaceCleared()booleanisRefback()booleanisStatementCleared()voidobserve(Resource subj, IRI pred, Value obj, Resource context)Called 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.voidobserve(Resource subj, IRI pred, Value obj, Resource... contexts)Called 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.voidprepend(Changeset changeset)voidremoveNamespace(String prefix)Removes a namespace declaration by removing the association between a prefix and a namespace name.voidremoveRefback(org.eclipse.rdf4j.sail.base.SailDatasetImpl dataset)protected voidsetChangeset(Changeset from)voidsetNamespace(String prefix, String name)Sets the prefix for a namespace.ChangesetshallowClone()Create a shallow clone of this Changeset.voidsinkObserved(SailSink sink)StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.rdf4j.model.ModelFactory
createEmptyModel
-
Methods inherited from interface org.eclipse.rdf4j.sail.base.SailSink
deprecateByQuery, flush, supportsDeprecateByQuery
-
-
-
-
Method Detail
-
close
public void close() throws SailExceptionDescription 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
public void prepare() throws SailExceptionDescription 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
-
addRefback
public void addRefback(org.eclipse.rdf4j.sail.base.SailDatasetImpl dataset)
-
removeRefback
public void removeRefback(org.eclipse.rdf4j.sail.base.SailDatasetImpl dataset)
-
isRefback
public boolean isRefback()
-
prepend
public void prepend(Changeset changeset)
-
setNamespace
public void setNamespace(String prefix, String name)
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
public void removeNamespace(String prefix)
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
public void observeAll(Set<Changeset.SimpleStatementPattern> observed)
- Specified by:
observeAllin interfaceSailSink
-
clear
public void clear(Resource... contexts)
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
public void approve(Statement statement)
Description copied from interface:SailSinkAdds a statement to the store.
-
approve
public void approve(Resource subj, IRI pred, Value obj, Resource ctx) throws SailException
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
public void deprecate(Statement statement)
Description copied from interface:SailSinkRemoves a statement.
-
setChangeset
protected void setChangeset(Changeset from)
-
shallowClone
public Changeset 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
public Set<Changeset.SimpleStatementPattern> getObserved()
-
getObservations
@Deprecated public Set<StatementPattern> getObservations()
Deprecated.Use getObserved() instead!
-
isStatementCleared
public boolean isStatementCleared()
-
isNamespaceCleared
public boolean isNamespaceCleared()
-
hasDeprecated
public boolean hasDeprecated()
-
sinkObserved
public void sinkObserved(SailSink sink)
-
approveAll
public void approveAll(Set<Statement> approve, Set<Resource> approveContexts)
- Specified by:
approveAllin interfaceSailSink
-
deprecateAll
public void deprecateAll(Set<Statement> deprecate)
- Specified by:
deprecateAllin interfaceSailSink
-
-