A connection to an RDF Sail object. A SailConnection is active from the moment it is created until it is closed. Care
should be taken to properly close SailConnections as they might block concurrent queries and/or updates on the Sail
while active, depending on the Sail-implementation that is being used.

getStatements

Gets all statements from the specified contexts that have a specific subject, predicate and/or object. All three
parameters may be null to indicate wildcards. The includeInferred parameter can be used to control which
statements are fetched: all statements or only the statements that have been added explicitly.

Parameters:

subj - A Resource specifying the subject, or null for a wildcard.

pred - A URI specifying the predicate, or null for a wildcard.

obj - A Value specifying the object, or null for a wildcard.

includeInferred - if false, no inferred statements are returned; if true, inferred statements are returned
if available

contexts - The context(s) to get the data from. Note that this parameter is a vararg and as such is
optional. If no contexts are specified the method operates on the entire repository. A
null value can be used to match context-less statements.

Returns:

The statements matching the specified pattern.

Throws:

SailException - If the Sail object encountered an error or unexpected situation internally.

hasStatement

Determines if the store contains any statements from the specified contexts that have a specific subject,
predicate and/or object. All three parameters may be null to indicate wildcards. The includeInferred
parameter can be used to control which statements are checked: all statements or only the statements that have
been added explicitly.

Parameters:

subj - A Resource specifying the subject, or null for a wildcard.

pred - An IRI specifying the predicate, or null for a wildcard.

obj - A Value specifying the object, or null for a wildcard.

includeInferred - if false, no inferred statements are returned; if true, inferred statements are returned
if available

contexts - The context(s) to get the data from. Note that this parameter is a vararg and as such is
optional. If no contexts are specified the method operates on the entire repository. A
null value can be used to match context-less statements.

size

Returns the number of (explicit) statements in the store, or in specific contexts.

Parameters:

contexts - The context(s) to determine the size of. Note that this parameter is a vararg and as such is
optional. If no contexts are specified the method operates on the entire repository. A
null value can be used to match context-less statements.

Returns:

The number of explicit statements in this store, or in the specified context(s).

flush

Flushes any pending updates and notify changes to listeners as appropriate. This is an optional call; calling or
not calling this method should have no effect on the outcome of other calls. This method exists to give the
caller more control over the efficiency when calling prepare(). This method may be called multiple times
within the same transaction.

Throws:

SailException - If the updates could not be processed, for example because no transaction is
active.

prepare

Checks for an error state in the active transaction that would force the transaction to be rolled back. This is
an optional call; calling or not calling this method should have no effect on the outcome of commit() or
rollback(). A call to this method must be followed by (in the same thread) with a call to
prepare() , commit(), rollback(), or close() . This method may be called
multiple times within the same transaction by the same thread. If this method returns normally, the caller can
reasonably expect that a subsequent call to commit() will also return normally. If this method returns
with an exception the caller should treat the exception as if it came from a call to commit().

Throws:

UnknownSailTransactionStateException - If the transaction state can not be determined (this can happen for
instance when communication between client and server fails or
times-out). It does not indicate a problem with the integrity of the
store.

SailException - If there is an active transaction and it cannot be committed.

IllegalStateException - If the connection has been closed or prepare was already called by
another thread.

commit

Commits any updates that have been performed since the last time commit() or rollback() was
called.

Throws:

UnknownSailTransactionStateException - If the transaction state can not be determined (this can happen for
instance when communication between client and server fails or
times-out). It does not indicate a problem with the integrity of the
store.

rollback

Rolls back the transaction, discarding any uncommitted changes that have been made in this SailConnection.

Throws:

UnknownSailTransactionStateException - If the transaction state can not be determined (this can happen for
instance when communication between client and server fails or
times-out). It does not indicate a problem with the integrity of the
store.

removeStatements

Removes all statements matching the specified subject, predicate and object from the repository. All three
parameters may be null to indicate wildcards.

Parameters:

subj - The subject of the statement that should be removed, or null to indicate a wildcard.

pred - The predicate of the statement that should be removed, or null to indicate a wildcard.

obj - The object of the statement that should be removed , or null to indicate a wildcard. *

contexts - The context(s) from which to remove the statement. Note that this parameter is a vararg and as
such is optional. If no contexts are specified the method operates on the entire repository. A
null value can be used to match context-less statements.

Throws:

SailException - If the statement could not be removed, for example because no transaction is
active.

removeStatement

Removes all statements matching the specified subject, predicate and object from the repository. All three
parameters may be null to indicate wildcards. Called when removing statements through a UpdateExpr
operation.

contexts - The context(s) from which to remove the statement. Note that this parameter is a vararg and as
such is optional. If no contexts are specified the method operates on the entire repository. A
null value can be used to match context-less statements.

Throws:

SailException - If the statement could not be removed, for example because no transaction is
active.

clear

Removes all statements from the specified/all contexts. If no contexts are specified the method operates on the
entire repository.

Parameters:

contexts - The context(s) from which to remove the statements. Note that this parameter is a vararg and as
such is optional. If no contexts are specified the method operates on the entire repository. A
null value can be used to match context-less statements.