Class ChangeTracker
- All Implemented Interfaces:
org.eclipse.rdf4j.query.algebra.evaluation.federation.FederatedServiceResolverClient
,org.eclipse.rdf4j.repository.RepositoryResolverClient
,org.eclipse.rdf4j.repository.sail.config.RepositoryResolverClient
,org.eclipse.rdf4j.sail.NotifyingSail
,org.eclipse.rdf4j.sail.Sail
,org.eclipse.rdf4j.sail.StackableSail
NotifyingSail
keeping track of changes to an underlying Sail
. Each commit containing at
least one relevant update is recorded into the support repository. The representation of the history
conforms to the vocabulary CHANGELOG
.
A change is recorded only if it is an effective update to the underlying data: i.e. either adding a triple that wasn't already assert, or removing a previously asserted triples. Self-canceling operations are ignored as well.
The client of this Sail
can manage the tracking system, by reading/writing appropriate
contexts: these operations are intercepted by this Sail, so that they are not executed against the
underlying data. Currently, only addStatement(..)
, removeStatements(...)
and
getStatements(..)
are supported. In particular, SPARQL Queries cannot be used to read the
special-purpose contexts defined by this Sail
.
The contexts CHANGETRACKER.STAGED_ADDITIONS
and CHANGETRACKER.STAGED_REMOVALS
can be used
to list the triples being staged for addition and removal, respectively.
The context CHANGETRACKER.GRAPH_MANAGEMENT
contains the description of a homonymous resource, which
is associated with the graphs to include and exclude, via the properties
CHANGETRACKER.INCLUDE_GRAPH
and CHANGETRACKER.EXCLUDE_GRAPH
, respectively. An update is
recorded into the history only if its context is a graph such that it satisfies the inclusion criterion and
it does not satisfy the exclusion criterion. An empty set of included graphs is equivalent to include all
graphs, while an empty set of excluded graphs is equivalent to not rejecting any graph. The resource
CHANGELOG.NULL
(formerly SESAME.NIL
) represents the null
context, while
SESAME.WILDCARD
is another mechanism to specify all graphs.
By default, the history ignores the null
context and includes other contexts. Excluding the
null
context is a simple mechanism to ignore inferred triples.
It is possible to write additional metadata about a commit through the context
CHANGETRACKER.COMMIT_METADATA
. Since the client doesn't know which resource will represent the
commit in the history repository, the client may identify the commit via the IRI
CHANGETRACKER.COMMIT_METADATA
: when the commit metadata is written into the history, this
identifier will be replace with the actual identifier of the commit.
When validation is enabled, write operations are first logged inside the validation graph (in the support repository) and applied to the staging graphs (in the core repository).
To accept/reject a previous transaction, it is sufficient to write in the context
CHANGETRACKER.VALIDATION
, as follows:
conn.add(commitIRI, CHANGETRACKER.VALIDATION, CHANGETRACKER.ACCEPT | CHANGETRACKER.ACCEPT, CHANGETRACKER.VALIDATION)
- Author:
- Manuel Fiorelli
-
Field Summary
Modifier and TypeFieldDescriptionprotected final boolean
protected final org.eclipse.rdf4j.model.IRI
protected final org.eclipse.rdf4j.model.Model
protected final boolean
protected final org.eclipse.rdf4j.model.IRI
protected static final org.slf4j.Logger
protected final String
protected static final String
static final String
protected static final Properties
protected final String
protected final String
protected final boolean
protected final boolean
protected final org.eclipse.rdf4j.model.IRI
protected static final String
-
Constructor Summary
ConstructorDescriptionChangeTracker
(String serverURL, String supportRepoId, String metadataNS, org.eclipse.rdf4j.model.IRI historyGraph, Set<org.eclipse.rdf4j.model.IRI> includeGraph, Set<org.eclipse.rdf4j.model.IRI> excludeGraph, boolean historyEnabled, boolean validationEnabled, boolean undoEnabled, Optional<Boolean> interactiveNotifications, org.eclipse.rdf4j.model.IRI validationGraph, boolean blacklistEnabled, org.eclipse.rdf4j.model.IRI blacklistGraph) -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.rdf4j.common.transaction.IsolationLevel
List<org.eclipse.rdf4j.common.transaction.IsolationLevel>
static String
void
init()
void
setRepositoryResolver
(org.eclipse.rdf4j.repository.RepositoryResolver resolver) void
setRepositoryResolver
(org.eclipse.rdf4j.repository.sail.config.RepositoryResolver resolver) void
shutDown()
Methods inherited from class org.eclipse.rdf4j.sail.helpers.NotifyingSailWrapper
addSailChangedListener, getBaseSail, removeSailChangedListener, setBaseSail
Methods inherited from class org.eclipse.rdf4j.sail.helpers.SailWrapper
getCollectionFactory, getDataDir, getFederatedServiceResolver, getValueFactory, isWritable, setDataDir, setFederatedServiceResolver, verifyBaseSailSet
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.Sail
getCollectionFactory, getDataDir, getValueFactory, isWritable, setDataDir
-
Field Details
-
logger
protected static final org.slf4j.Logger logger -
OPTIONAL_TRUE
-
OPTIONAL_FALSE
-
PROPERTIES
- See Also:
-
props
-
PROP_VERSION
- See Also:
-
version
-
supportRepoId
-
serverURL
-
metadataNS
-
historyGraph
protected final org.eclipse.rdf4j.model.IRI historyGraph -
validationGraph
protected final org.eclipse.rdf4j.model.IRI validationGraph -
blacklistGraph
protected final org.eclipse.rdf4j.model.IRI blacklistGraph -
graphManagement
protected final org.eclipse.rdf4j.model.Model graphManagement -
historyEnabled
protected final boolean historyEnabled -
validationEnabled
protected final boolean validationEnabled -
undoEnabled
protected final boolean undoEnabled -
blacklistEnabled
protected final boolean blacklistEnabled -
interactiveNotifications
-
undoStack
-
-
Constructor Details
-
ChangeTracker
public ChangeTracker(String serverURL, String supportRepoId, String metadataNS, org.eclipse.rdf4j.model.IRI historyGraph, Set<org.eclipse.rdf4j.model.IRI> includeGraph, Set<org.eclipse.rdf4j.model.IRI> excludeGraph, boolean historyEnabled, boolean validationEnabled, boolean undoEnabled, Optional<Boolean> interactiveNotifications, org.eclipse.rdf4j.model.IRI validationGraph, boolean blacklistEnabled, org.eclipse.rdf4j.model.IRI blacklistGraph)
-
-
Method Details
-
getVersion
-
setRepositoryResolver
public void setRepositoryResolver(org.eclipse.rdf4j.repository.RepositoryResolver resolver) - Specified by:
setRepositoryResolver
in interfaceorg.eclipse.rdf4j.repository.RepositoryResolverClient
-
setRepositoryResolver
public void setRepositoryResolver(org.eclipse.rdf4j.repository.sail.config.RepositoryResolver resolver) -
init
public void init() throws org.eclipse.rdf4j.sail.SailException- Specified by:
init
in interfaceorg.eclipse.rdf4j.sail.Sail
- Overrides:
init
in classorg.eclipse.rdf4j.sail.helpers.SailWrapper
- Throws:
org.eclipse.rdf4j.sail.SailException
-
shutDown
public void shutDown() throws org.eclipse.rdf4j.sail.SailException- Specified by:
shutDown
in interfaceorg.eclipse.rdf4j.sail.Sail
- Overrides:
shutDown
in classorg.eclipse.rdf4j.sail.helpers.SailWrapper
- Throws:
org.eclipse.rdf4j.sail.SailException
-
getConnection
- Specified by:
getConnection
in interfaceorg.eclipse.rdf4j.sail.NotifyingSail
- Specified by:
getConnection
in interfaceorg.eclipse.rdf4j.sail.Sail
- Overrides:
getConnection
in classorg.eclipse.rdf4j.sail.helpers.NotifyingSailWrapper
- Throws:
org.eclipse.rdf4j.sail.SailException
-
getDefaultIsolationLevel
public org.eclipse.rdf4j.common.transaction.IsolationLevel getDefaultIsolationLevel()- Specified by:
getDefaultIsolationLevel
in interfaceorg.eclipse.rdf4j.sail.Sail
- Overrides:
getDefaultIsolationLevel
in classorg.eclipse.rdf4j.sail.helpers.SailWrapper
-
getSupportedIsolationLevels
- Specified by:
getSupportedIsolationLevels
in interfaceorg.eclipse.rdf4j.sail.Sail
- Overrides:
getSupportedIsolationLevels
in classorg.eclipse.rdf4j.sail.helpers.SailWrapper
-