public class SPARQLRepository extends AbstractRepository implements HttpClientDependent, SessionManagerDependent
logger| Constructor and Description |
|---|
SPARQLRepository(String endpointUrl)
Create a new SPARQLRepository using the supplied endpoint URL for queries and updates.
|
SPARQLRepository(String queryEndpointUrl,
String updateEndpointUrl)
Create a new SPARQLRepository using the supplied query endpoint URL for queries, and the supplied update endpoint
URL for updates.
|
| Modifier and Type | Method and Description |
|---|---|
protected SPARQLProtocolSession |
createHTTPClient()
Deprecated.
use
createSPARQLProtocolSession() instead |
protected SPARQLProtocolSession |
createSPARQLProtocolSession()
Creates a new
SPARQLProtocolSession object. |
void |
enableQuadMode(boolean flag)
Activate quad mode for this
SPARQLRepository, i.e. |
Map<String,String> |
getAdditionalHttpHeaders()
Get the additional HTTP headers which will be used
|
RepositoryConnection |
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. |
Boolean |
getPassThroughEnabled()
Retrieve the passThroughEnabled setting to be used for any newly created
RepositoryConnections. |
ValueFactory |
getValueFactory()
Gets a ValueFactory for this Repository.
|
protected void |
initializeInternal() |
boolean |
isWritable()
Checks whether this repository is writable, i.e.
|
void |
setAdditionalHttpHeaders(Map<String,String> additionalHttpHeaders)
Set additional HTTP headers to be included in every request to the server, which may be required for certain
unusual server configurations.
|
void |
setDataDir(File dataDir)
Set the directory where data and logging for this repository is stored.
|
void |
setHttpClient(org.apache.http.client.HttpClient httpClient)
Assign an
HttpClient that this object should use. |
void |
setHttpClientSessionManager(HttpClientSessionManager client)
Assign an
HttpClientSessionManager that this object should use. |
void |
setPassThroughEnabled(Boolean passThroughEnabled)
Set the passThroughEnabled configuration.
|
void |
setUsernameAndPassword(String username,
String password)
Set the username and password to use for authenticating with the remote repository.
|
protected void |
shutDownInternal() |
String |
toString() |
init, initialize, isInitialized, shutDownclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetSesameClient, setSesameClientpublic SPARQLRepository(String endpointUrl)
endpointUrl - a SPARQL endpoint URL. May not be null.public SPARQLRepository(String queryEndpointUrl, String updateEndpointUrl)
queryEndpointUrl - a SPARQL endpoint URL for queries. May not be null.updateEndpointUrl - a SPARQL endpoint URL for updates. May not be null.IllegalArgumentException - if one of the supplied endpoint URLs is null.public 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 final 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 httpClient)
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 SPARQLProtocolSession createSPARQLProtocolSession()
SPARQLProtocolSession object. The life-cycle of this is per-connection.@Deprecated protected SPARQLProtocolSession createHTTPClient()
createSPARQLProtocolSession() insteadpublic RepositoryConnection 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.public File getDataDir()
RepositorygetDataDir in interface Repositorypublic ValueFactory getValueFactory()
RepositorygetValueFactory in interface Repositoryprotected void initializeInternal()
throws RepositoryException
initializeInternal in class AbstractRepositoryRepositoryExceptionpublic boolean isWritable()
throws RepositoryException
RepositoryisWritable in interface RepositoryRepositoryExceptionpublic void setDataDir(File dataDir)
RepositorysetDataDir in interface RepositorydataDir - the directory where data for this repository is storedpublic void setUsernameAndPassword(String username, String password)
username - the username. Setting this to null will disable authentication.password - the password. Setting this to null will disable authentication.protected void shutDownInternal()
throws RepositoryException
shutDownInternal in class AbstractRepositoryRepositoryExceptionpublic Map<String,String> getAdditionalHttpHeaders()
public void setAdditionalHttpHeaders(Map<String,String> additionalHttpHeaders)
getConnection().additionalHttpHeaders - a map containing pairs of header names and values. May be nullpublic void enableQuadMode(boolean flag)
SPARQLRepository, i.e. for retrieval of statements also retrieve the graph.
Note: the setting is only applied in newly created SPARQLConnections as the setting is an immutable
configuration of a connection instance.
flag - flag to enable or disable the quad modeRepositoryConnection.getStatements(org.eclipse.rdf4j.model.Resource, org.eclipse.rdf4j.model.URI,
org.eclipse.rdf4j.model.Value, boolean, org.eclipse.rdf4j.model.Resource...)public Boolean getPassThroughEnabled()
RepositoryConnections.null if not explicitly configured.SPARQLProtocolSession.isPassThroughEnabled()public void setPassThroughEnabled(Boolean passThroughEnabled)
RepositoryConnections, but not of existing ones.passThroughEnabled - the passThroughEnabled to setSPARQLProtocolSession#setPassThroughEnabled()Copyright © 2015-2022 Eclipse Foundation. All Rights Reserved.