public interface Connection extends AutoCloseable
Interface for a connection to a Stardog database. Connections should be obtained via a
LoginConnectionConfiguration which is used to build the appropriate connection string
to the database.
Connection objects are not meant to be shared between threads and simple synchronization on the
object itself is usually insufficient due to the possible use of ancillary objects such as
Adder or IO which can change the state of the Connection, possibly outside the bounds
of the synchronization.
However, concurrent reads from different threads is safe when there is no open transaction.
Adder,
Remover,
IO,
LoginConnectionConfiguration,
Namespaces| Modifier and Type | Method and Description |
|---|---|
Adder |
add()
Create an Adder for adding statements to the database
|
AdminConnection |
admin()
Returns an instance of the
AdminConnection class that can be used to perform administrative functions. |
<T extends Connection> |
as(Class<T> theView)
Return this connection viewed as a different type of connection.
|
BooleanQuery |
ask(String theQuery)
Create a SPARQL ask query against the database
|
BooleanQuery |
ask(String theQuery,
String theBase)
Create a SPARQL ask query against the database
|
UUID |
begin()
Start a new transaction.
|
void |
close()
Close this connection.
|
CommitResult |
commit()
Commit the current transaction.
|
Map<String,Object> |
currentStatus()
Return the current status of the database
|
Exporter |
export()
Create an
Exporter to export RDF from the database |
Getter |
get()
Create a Getter for retrieving statements from the database
|
default <T> T |
getOption(MetaProperty<T> theOption)
Gets the value of the specified option for the current database.
|
GraphQuery |
graph(String theQuery)
Create a SPARQL graph query against the database
|
GraphQuery |
graph(String theQuery,
String theBase)
Create a SPARQL graph query against the database
|
boolean |
isOpen()
Return whether or not this connection is open.
|
boolean |
isReasoningEnabled()
Return whether reasoning is enabled for this connection.
|
String |
name()
Return the name of the database this object is connected to
|
NamespacesInfo |
namespaces() |
PathQuery |
paths(String theQuery)
Create a path query against the database
|
PathQuery |
paths(String theQuery,
String theBase)
Create a path query against the database
|
Remover |
remove()
Create a Remover for removing statements from the database
|
void |
rollback()
Rollback the current transaction.
|
SelectQuery |
select(String theQuery)
Create a SPARQL select query against the database
|
SelectQuery |
select(String theQuery,
String theBase)
Create a SPARQL select query against the database
|
long |
size()
Return the size of the database.
|
Collection<TxInfo> |
transactions()
Returns an immutable collection of info objects for the open transactions in this database on the server-side.
|
UpdateQuery |
update(String theQuery)
Create a SPARQL update query against the database
|
UpdateQuery |
update(String theQuery,
String theBase)
Create a SPARQL update query against the database
|
<T extends Connection> T as(Class<T> theView) throws StardogException
T - the connection view to returntheView - the type of connection to view this object asStardogException - if the connection cannot be viewed as the provided type. This could be from the parent connection
having been closed or it does not support the provided view.Adder add() throws StardogException
StardogException - if there is an error obtaining the adderRemover remove() throws StardogException
StardogException - if there is an error obtaining the removerGetter get() throws StardogException
StardogException - if there is an error obtaining the getterSelectQuery select(String theQuery) throws StardogException
theQuery - the query stringStardogException - if there was an error while creating the querySelectQuery select(String theQuery, String theBase) throws StardogException
theQuery - the query stringtheBase - the base URI to use when parsing the queryStardogException - if there was an error while creating the queryGraphQuery graph(String theQuery) throws StardogException
theQuery - the query stringStardogException - if there was an error while creating the queryGraphQuery graph(String theQuery, String theBase) throws StardogException
theQuery - the query stringtheBase - the base URI to use when parsing the queryStardogException - if there was an error while creating the queryPathQuery paths(String theQuery) throws StardogException
theQuery - the query stringStardogException - if there was an error while creating the queryPathQuery paths(String theQuery, String theBase) throws StardogException
theQuery - the query stringtheBase - the base URI to use when parsing the queryStardogException - if there was an error while creating the queryBooleanQuery ask(String theQuery) throws StardogException
theQuery - the query stringStardogException - if there was an error while creating the queryBooleanQuery ask(String theQuery, String theBase) throws StardogException
theQuery - the query stringtheBase - the base URI to use when parsing the queryStardogException - if there was an error while creating the queryUpdateQuery update(String theQuery) throws StardogException
theQuery - the query stringStardogException - if there was an error while creating the queryUpdateQuery update(String theQuery, String theBase) throws StardogException
theQuery - the query stringtheBase - the base URI to use when parsing the queryStardogException - if there was an error while creating the queryUUID begin() throws StardogException
Start a new transaction. This is the required step before making any updates through this connection.
Note that, the transaction on the server might not be started immediately when this function is called. The client connection may delay beginning the actual transaction on the server until a later time when a read or write operation is done.
StardogException - if there was an error while creating the transaction or if there
is already an active transaction for this connection.void rollback()
throws StardogException
StardogException - if there was an error while rolling back the transaction or
if a transaction is not active.CommitResult commit() throws StardogException
StardogException - the transaction failed to commit. In this case, it is automatically
rolled back and the error merely indicates the cause, no additional
cleanup action is required.void close()
throws StardogException
close in interface AutoCloseableStardogException - if there was an error while closingboolean isOpen()
throws IllegalStateException
IllegalStateException - if there was an error with the connectionNamespacesInfo namespaces() throws StardogException
StardogException - if there was an error with the connectionThe logged in user should have read access to database metadata for this function to return successfully.
Collection<TxInfo> transactions() throws StardogException
Returns an immutable collection of info objects for the open transactions in this database on the server-side. The transactions open on the client-side but not yet sent to the server will not be included in the results even if the transaction is started by this connection.
The logged in user can see only the transactions he/she started. The superusers can see all open transactions.
StardogException - if there was an error with the connectionAdminConnection admin() throws StardogException
AdminConnection class that can be used to perform administrative functions. The
server URL and the credentials used for the current connection will be used to login to the server. The
AdminConnection will be active unless the user AdminConnection.close() logs out} explicitly or
closes this connection. The same AdminConnection will be returned by this function as long as it stays
active.StardogException - if there was an error creating the AdminConnection instancedefault <T> T getOption(MetaProperty<T> theOption) throws StardogException
AdminConnection.get(String, MetaProperty)T - type of the option valuetheOption - the option to getnullStardogException - if there was an error while getting the valuelong size() throws StardogException
StardogException - if there is an error returning the size of the db.Exporter export() throws StardogException
Exporter to export RDF from the databaseExporterStardogException - if the Exporter could not be created.boolean isReasoningEnabled()
throws StardogException
StardogException - if the reasoning flag could not be obtainedMap<String,Object> currentStatus() throws StardogException
StardogException - if the status information could not be retrievedString name()
Copyright © 2010-2016 Stardog Union. All Rights Reserved.