public class KiWiVersioningSail extends TransactionalSailWrapper implements TransactionListener, VersioningSail
Modifier and Type | Field and Description |
---|---|
protected static long |
DEFAULT_CONNECTION_TIMEOUT |
Constructor and Description |
---|
KiWiVersioningSail(TransactionalSail parent)
Build a new
KiWiVersioningSail based on the provided parent
TransactionalSail . |
KiWiVersioningSail(TransactionalSail parent,
org.apache.marmotta.commons.sesame.filter.SesameFilter<org.openrdf.model.Statement> filter)
Build a new selective
KiWiVersioningSail based on the provided
parent TransactionalSail . |
Modifier and Type | Method and Description |
---|---|
void |
afterCommit(TransactionData data)
Called after a transaction has committed.
|
void |
beforeCommit(TransactionData data)
Called before a transaction commits.
|
protected void |
closeSnapshotConnection(KiWiSnapshotConnection con)
Unregister the snapshot connection, it has been cleaned up properly.
|
KiWiStore |
getBaseStore()
Return the KiWi store that is at the base of the SAIL stack.
|
Version |
getLatestVersion(org.openrdf.model.Resource r,
Date date)
Return the version that is the most recent version for a resource given a reference date.
|
KiWiVersioningPersistence |
getPersistence()
Return the versioning persistence object underlying this SAIL.
|
KiWiSnapshotConnection |
getSnapshot(Date snapshotDate)
Get a read-only snapshot of the repository at the given date.
|
Version |
getVersion(Long id) |
void |
initialize()
Ensure that the versioning tables are properly initialised in the database.
|
org.openrdf.repository.RepositoryResult<Version> |
listVersions()
List all versions of this repository.
|
org.openrdf.repository.RepositoryResult<Version> |
listVersions(Date from,
Date to)
List all versions of this repository between a start and end date.
|
org.openrdf.repository.RepositoryResult<Version> |
listVersions(org.openrdf.model.Resource r)
List all versions of this repository affecting the given resource as subject.
|
org.openrdf.repository.RepositoryResult<Version> |
listVersions(org.openrdf.model.Resource r,
Date from,
Date to)
List all versions of this repository affecting the given resource as subject between a start and end date.
|
void |
removeVersion(Long id)
Remove the version with the id passed as argument, including all references to added and removed triples.
|
void |
removeVersions(Date until)
Remove all versions until the date given as argument.
|
void |
removeVersions(Date from,
Date to)
Remove all versions in the given time interval.
|
void |
revertVersion(Version version)
Revert (undo) the version given as argument.
|
void |
rollback(TransactionData data)
Called when a transaction rolls back.
|
void |
shutDown() |
addTransactionListener, isTransactionsEnabled, removeTransactionListener, setTransactionsEnabled
addSailChangedListener, getBaseSail, getConnection, removeSailChangedListener, setBaseSail
getDataDir, getValueFactory, isWritable, setDataDir, verifyBaseSailSet
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addTransactionListener, isTransactionsEnabled, removeTransactionListener, setTransactionsEnabled
protected static final long DEFAULT_CONNECTION_TIMEOUT
public KiWiVersioningSail(TransactionalSail parent)
KiWiVersioningSail
based on the provided parent
TransactionalSail
.parent
- the TransactionalSail
to base the
KiWiVersioningSail
on.public KiWiVersioningSail(TransactionalSail parent, org.apache.marmotta.commons.sesame.filter.SesameFilter<org.openrdf.model.Statement> filter)
KiWiVersioningSail
based on the provided
parent TransactionalSail
. Only Statement
s that are
accepted by the filter are included in versioning.parent
- the TransactionalSail
to base the
KiWiVersioningSail
on.filter
- a SesameFilter
to filter out Statement
s that
should not be versioned. Only a Statement
that is
accepted by this filter will be versioned.SesameFilter.accept(Object)
public void initialize() throws org.openrdf.sail.SailException
initialize
in interface org.openrdf.sail.Sail
initialize
in class org.openrdf.sail.helpers.SailWrapper
org.openrdf.sail.SailException
public KiWiStore getBaseStore()
public KiWiVersioningPersistence getPersistence()
public void afterCommit(TransactionData data)
afterCommit
in interface TransactionListener
data
- public void beforeCommit(TransactionData data)
beforeCommit
in interface TransactionListener
data
- public void rollback(TransactionData data)
rollback
in interface TransactionListener
public KiWiSnapshotConnection getSnapshot(Date snapshotDate) throws org.openrdf.sail.SailException
getSnapshot
in interface VersioningSail
snapshotDate
- the date of which to take the snapshot; the snapshot will consist of all
triples that have been created before or at the date and deleted after that date
(or not deleted at all).org.openrdf.sail.SailException
protected void closeSnapshotConnection(KiWiSnapshotConnection con)
con
- public org.openrdf.repository.RepositoryResult<Version> listVersions() throws org.openrdf.sail.SailException
listVersions
in interface VersioningSail
org.openrdf.sail.SailException
public org.openrdf.repository.RepositoryResult<Version> listVersions(Date from, Date to) throws org.openrdf.sail.SailException
listVersions
in interface VersioningSail
org.openrdf.sail.SailException
public Version getVersion(Long id) throws org.openrdf.sail.SailException
org.openrdf.sail.SailException
public void removeVersion(Long id) throws org.openrdf.sail.SailException
id
- the database ID of the version (see Version.getId()
)org.openrdf.sail.SailException
public void removeVersions(Date until) throws org.openrdf.sail.SailException
until
- date until when to delete versionsorg.openrdf.sail.SailException
public void removeVersions(Date from, Date to) throws org.openrdf.sail.SailException
from
- date after which versions will be deletedto
- date before which versions will be deletedorg.openrdf.sail.SailException
public Version getLatestVersion(org.openrdf.model.Resource r, Date date) throws org.openrdf.sail.SailException
r
- the resource for which to find a versiondate
- the reference dateSQLException
org.openrdf.sail.SailException
public org.openrdf.repository.RepositoryResult<Version> listVersions(org.openrdf.model.Resource r) throws org.openrdf.sail.SailException
listVersions
in interface VersioningSail
org.openrdf.sail.SailException
public org.openrdf.repository.RepositoryResult<Version> listVersions(org.openrdf.model.Resource r, Date from, Date to) throws org.openrdf.sail.SailException
listVersions
in interface VersioningSail
org.openrdf.sail.SailException
public void revertVersion(Version version) throws org.openrdf.sail.SailException
version
- the version to revertorg.openrdf.sail.SailException
- in case reverting the version failedpublic void shutDown() throws org.openrdf.sail.SailException
shutDown
in interface org.openrdf.sail.Sail
shutDown
in class org.openrdf.sail.helpers.SailWrapper
org.openrdf.sail.SailException
Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.