Class StardogRepositoryConnection
- java.lang.Object
-
- org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
-
- com.complexible.stardog.rdf4j.StardogRepositoryConnection
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,org.eclipse.rdf4j.repository.RepositoryConnection
public final class StardogRepositoryConnection extends org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
Stardog-based implementation of an RDF4J RepositoryConnection. Leaving
autoCommit
turned ON will yield sub-optimal performance with Stardog because of the overhead of pushing many single statement transactions. It is therefore highly recommended to use thebegin()
andcommit()
/rollback()
methods to group operations into transactions unless absolutely required by your applicationThese connections keep a local cache of changes which are not pushed until they exceed a threshold, or an action, such as a query or a commit, requires them to be pushed to the server. This minimizes the overhead of calling add or remove in a tight loop with small payloads and then committing the entire thing, those updates would then be pushed in as few chunks as possible.
All queries created via this connection will implement the accessors for a query's
maxQueryTime
as no ops. The methods will work in that they will not throw anUnsupportedOperationException
, however, they are not supported by Stardog. Timeouts cannot be controlled on a per-query basis, they are global server options.Each of the specific
prepare*Query
methods, such asAbstractRepositoryConnection.prepareGraphQuery(org.eclipse.rdf4j.query.QueryLanguage, String)
will parse the query during invocation, but it will not be type checked until execution time. For example, you can provide a valid ASK query toprepareGraphQuery
and it will not fail that you're using a boolean query as a graph query until its executed. This is similar to how HTTPRepository handles this situation.- Since:
- 0.1
- Version:
- 5.0
- Author:
- Michael Grove
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addWithoutCommit(org.eclipse.rdf4j.model.Resource theSubj, org.eclipse.rdf4j.model.IRI thePred, org.eclipse.rdf4j.model.Value theObj, org.eclipse.rdf4j.model.Resource... theContexts)
void
begin()
void
clearNamespaces()
void
close()
void
commit()
void
exportStatements(org.eclipse.rdf4j.model.Resource theSubj, org.eclipse.rdf4j.model.IRI thePred, org.eclipse.rdf4j.model.Value theObj, boolean theIncludeInferred, org.eclipse.rdf4j.rio.RDFHandler theRDFHandler, org.eclipse.rdf4j.model.Resource... theContexts)
org.eclipse.rdf4j.repository.RepositoryResult<org.eclipse.rdf4j.model.Resource>
getContextIDs()
java.lang.String
getNamespace(java.lang.String s)
org.eclipse.rdf4j.repository.RepositoryResult<org.eclipse.rdf4j.model.Namespace>
getNamespaces()
org.eclipse.rdf4j.repository.RepositoryResult<org.eclipse.rdf4j.model.Statement>
getStatements(org.eclipse.rdf4j.model.Resource theSubj, org.eclipse.rdf4j.model.IRI thePred, org.eclipse.rdf4j.model.Value theObj, boolean theIncludeInferred, org.eclipse.rdf4j.model.Resource... theContexts)
org.eclipse.rdf4j.repository.RepositoryResult<org.eclipse.rdf4j.model.Statement>
getStatements(org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, org.eclipse.rdf4j.model.Resource... contexts)
boolean
hasStatement(org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, boolean includeInferred, org.eclipse.rdf4j.model.Resource... contexts)
boolean
hasStatement(org.eclipse.rdf4j.model.Statement st, boolean includeInferred, org.eclipse.rdf4j.model.Resource... contexts)
boolean
isActive()
org.eclipse.rdf4j.query.BooleanQuery
prepareBooleanQuery(org.eclipse.rdf4j.query.QueryLanguage theQueryLanguage, java.lang.String theQuery, java.lang.String theBase)
org.eclipse.rdf4j.query.GraphQuery
prepareGraphQuery(org.eclipse.rdf4j.query.QueryLanguage theQueryLanguage, java.lang.String theQuery, java.lang.String theBase)
org.eclipse.rdf4j.query.Query
prepareQuery(org.eclipse.rdf4j.query.QueryLanguage theQueryLanguage, java.lang.String theQuery, java.lang.String theBase)
org.eclipse.rdf4j.query.TupleQuery
prepareTupleQuery(org.eclipse.rdf4j.query.QueryLanguage theQueryLanguage, java.lang.String theQuery, java.lang.String theBase)
org.eclipse.rdf4j.query.Update
prepareUpdate(org.eclipse.rdf4j.query.QueryLanguage theQueryLanguage, java.lang.String theQuery, java.lang.String theBase)
void
removeNamespace(java.lang.String thePrefix)
protected void
removeWithoutCommit(org.eclipse.rdf4j.model.Resource theSubj, org.eclipse.rdf4j.model.IRI thePred, org.eclipse.rdf4j.model.Value theObj, org.eclipse.rdf4j.model.Resource... theContexts)
void
rollback()
void
setIsolationLevel(org.eclipse.rdf4j.IsolationLevel level)
void
setNamespace(java.lang.String thePrefix, java.lang.String theNS)
long
size(org.eclipse.rdf4j.model.Resource... theContexts)
-
Methods inherited from class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
add, add, add, add, add, add, add, add, addWithoutCommit, begin, clear, conditionalCommit, conditionalRollback, export, getIsolationLevel, getParserConfig, getRepository, getValueFactory, isAutoCommit, isEmpty, isOpen, prepareBooleanQuery, prepareGraphQuery, prepareQuery, prepareTupleQuery, prepareUpdate, remove, remove, remove, remove, removeWithoutCommit, setAutoCommit, setParserConfig, startLocalTransaction
-
-
-
-
Method Detail
-
begin
public void begin() throws org.eclipse.rdf4j.repository.RepositoryException
- Throws:
org.eclipse.rdf4j.repository.RepositoryException
-
isActive
public boolean isActive() throws org.eclipse.rdf4j.repository.RepositoryException
- Throws:
org.eclipse.rdf4j.repository.RepositoryException
-
close
public void close() throws org.eclipse.rdf4j.repository.RepositoryException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceorg.eclipse.rdf4j.repository.RepositoryConnection
- Overrides:
close
in classorg.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
- Throws:
org.eclipse.rdf4j.repository.RepositoryException
-
setIsolationLevel
public void setIsolationLevel(org.eclipse.rdf4j.IsolationLevel level) throws java.lang.IllegalStateException
- Specified by:
setIsolationLevel
in interfaceorg.eclipse.rdf4j.repository.RepositoryConnection
- Overrides:
setIsolationLevel
in classorg.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
- Throws:
java.lang.IllegalStateException
-
addWithoutCommit
protected void addWithoutCommit(org.eclipse.rdf4j.model.Resource theSubj, org.eclipse.rdf4j.model.IRI thePred, org.eclipse.rdf4j.model.Value theObj, org.eclipse.rdf4j.model.Resource... theContexts) throws org.eclipse.rdf4j.repository.RepositoryException
- Specified by:
addWithoutCommit
in classorg.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
- Throws:
org.eclipse.rdf4j.repository.RepositoryException
-
removeWithoutCommit
protected void removeWithoutCommit(org.eclipse.rdf4j.model.Resource theSubj, org.eclipse.rdf4j.model.IRI thePred, org.eclipse.rdf4j.model.Value theObj, org.eclipse.rdf4j.model.Resource... theContexts) throws org.eclipse.rdf4j.repository.RepositoryException
- Specified by:
removeWithoutCommit
in classorg.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
- Throws:
org.eclipse.rdf4j.repository.RepositoryException
-
prepareQuery
public org.eclipse.rdf4j.query.Query prepareQuery(org.eclipse.rdf4j.query.QueryLanguage theQueryLanguage, java.lang.String theQuery, java.lang.String theBase) throws org.eclipse.rdf4j.repository.RepositoryException, org.eclipse.rdf4j.query.MalformedQueryException
- Throws:
org.eclipse.rdf4j.repository.RepositoryException
org.eclipse.rdf4j.query.MalformedQueryException
-
prepareTupleQuery
public org.eclipse.rdf4j.query.TupleQuery prepareTupleQuery(org.eclipse.rdf4j.query.QueryLanguage theQueryLanguage, java.lang.String theQuery, java.lang.String theBase) throws org.eclipse.rdf4j.repository.RepositoryException, org.eclipse.rdf4j.query.MalformedQueryException
- Throws:
org.eclipse.rdf4j.repository.RepositoryException
org.eclipse.rdf4j.query.MalformedQueryException
-
prepareGraphQuery
public org.eclipse.rdf4j.query.GraphQuery prepareGraphQuery(org.eclipse.rdf4j.query.QueryLanguage theQueryLanguage, java.lang.String theQuery, java.lang.String theBase) throws org.eclipse.rdf4j.repository.RepositoryException, org.eclipse.rdf4j.query.MalformedQueryException
- Throws:
org.eclipse.rdf4j.repository.RepositoryException
org.eclipse.rdf4j.query.MalformedQueryException
-
prepareBooleanQuery
public org.eclipse.rdf4j.query.BooleanQuery prepareBooleanQuery(org.eclipse.rdf4j.query.QueryLanguage theQueryLanguage, java.lang.String theQuery, java.lang.String theBase) throws org.eclipse.rdf4j.repository.RepositoryException, org.eclipse.rdf4j.query.MalformedQueryException
- Throws:
org.eclipse.rdf4j.repository.RepositoryException
org.eclipse.rdf4j.query.MalformedQueryException
-
prepareUpdate
public org.eclipse.rdf4j.query.Update prepareUpdate(org.eclipse.rdf4j.query.QueryLanguage theQueryLanguage, java.lang.String theQuery, java.lang.String theBase) throws org.eclipse.rdf4j.repository.RepositoryException, org.eclipse.rdf4j.query.MalformedQueryException
- Throws:
org.eclipse.rdf4j.repository.RepositoryException
org.eclipse.rdf4j.query.MalformedQueryException
-
getContextIDs
public org.eclipse.rdf4j.repository.RepositoryResult<org.eclipse.rdf4j.model.Resource> getContextIDs() throws org.eclipse.rdf4j.repository.RepositoryException
- Throws:
org.eclipse.rdf4j.repository.RepositoryException
-
getStatements
public org.eclipse.rdf4j.repository.RepositoryResult<org.eclipse.rdf4j.model.Statement> getStatements(org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, org.eclipse.rdf4j.model.Resource... contexts) throws org.eclipse.rdf4j.repository.RepositoryException
- Throws:
org.eclipse.rdf4j.repository.RepositoryException
-
getStatements
public org.eclipse.rdf4j.repository.RepositoryResult<org.eclipse.rdf4j.model.Statement> getStatements(org.eclipse.rdf4j.model.Resource theSubj, org.eclipse.rdf4j.model.IRI thePred, org.eclipse.rdf4j.model.Value theObj, boolean theIncludeInferred, org.eclipse.rdf4j.model.Resource... theContexts) throws org.eclipse.rdf4j.repository.RepositoryException
- Throws:
org.eclipse.rdf4j.repository.RepositoryException
-
hasStatement
public boolean hasStatement(org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, boolean includeInferred, org.eclipse.rdf4j.model.Resource... contexts) throws org.eclipse.rdf4j.repository.RepositoryException
- Specified by:
hasStatement
in interfaceorg.eclipse.rdf4j.repository.RepositoryConnection
- Overrides:
hasStatement
in classorg.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
- Throws:
org.eclipse.rdf4j.repository.RepositoryException
-
hasStatement
public boolean hasStatement(org.eclipse.rdf4j.model.Statement st, boolean includeInferred, org.eclipse.rdf4j.model.Resource... contexts)
- Specified by:
hasStatement
in interfaceorg.eclipse.rdf4j.repository.RepositoryConnection
- Overrides:
hasStatement
in classorg.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
-
exportStatements
public void exportStatements(org.eclipse.rdf4j.model.Resource theSubj, org.eclipse.rdf4j.model.IRI thePred, org.eclipse.rdf4j.model.Value theObj, boolean theIncludeInferred, org.eclipse.rdf4j.rio.RDFHandler theRDFHandler, org.eclipse.rdf4j.model.Resource... theContexts) throws org.eclipse.rdf4j.repository.RepositoryException, org.eclipse.rdf4j.rio.RDFHandlerException
- Throws:
org.eclipse.rdf4j.repository.RepositoryException
org.eclipse.rdf4j.rio.RDFHandlerException
-
size
public long size(org.eclipse.rdf4j.model.Resource... theContexts) throws org.eclipse.rdf4j.repository.RepositoryException
- Throws:
org.eclipse.rdf4j.repository.RepositoryException
-
commit
public void commit() throws org.eclipse.rdf4j.repository.RepositoryException
- Throws:
org.eclipse.rdf4j.repository.RepositoryException
-
rollback
public void rollback() throws org.eclipse.rdf4j.repository.RepositoryException
- Throws:
org.eclipse.rdf4j.repository.RepositoryException
-
getNamespaces
public org.eclipse.rdf4j.repository.RepositoryResult<org.eclipse.rdf4j.model.Namespace> getNamespaces() throws org.eclipse.rdf4j.repository.RepositoryException
- Throws:
org.eclipse.rdf4j.repository.RepositoryException
-
getNamespace
public java.lang.String getNamespace(java.lang.String s) throws org.eclipse.rdf4j.repository.RepositoryException
- Throws:
org.eclipse.rdf4j.repository.RepositoryException
-
setNamespace
public void setNamespace(java.lang.String thePrefix, java.lang.String theNS) throws org.eclipse.rdf4j.repository.RepositoryException, java.lang.NullPointerException
- Throws:
org.eclipse.rdf4j.repository.RepositoryException
java.lang.NullPointerException
-
removeNamespace
public void removeNamespace(java.lang.String thePrefix) throws org.eclipse.rdf4j.repository.RepositoryException
- Throws:
org.eclipse.rdf4j.repository.RepositoryException
-
clearNamespaces
public void clearNamespaces() throws org.eclipse.rdf4j.repository.RepositoryException
- Throws:
org.eclipse.rdf4j.repository.RepositoryException
-
-