|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Connection
Interface for a connection to a Stardog database. Connections should be obtained via a
ConnectionConfiguration 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,
ConnectionConfiguration,
Namespaces| Method Summary | ||
|---|---|---|
Adder |
add()
Create an Adder for adding statements to the database |
|
|
as(Class<T> theView)
Return this connection viewed as a different type of connection. |
|
void |
begin()
Start a new transaction |
|
void |
close()
Close this connection |
|
void |
commit()
Commit the current transaction. |
|
Getter |
get()
Create a Getter for retrieving statements from the database |
|
boolean |
isAutoCommit()
Deprecated. will be removed in the next major version of Stardog (1.3) |
|
boolean |
isOpen()
Return whether or not this connection is open. |
|
StardogDBMS |
loginDBMS()
Returns an instance of the StardogDBMS class that can be used to perform administrative functions. |
|
Namespaces |
namespaces()
Returns a snapshot of namespaces stored in this database. |
|
Query |
query(String theQuery)
Create a SPARQL query against the database |
|
Query |
query(String theQuery,
String theBaseURI)
Create a SPARQL query against the database |
|
Remover |
remove()
Create a Remover for removing statements from the database |
|
void |
rollback()
Rollback the current transaction. |
|
void |
setAutoCommit(boolean theAutoCommit)
Deprecated. will be removed in the next major version of Stardog (1.3) |
|
long |
size()
Return the size of the database. |
|
| Method Detail |
|---|
<T extends Connection> T as(Class<T> theView)
throws StardogException
T - the connection view to returntheView - the type of connection to view this object as
StardogException - 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 adder
Remover remove()
throws StardogException
StardogException - if there is an error obtaining the remover
Getter get()
throws StardogException
StardogException - if there is an error obtaining the getter
Query query(String theQuery)
throws StardogException
theQuery - the query string
StardogException - if there was an error while creating the query
Query query(String theQuery,
String theBaseURI)
throws StardogException
theQuery - the query stringtheBaseURI - the base URI to use when parsing the query
StardogException - if there was an error while creating the query
void begin()
throws StardogException
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.
void 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
StardogException - if there was an error while closing
boolean isOpen()
throws StardogException
StardogException - if there was an error with the connection
@Deprecated
boolean isAutoCommit()
throws StardogException
StardogException - if there was an error with the connection
@Deprecated
void setAutoCommit(boolean theAutoCommit)
throws StardogException
theAutoCommit - true to be in auto commit mode, false otherwise
StardogException - if there was an error with the connection
Namespaces namespaces()
throws StardogException
Returns a snapshot of namespaces stored in this database. The logged in user should have read access to database
metadata for this function to return succesfully. If the logged in user also has write access to database
metadata, returned namespaces can be modified through add and
remove functions.
Changes done on the returned Namespaces instance will
be applied to database metadata immediately. However, since this function returns a snapshot of stored namespaces
and applies changes to the local copy before applying them to the database metadata, concurrent updates of
namespaces might result in changes performed by one connection to be overridden by another connection.
A new snapshot is retrieved every time this function is called which will take into account any changes that have occurred before this call.
StardogException - if there was an error with the connection
StardogDBMS loginDBMS()
throws StardogException
StardogDBMS 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
StardogDBMS will be active unless the user logs out explicitly or
closes this connection. The same StardogDBMS will be returned by this function as long as it stays
active.
StardogException - if there was an error creating the StardogDBMS instance
long size()
throws StardogException
StardogException - if there is an error returning the size of the db.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||