public final class KernelDatabaseConnection extends com.complexible.stardog.api.impl.AbstractConnection implements Connection
A wrapper around the Kernel via DatabaseConnection to provide an adapter for Connection so that it can be used in an "embedded" mode where you're
interacting with the kernel directly without a server involved.
| Modifier and Type | Method and Description |
|---|---|
protected BooleanQueryResult |
_ask(BooleanQuery theQuery) |
protected UUID |
_begin() |
protected void |
_close() |
protected CommitResult |
_commit() |
protected GraphQueryResult |
_graph(GraphQuery theQuery) |
protected PathQueryResult |
_paths(PathQuery theQuery) |
protected InputStream |
_read(ReadQuery<?> theQuery,
FileFormat theFormat) |
protected void |
_rollback() |
protected SelectQueryResult |
_select(SelectQuery theQuery) |
protected SelectQueryResult |
_selectPlan(SelectPlanQuery theQuery) |
protected void |
_update(UpdateQuery theQuery) |
AdminConnection |
admin()
Returns an instance of the
AdminConnection class that can be used to perform administrative functions. |
protected CommitResult |
applyChanges(ChangeList<com.complexible.stardog.api.impl.ConnectionChangeType,Object> theChanges,
boolean andCommit) |
BooleanQuery |
ask(String theQuery,
String theBase)
Create a SPARQL ask query against the database
|
<T> T |
call(com.google.common.base.Supplier<T> theSupplier) |
void |
cleanupTx(boolean theClose) |
com.complexible.stardog.db.DatabaseConnection |
connection(String theReasoningSchema,
boolean theRW) |
com.complexible.stardog.db.DatabaseConnection |
connection(String theReasoningSchema,
Options theOptions,
boolean theRW) |
Map<String,Object> |
currentStatus()
Return the current status of the database
|
protected String |
explain(Query<?> theQuery,
Options theOptions) |
Exporter |
export()
Create an
Exporter to export RDF from the database |
com.stardog.model.DataModel |
generateModel(com.stardog.model.DataModelFormat theInputFormat,
Options theOptions)
Generates n
data model from the database. |
com.complexible.stardog.Kernel |
getKernel() |
String |
getName() |
GraphQuery |
graph(String theQuery,
String theBase)
Create a SPARQL graph query against the database
|
com.complexible.stardog.query.GraphAliases |
graphAliases()
Get graph aliases for this database.
|
boolean |
isOpen()
Return whether or not this connection is open.
|
boolean |
isStrictParsing()
In embedded mode this function returns the value of `strict.parsing` database option since there is no client/server separation.
|
NamespacesInfo |
namespaces() |
Options |
options() |
PathQuery |
paths(String theQuery,
String theBase)
Create a path query against the database
|
void |
run(Runnable theAction) |
SelectQuery |
select(String theQuery,
String theBase)
Create a SPARQL select query against the database
|
SelectPlanQuery |
selectPlan(String theQuery,
String theBase)
Create a plan query against the database
|
long |
size()
Return size of the database.
|
com.complexible.common.rdf.impl.StreamStatementSources.StatementSourceCreator |
statementSourceCreator() |
static com.complexible.stardog.query.UpdateQuery |
toUpdateQuery(com.complexible.stardog.db.DatabaseConnection theConnection,
UpdateQuery theQuery) |
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,
String theBase)
Create a SPARQL update query against the database
|
add, as, ask, assertInTransaction, assertNotInTransaction, assertOpen, begin, cleanupPendingChanges, close, close, commit, executeAsk, executeGraph, executeReadQuery, executeSelect, executeSelectPlan, executeUpdate, explain, get, getDefaultParserConfig, getSchema, graph, isInTransaction, isReasoningEnabled, name, paths, pushOutstanding, pushOutstandingAndCommit, remove, rollback, select, selectPlan, updatepublic com.complexible.common.rdf.impl.StreamStatementSources.StatementSourceCreator statementSourceCreator()
statementSourceCreator in class com.complexible.stardog.api.impl.AbstractConnectionpublic com.complexible.stardog.db.DatabaseConnection connection(String theReasoningSchema, boolean theRW)
public com.complexible.stardog.db.DatabaseConnection connection(String theReasoningSchema, Options theOptions, boolean theRW)
public String getName()
public Options options()
public <T> T call(com.google.common.base.Supplier<T> theSupplier)
public void run(Runnable theAction)
public Map<String,Object> currentStatus() throws StardogException
currentStatus in interface ConnectionStardogException - if the status information could not be retrievedpublic boolean isOpen()
throws IllegalStateException
isOpen in interface ConnectionisOpen in class com.complexible.stardog.api.impl.AbstractConnectionIllegalStateException - if there was an error with the connectionprotected UUID _begin() throws StardogException
_begin in class com.complexible.stardog.api.impl.AbstractConnectionStardogExceptionpublic NamespacesInfo namespaces() throws StardogException
namespaces in interface ConnectionStardogException - if there was an error with the connectionpublic Collection<TxInfo> transactions() throws StardogException
ConnectionReturns 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.
transactions in interface ConnectionStardogException - if there was an error with the connectionpublic boolean isStrictParsing()
isStrictParsing in class com.complexible.stardog.api.impl.AbstractConnectionprotected CommitResult _commit() throws StardogException
_commit in class com.complexible.stardog.api.impl.AbstractConnectionStardogExceptionpublic void cleanupTx(boolean theClose)
cleanupTx in class com.complexible.stardog.api.impl.AbstractConnectionprotected void _rollback()
throws StardogException
_rollback in class com.complexible.stardog.api.impl.AbstractConnectionStardogExceptionprotected void _close()
throws StardogException
_close in class com.complexible.stardog.api.impl.AbstractConnectionStardogExceptionprotected CommitResult applyChanges(ChangeList<com.complexible.stardog.api.impl.ConnectionChangeType,Object> theChanges, boolean andCommit) throws StardogException
applyChanges in class com.complexible.stardog.api.impl.AbstractConnectionStardogExceptionprotected SelectQueryResult _select(SelectQuery theQuery)
_select in class com.complexible.stardog.api.impl.AbstractConnectionprotected SelectQueryResult _selectPlan(SelectPlanQuery theQuery)
_selectPlan in class com.complexible.stardog.api.impl.AbstractConnectionprotected BooleanQueryResult _ask(BooleanQuery theQuery)
_ask in class com.complexible.stardog.api.impl.AbstractConnectionprotected GraphQueryResult _graph(GraphQuery theQuery)
_graph in class com.complexible.stardog.api.impl.AbstractConnectionprotected InputStream _read(ReadQuery<?> theQuery, FileFormat theFormat)
_read in class com.complexible.stardog.api.impl.AbstractConnectionprotected PathQueryResult _paths(PathQuery theQuery)
_paths in class com.complexible.stardog.api.impl.AbstractConnectionprotected void _update(UpdateQuery theQuery)
_update in class com.complexible.stardog.api.impl.AbstractConnectionpublic static com.complexible.stardog.query.UpdateQuery toUpdateQuery(com.complexible.stardog.db.DatabaseConnection theConnection,
UpdateQuery theQuery)
protected String explain(Query<?> theQuery, Options theOptions)
explain in class com.complexible.stardog.api.impl.AbstractConnectionpublic SelectQuery select(String theQuery, String theBase) throws StardogException
select in interface ConnectiontheQuery - the query stringtheBase - the base URI to use when parsing the queryStardogException - if there was an error while creating the querypublic SelectPlanQuery selectPlan(String theQuery, String theBase) throws StardogException
selectPlan in interface ConnectiontheQuery - the plan stringtheBase - the base URI to use when parsing the queryStardogException - if there was an error while creating the querypublic GraphQuery graph(String theQuery, String theBase) throws StardogException
graph in interface ConnectiontheQuery - the query stringtheBase - the base URI to use when parsing the queryStardogException - if there was an error while creating the querypublic PathQuery paths(String theQuery, String theBase) throws StardogException
paths in interface ConnectiontheQuery - the query stringtheBase - the base URI to use when parsing the queryStardogException - if there was an error while creating the querypublic BooleanQuery ask(String theQuery, String theBase) throws StardogException
ask in interface ConnectiontheQuery - the query stringtheBase - the base URI to use when parsing the queryStardogException - if there was an error while creating the querypublic UpdateQuery update(String theQuery, String theBase) throws StardogException
update in interface ConnectiontheQuery - the query stringtheBase - the base URI to use when parsing the queryStardogException - if there was an error while creating the querypublic AdminConnection 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.admin in interface ConnectionStardogException - if there was an error creating the AdminConnection instancepublic long size()
throws StardogException
ConnectionConfiguration.EXACT_SIZE parameter or not. By default it is not and then the result will be an approximation of the current number
of statements in the database. Quality of that approximation is generally not guaranteed and it depends on past transactional history such as
adding statements which already existed at that point or removing statements which did not.
If ConnectionConfiguration.EXACT_SIZE is enabled for the connection, the result of this method will be equal to the result of a query
which would count all statements in all named graphs of the database (in particular, it will also account for uncommitted changes made through
this connection). Warning: this could be expensive for large databases which is the main reason why this is not the default behavior.size in interface ConnectionStardogException - if there is an error returning the size of the db.public Exporter export() throws StardogException
Exporter to export RDF from the databaseexport in interface ConnectionExporterStardogException - if the Exporter could not be created.public com.stardog.model.DataModel generateModel(com.stardog.model.DataModelFormat theInputFormat,
Options theOptions)
throws StardogException
Connectiondata model from the database. The model can be generated from a variety of
different input sources and the resulting model can be significantly different based on the input source used.
OWL: The RDFS and OWL definitions in the database are used to generate the model. Requires reasoning to be enabled. A
reasoning schema name can be specified in the reasoning connection. Every class in the schema becomes a Class and every
property with a domain becomes a Property.SHACL: The SHACL constraints in the database are used to generate the model. Every shape with a targetClass
becomes a Class and the property shapes defined on those shapes are turned into a Property.generateModel in interface ConnectionStardogException - if the model could not be created.public com.complexible.stardog.Kernel getKernel()
public com.complexible.stardog.query.GraphAliases graphAliases()
ConnectionGraphAliases object returned from this method. Uncommitted changes made through the same connection but directly in the
data (e.g. using the Adder object) may not be visible.graphAliases in interface ConnectionCopyright © 2010-2016 Stardog Union. All Rights Reserved.