public class SailRepository extends AbstractRepository implements FederatedServiceResolverClient, RepositoryResolverClient, HttpClientDependent, SessionManagerDependent
Repository interface that operates on a (stack of) Sail object(s). The
behaviour of the repository is determined by the Sail stack that it operates on; for example, the repository will
only support RDF Schema or OWL semantics if the Sail stack includes an inferencer for this.
Creating a repository object of this type is very easy. For example, the following code creates and initializes a main-memory store with RDF Schema semantics:
Repository repository = new SailRepository(new ForwardChainingRDFSInferencer(new MemoryStore())); repository.initialize();Or, alternatively:
Sail sailStack = new MemoryStore(); sailStack = new ForwardChainingRDFSInferencer(sailStack); Repository repository = new SailRepository(sailStack); repository.initialize();
logger| Constructor and Description |
|---|
SailRepository(Sail sail)
Creates a new repository object that operates on the supplied Sail.
|
| Modifier and Type | Method and Description |
|---|---|
SailRepositoryConnection |
getConnection()
Opens a connection to this repository that can be used for querying and updating the contents of the repository.
|
File |
getDataDir()
Get the directory where data and logging for this repository is stored.
|
org.apache.http.client.HttpClient |
getHttpClient()
HttpClient that has been assigned or has been used by this object. |
HttpClientSessionManager |
getHttpClientSessionManager()
HttpClientSessionManager that has been assigned or has been used by this object. |
Sail |
getSail()
Gets the Sail object that is on top of the Sail stack that this repository operates on.
|
ValueFactory |
getValueFactory()
Gets a ValueFactory for this Repository.
|
protected void |
initializeInternal() |
boolean |
isWritable()
Checks whether this repository is writable, i.e.
|
void |
setDataDir(File dataDir)
Set the directory where data and logging for this repository is stored.
|
void |
setFederatedServiceResolver(FederatedServiceResolver resolver)
Sets the
FederatedServiceResolver to use for this client. |
void |
setHttpClient(org.apache.http.client.HttpClient client)
Assign an
HttpClient that this object should use. |
void |
setHttpClientSessionManager(HttpClientSessionManager client)
Assign an
HttpClientSessionManager that this object should use. |
void |
setRepositoryResolver(RepositoryResolver resolver) |
protected void |
shutDownInternal() |
String |
toString() |
init, initialize, isInitialized, shutDownclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetSesameClient, setSesameClientpublic SailRepository(Sail sail)
sail - A Sail object.public File getDataDir()
RepositorygetDataDir in interface Repositorypublic void setDataDir(File dataDir)
RepositorysetDataDir in interface RepositorydataDir - the directory where data for this repository is storedpublic void setFederatedServiceResolver(FederatedServiceResolver resolver)
FederatedServiceResolverClientFederatedServiceResolver to use for this client.setFederatedServiceResolver in interface FederatedServiceResolverClientresolver - The resolver to use.public void setRepositoryResolver(RepositoryResolver resolver)
setRepositoryResolver in interface RepositoryResolverClientpublic HttpClientSessionManager getHttpClientSessionManager()
SessionManagerDependentHttpClientSessionManager that has been assigned or has been used by this object. The life cycle might not
be or might be tied to this object, depending on whether HttpClientSessionManager was passed to or
created by this object respectively.getHttpClientSessionManager in interface SesameClientDependentgetHttpClientSessionManager in interface SessionManagerDependentHttpClientSessionManager instance or nullpublic void setHttpClientSessionManager(HttpClientSessionManager client)
SessionManagerDependentHttpClientSessionManager that this object should use. The life cycle of the given
HttpClientSessionManager is independent of this object. Closing or shutting down this object does not
have any impact on the given client. Callers must ensure that the given client is properly closed elsewhere.setHttpClientSessionManager in interface SesameClientDependentsetHttpClientSessionManager in interface SessionManagerDependentpublic org.apache.http.client.HttpClient getHttpClient()
HttpClientDependentHttpClient that has been assigned or has been used by this object. The life cycle might not be or might
be tied to this object, depending on whether HttpClient was passed to or created by this object
respectively.getHttpClient in interface HttpClientDependentHttpClient instance or nullpublic void setHttpClient(org.apache.http.client.HttpClient client)
HttpClientDependentHttpClient that this object should use. The life cycle of the given HttpClient is
independent of this object. Closing or shutting down this object does not have any impact on the given client.
Callers must ensure that the given client is properly closed elsewhere.setHttpClient in interface HttpClientDependentprotected void initializeInternal()
throws RepositoryException
initializeInternal in class AbstractRepositoryRepositoryExceptionprotected void shutDownInternal()
throws RepositoryException
shutDownInternal in class AbstractRepositoryRepositoryExceptionpublic Sail getSail()
public boolean isWritable()
throws RepositoryException
RepositoryisWritable in interface RepositoryRepositoryExceptionpublic ValueFactory getValueFactory()
RepositorygetValueFactory in interface Repositorypublic SailRepositoryConnection getConnection() throws RepositoryException
Repository
try (RepositoryConnection conn = repository.getConnection()) {
// perform operations on the connection
}
Note that RepositoryConnection is not guaranteed to be thread-safe! The recommended pattern for
repository access in a multi-threaded application is to share the Repository object between threads, but have
each thread create and use its own RepositoryConnections.getConnection in interface RepositoryRepositoryException - If something went wrong during the creation of the Connection.Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.