Interface DataStoreConnection
- All Superinterfaces:
java.lang.AutoCloseable
public interface DataStoreConnection
extends java.lang.AutoCloseable
Encapsulates a connection to an RDFox data store. All instances of this
class are single-threaded — that is, methods should not be called simultaneously on distinct threads, and an
JRDFoxException will be thrown if this requirement is violated. However, there is no thread affinity — that is,
methods on one connection can be called from different threads as long as the calls are serialized externally.
The interrupt() and duplicate() methods are exceptions: they can be invoked in parallel with any other method apart from
close(). Calling close() in parallel with any other method is considered a serious bug in the client code; however,
to safeguard against JVM crashes and aid debugging, RDFox will throw an IllegalStateException. A data store connection
uses transactions to coordinate concurrent access. A connection must be closed after use to release the resources associated with it.-
Field Summary
Fields Modifier and Type Field Description static longWAIT_FOREVERSpecifies that the system should wait forever when it needs to acquire a lock on a data store (seesetLockTimeout(long)). -
Method Summary
Modifier and Type Method Description longaddRule(Rule rule)Adds a rule to the data store.longaddRules(java.util.Collection<Rule> datalogProgram)Adds a collection of rules to the data store.voidbeginTransaction(TransactionType transactionType)Starts a new transaction on this connection.voidclear(int dataStoreParts)Clears the specified parts of the data store.voidclearRulesAxiomsExplicateFacts()Clears all rules and turns all facts in the data store into EDB facts.voidclose()Closes the data store connection by freeing all resources associated with it.voidcommitTransaction()Commits the transaction associated with this connection.voidcompact()Compact the data in the data store.booleancontainsDataSource(java.lang.String dataSourceName)Checks whether the data store contains a data source with the specified name.booleancontainsDataSourceTable(java.lang.String dataSourceName, java.lang.String dataSourceTableName)Checks whether the specified data source in the data store contains a data source table with the specified name.booleancontainsDeltaQuery(java.lang.String deltaQueryName)Checks whether the data store contains a delta query with the specified name.booleancontainsStatistics(java.lang.String statisticsName)Checks whether the data store contains the statistics with the specified name.booleancontainsTupleTable(java.lang.String tupleTableName)Checks whether the data store contains a tuple table with the specified name.CursorcreateCursor(java.lang.String queryText, java.util.Map<java.lang.String,java.lang.String> compilationParameters)Creates a cursor over the results of the given query with the default fetch window size of 100.CursorcreateCursor(java.lang.String queryText, java.util.Map<java.lang.String,java.lang.String> compilationParameters, int fetchWindowSize)Creates a cursor over the results of the given query.CursorcreateCursor(Query query, java.util.Map<java.lang.String,java.lang.String> compilationParameters)Creates a cursor over the results of the given query with the default fetch window size of 100.CursorcreateCursor(Query query, java.util.Map<java.lang.String,java.lang.String> compilationParameters, int fetchWindowSize)Creates a cursor over the results of the given query.voidcreateExplanation(java.lang.String factText, int maxDistanceFromRoot, int maxRuleInstancesPerFact, ExplanationType explanationType, java.io.OutputStream outputStream)Computes an explanation for a given fact and saves it in JSON format to the given output stream.voidcreateExplanation(TupleTableAtom fact, int maxDistanceFromRoot, int maxRuleInstancesPerFact, ExplanationType explanationType, java.io.OutputStream outputStream)Computes an explanation for a given fact and saves it in JSON format to the given output stream.voidcreateStatistics(java.lang.String statisticsName, java.util.Map<java.lang.String,java.lang.String> statisticsParameters)Creates the statistics in a data store.voidcreateTupleTable(java.lang.String tupleTableName, java.util.Map<java.lang.String,java.lang.String> tupleTableParameters)Creates a tuple table in a data store.longdeleteDeltaQueryAnswers(java.util.Optional<java.lang.String> deltaQueryName, java.util.Optional<java.lang.Long> fromDataStoreVersion, java.util.Optional<java.lang.Long> toDataStoreVersion, java.util.Optional<DeltaQueryAnswerType> deltaQueryAnswerType)Deletes the delta query answers that match the specified delta query name, the data store version range, and delta query answer type.longdeleteRule(Rule rule)Deletes a rule to the data store.longdeleteRules(java.util.Collection<Rule> datalogProgram)Deletes a collection of rules to the data store.voiddeleteStatistics(java.lang.String statisticsName)Deletes the data store statistics with the specified name from the data store.voiddeleteTupleTable(java.lang.String tupleTableName)Deletes the tuple table with the specified name from the data store.voidderegisterDataSource(java.lang.String dataSourceName)Deregisters the data source table with the specified name from the data store.voidderegisterDeltaQuery(java.lang.String deltaQueryName)Deregisters the delta query with the specified name from the data store.DataSourceInfodescribeDataSource(java.lang.String dataSourceName)Returns information about the data source with the given name.DataSourceTableInfodescribeDataSourceTable(java.lang.String dataSourceName, java.lang.String dataSourceTableName)Returns information about the data source table of the specified data source in the data store.DeltaQueryInfodescribeDeltaQuery(java.lang.String deltaQueryName)Returns information about the delta query with the given name.StatisticsInfodescribeStatistics(java.lang.String statisticsName)Returns information about the specific statistics of the data store.TupleTableInfodescribeTupleTable(java.lang.String tupleTableName)Returns information about the tuple table with the given name.DataStoreConnectionduplicate()Creates a new connection to the same data store.StatementResultevaluateQuery(java.lang.String queryText, java.util.Map<java.lang.String,java.lang.String> compilationParameters, QueryAnswerMonitor queryAnswerMonitor)Evaluates a query and calls the suppliedQueryAnswerMonitorinstance for each tuple in the result.StatementResultevaluateQuery(Query query, java.util.Map<java.lang.String,java.lang.String> compilationParameters, QueryAnswerMonitor queryAnswerMonitor)Evaluates a query and calls the suppliedQueryAnswerMonitorinstance for each tuple in the result.StatementResultevaluateStatement(java.lang.String statementText, java.util.Map<java.lang.String,java.lang.String> compilationParameters, java.io.File file, java.lang.String queryAnswerFormatName)Evaluates a statement and serializes the result to the supplied file using the specified format.StatementResultevaluateStatement(java.lang.String statementText, java.util.Map<java.lang.String,java.lang.String> compilationParameters, java.io.OutputStream outputStream, java.lang.String queryAnswerFormatName)Evaluates a statement and serializes the result to the supplied output stream using the specified format.StatementResultevaluateStatement(Statement statement, java.util.Map<java.lang.String,java.lang.String> compilationParameters, java.io.File file, java.lang.String queryAnswerFormatName)Evaluates a statement and serializes the result to the supplied file using the specified format.StatementResultevaluateStatement(Statement statement, java.util.Map<java.lang.String,java.lang.String> compilationParameters, java.io.OutputStream outputStream, java.lang.String queryAnswerFormatName)Evaluates a statement and serializes the result to the supplied output stream using the specified format.StatementResultevaluateUpdate(java.lang.String updateText, java.util.Map<java.lang.String,java.lang.String> compilationParameters)Evaluates an update.StatementResultevaluateUpdate(Update update, java.util.Map<java.lang.String,java.lang.String> compilationParameters)Evaluates an update.StatementResultevaluateUpdates(java.util.List<Update> updates, java.util.Map<java.lang.String,java.lang.String> compilationParameters)Evaluates a list of updates.voidexportData(java.io.File file, java.lang.String encryptionAlgorithm, java.lang.String encryptionKey, java.lang.String formatName, java.util.Map<java.lang.String,java.lang.String> parameters)Exports the data in the data store using the given format.voidexportData(java.io.File file, java.lang.String formatName, java.util.Map<java.lang.String,java.lang.String> parameters)Exports the data in the data store using the given format.voidexportData(java.io.OutputStream outputStream, java.lang.String formatName, java.util.Map<java.lang.String,java.lang.String> parameters)Exports the data in the data store using the given format.voidexportDeltaQueryAnswer(java.io.OutputStream outputStream, java.lang.String deltaQueryName, long dataStoreVersion, DeltaQueryAnswerType deltaQueryAnswerType)Exports the delta query answer with the specified name, data store version, and delta query answer type.java.lang.StringgetAgentName()Returns the name of the agent currently associated with this connection.CommitProcedureInfogetCommitProcedure()Returns the data store's commit procedure.ComponentInfogetComponentInfo(boolean extended)Returns diagnostic information about the data store as a tree of objects each providing detailed information about the data store.ResourceValue[][]getDataSourceTableData(java.lang.String dataSourceName, java.lang.String dataSourceTableName, int numberOfRows)Returns a sample of the data from the specified data source table.DataStoreOperationStartMonitorgetDataStoreOperationStartMonitor()Returns the current callback interface that will be called whenever an operation starts on this data store connection.java.util.Map<java.lang.String,java.lang.String>getDataStoreProperties()Returns all data store properties as key-value pairs.java.lang.StringgetDataStoreProperty(java.lang.String propertyName)Returns the specified property of the data store.longgetDataStoreVersion()If a transaction is active, the data store version associated with the transaction is returned; otherwise, the last committed data store version is returned.longgetDataStoreVersionAfterLastOperation()Returns the version that the data store had after the last operation on this connection.longgetLastSnapshotDataStoreVersion()Returns the data store version of the most recent snapshot.longgetLockTimeout()Returns the time in milliseconds that the system will wait for when it needs to acquire a lock on a data store.java.lang.StringgetName()Returns the name of the data store inside the server.java.util.Map<java.lang.String,java.lang.String>getParameters()Returns the parameters that the data store was created with.PrefixesgetPrefixes()Returns the prefixes of the data store.TransactionStategetTransactionState()Returns the state of the transaction associated with this connection.java.lang.StringgetUniqueID()Returns a string that uniquely identifies the data store.ImportResultimportAxiomsFromTriples(ResourceValue sourceGraph, boolean translateAssertions, ResourceValue destinationGraph, UpdateType updateType)Parses the given source graph into OWL axioms, and imports the axioms into the destination graph.ImportResultimportAxiomsFromTriples(ResourceValue sourceGraph, boolean translateAssertions, ResourceValue destinationGraph, UpdateType updateType, ImportNotificationMonitor importNotificationMonitor)Parses the given source graph into OWL axioms, and imports the axioms into the destination graph.ImportResultimportData(ResourceValue defaultGraph, UpdateType updateType, java.io.File file)Imports the data from the given file into the current data store.ImportResultimportData(ResourceValue defaultGraph, UpdateType updateType, java.io.InputStream inputStream)Imports the data from the given input stream into the current data store.ImportResultimportData(ResourceValue defaultGraph, UpdateType updateType, java.lang.String content)Imports the data from the given string into the current data store.ImportResultimportData(ResourceValue defaultGraph, UpdateType updateType, java.util.Collection<InputSourceFactory> inputSourceFactories, java.lang.String formatName, ImportNotificationMonitor importNotificationMonitor)Imports the data described by the given input source factories into the current data store.ImportResultimportData(ResourceValue defaultGraph, UpdateType updateType, InputSourceFactory inputSourceFactory, java.lang.String formatName, ImportNotificationMonitor importNotificationMonitor)Imports the data described by the given input source factory into the current data store Triples in the default graph will be put into the named graph specified using thedefaultGraphparameter.ImportResultimportData(UpdateType updateType, java.io.File file)Imports the data from the given file into the current data store.ImportResultimportData(UpdateType updateType, java.io.InputStream inputStream)Imports the data from the given input stream into the current data store.ImportResultimportData(UpdateType updateType, java.lang.String content)Imports the data from the given string into the current data store.ImportResultimportData(UpdateType updateType, java.util.Collection<InputSourceFactory> inputSourceFactories, java.lang.String formatName, ImportNotificationMonitor importNotificationMonitor)Imports the data described by the given input source factories into the current data store.ImportResultimportData(UpdateType updateType, InputSourceFactory inputSourceFactory, java.lang.String formatName, ImportNotificationMonitor importNotificationMonitor)Imports the data described by the given input source factory into the current data store.voidinterrupt()Tries to interrupt an operation that is running in parallel on this connection.booleanisPersistent()Returnstrueif the data store is persistent.java.util.Map<java.lang.String,java.util.Optional<DataSourceInfo>>listDataSources()Returns the list of data sources currently present in the data store.java.util.List<DataSourceTableInfo>listDataSourceTables(java.lang.String dataSourceName)Returns information about the data source tables of the specified data source in the data store.java.util.Map<java.lang.String,java.util.Optional<DeltaQueryInfo>>listDeltaQueries()Returns information about the delta queries currently registered with the data store.java.util.List<DeltaQueryAnswerInfo>listDeltaQueryAnswers(java.util.Optional<java.lang.String> deltaQueryName, java.util.Optional<java.lang.Long> fromDataStoreVersion, java.util.Optional<java.lang.Long> toDataStoreVersion, java.util.Optional<DeltaQueryAnswerType> deltaQueryAnswerType)Lists the delta query answers that match the specified delta query name, the data store version range, and delta query answer type.java.util.List<RuleInfo>listRules()Returns the information about the rules currently loaded into the data store.java.util.List<StatisticsInfo>listStatistics()Returns information about all statistics currently managed by the data store.java.util.Map<java.lang.String,java.util.Optional<TupleTableInfo>>listTupleTables()Returns the list of tuple tables currently present in the data store.voidrecompile()Recompiles the rules and commit procedure using the currently available statistics.voidrecomputeMaterialization()Recomputes the materialization from scratch — that is, deletes all derived facts and applies all rules as if the data had just been freshly imported.voidregisterDataSource(java.lang.String dataSourceName, java.util.Map<java.lang.String,java.lang.String> dataSourceParameters)Registers a data source with a data store.voidregisterDeltaQuery(java.lang.String deltaQueryName, java.lang.String queryText, java.lang.String formatName, long snapshotsMaxSize, long deletionsMaxSize, long additionsMaxSize)Registers a delta query with a data store.voidregisterDeltaQuery(java.lang.String deltaQueryName, Query query, java.lang.String formatName, long snapshotsMaxSize, long deletionsMaxSize, long additionsMaxSize)Registers a delta query with a data store.booleanrequiresIncrementalReasoning()Returnstrueif the next data store update must be performed using incremental reasoning (rather than standard using the standard datalog materialization "from scratch" algorithm).voidrollbackTransaction()Rolls back the transaction associated with this connection.booleansetCommitProcedure(java.lang.String commitProcedure)Sets the data store's commit procedure.booleansetCommitProcedure(java.util.List<Update> steps)Sets the data store's commit procedure.voidsetDataStoreOperationStartMonitor(DataStoreOperationStartMonitor dataStoreOperationStartMonitor)Sets a callback interface that will be called whenever an operation starts on this data store connection.booleansetDataStoreProperty(java.lang.String propertyName, java.lang.String propertyValue)Sets the specified property of the data store to the given value.voidsetDeltaQueryEvaluationMode(java.lang.String deltaQueryName, DeltaQueryEvaluationMode deltaQueryEvaluationMode)Deregisters the delta query with the specified name from the data store.voidsetLockTimeout(long timeout)Sets the time in milliseconds that the system will wait for when it needs to acquire a lock on a data store.booleansetPrefix(java.lang.String prefixName, java.lang.String prefixIRI)Sets the given prefix name to the given prefix IRI in the collection of the data store prefixes.booleansetPrefixes(Prefixes prefixes)Replaces all mappings of the prefix names to IRIs maintained by the data store to the collection given in the argument.booleantransactionRequiresRollback()Returnstrueif a transaction is active on this connection and this transaction must be rolled back (i.e., it cannot be committed).booleanunsetPrefix(java.lang.String prefixName)Removes the mapping of the given prefix name in the collection of the data store prefixes.voidupdateMaterialization()Updates the materialization so that all and only the consequences of the explicitly stated facts and the rules are derived.voidupdateStatistics()Updates all statistics that the data store uses to plan queries and rules.voidupdateStatistics(java.lang.String statisticsName)Updates the statistics with the given name that the data store uses to plan queries and rules.
-
Field Details
-
WAIT_FOREVER
static final long WAIT_FOREVERSpecifies that the system should wait forever when it needs to acquire a lock on a data store (seesetLockTimeout(long)).- See Also:
- Constant Field Values
-
-
Method Details
-
close
void close()Closes the data store connection by freeing all resources associated with it. Once a connection is closed, it cannot be used any further. Calling this method in parallel with any other method runs a very high risk of crashing the JVM.- Specified by:
closein interfacejava.lang.AutoCloseable
-
interrupt
Tries to interrupt an operation that is running in parallel on this connection. RDFox will make a best effort to interrupt an operation, but there are no guarantees that the operation will indeed be interrupted. An operation will throw anOperationInterruptedExceptionexception. This method can be called concurrently with any other method apart fromclose().- Throws:
JRDFoxException- thrown if an error is encountered
-
getAgentName
Returns the name of the agent currently associated with this connection.- Returns:
- the name of the agent currently associated with this connection
- Throws:
JRDFoxException- thrown if there is an error
-
getLockTimeout
Returns the time in milliseconds that the system will wait for when it needs to acquire a lock on a data store. SeesetLockTimeout(long)for more detail.- Returns:
- the current timeout value
- Throws:
JRDFoxException- thrown if an error is encountered
-
setLockTimeout
Sets the time in milliseconds that the system will wait for when it needs to acquire a lock on a data store. The value ofWAIT_FOREVERspecifies that the system should wait indefinitely. When successful completion of an operation (e.g., adding data to a data store) requires locking a store and the lock cannot be acquired within the timeout period, aLockTimeoutExceptionis thrown.- Parameters:
timeout- the new timeout value- Throws:
JRDFoxException- thrown if an error is encountered
-
getDataStoreOperationStartMonitor
Returns the current callback interface that will be called whenever an operation starts on this data store connection.- Returns:
- the current callback interface that will intercept operations, or
nullif no callback interface is set - Throws:
JRDFoxException- thrown if an error is encountered
-
setDataStoreOperationStartMonitor
void setDataStoreOperationStartMonitor(DataStoreOperationStartMonitor dataStoreOperationStartMonitor) throws JRDFoxExceptionSets a callback interface that will be called whenever an operation starts on this data store connection. This allows one to intercept and potentially block operations (e.g., depending on the data store version).- Parameters:
dataStoreOperationStartMonitor- the callback interface that will intercept operations, ornullif callbacks are not required- Throws:
JRDFoxException- thrown if an error is encountered
-
duplicate
Creates a new connection to the same data store. The new connection inherits the role name and the lock timeout from this one. Regardless of whether a transaction is active on this connection, the new connection will not have an active transaction. The main use of this method is to avoid having to specify the user credentials again.- Returns:
- a new connection to the same data store
- Throws:
JRDFoxException- thrown if an error is encountered
-
getName
Returns the name of the data store inside the server.- Returns:
- the name of the data store
- Throws:
JRDFoxException- thrown if an error is encountered
-
getUniqueID
Returns a string that uniquely identifies the data store. Each time a data store is created, a fresh random string is associated to the data store. This string aims to be unique across servers and data stores.- Returns:
- a string that uniquely identifies this data store
- Throws:
JRDFoxException- thrown if an error is encountered
-
isPersistent
Returnstrueif the data store is persistent.- Returns:
trueif the data store is persistent- Throws:
JRDFoxException- thrown if an error is encountered
-
getParameters
Returns the parameters that the data store was created with.- Returns:
- the parameters of the data store
- Throws:
JRDFoxException- thrown if an error is encountered
-
getComponentInfo
Returns diagnostic information about the data store as a tree of objects each providing detailed information about the data store. Note: This information should be used for diagnostics purposes only. The content ofComponentInfois subject to change in future version. Callers should not rely on named property or a specific subcomponent being present. This operation can be invoked only if no transaction is active on the connection.- Parameters:
extended- iftrue, returns extensive information about various subcomponents about the data store (mainly used for troubleshooting)- Returns:
- information about the data store
- Throws:
JRDFoxException- thrown if an error is encountered
-
getDataStoreProperties
Returns all data store properties as key-value pairs.- Returns:
- all data store properties as key-value pairs
- Throws:
JRDFoxException- thrown if an error is encountered
-
getDataStoreProperty
Returns the specified property of the data store.- Parameters:
propertyName- the name of the property- Returns:
- the value of the property with the given name
- Throws:
JRDFoxException- thrown if an error is encountered
-
setDataStoreProperty
boolean setDataStoreProperty(java.lang.String propertyName, java.lang.String propertyValue) throws JRDFoxExceptionSets the specified property of the data store to the given value.- Parameters:
propertyName- the name of the propertypropertyValue- the value of the property- Returns:
trueif the data store property value changed- Throws:
JRDFoxException- thrown if an error is encountered
-
getPrefixes
Returns the prefixes of the data store.- Returns:
- the prefixes of the data store
- Throws:
JRDFoxException- thrown if an error is encountered
-
setPrefixes
Replaces all mappings of the prefix names to IRIs maintained by the data store to the collection given in the argument.- Parameters:
prefixes- the new prefixes- Returns:
trueif the collection of prefixes changed- Throws:
JRDFoxException- thrown if an error is encountered
-
setPrefix
Sets the given prefix name to the given prefix IRI in the collection of the data store prefixes.- Parameters:
prefixName- the prefix name to setprefixIRI- the IRI to which the prefix name is set- Returns:
trueif the collection of prefixes changed- Throws:
JRDFoxException- thrown if an error is encountered
-
unsetPrefix
Removes the mapping of the given prefix name in the collection of the data store prefixes.- Parameters:
prefixName- the prefix name whose mapping is to be removed- Returns:
trueif the collection of prefixes changed- Throws:
JRDFoxException- thrown if an error is encountered
-
listDataSources
java.util.Map<java.lang.String,java.util.Optional<DataSourceInfo>> listDataSources() throws JRDFoxExceptionReturns the list of data sources currently present in the data store. The result is a map from data source names to optional objects containing data source information. If the user has sufficient privileges to access a particular data sources, the optional will contain the information about the data source; otherwise, the optional will be empty.- Returns:
- information about the tuple tables currently present in the data store
- Throws:
JRDFoxException- thrown if an error is encountered
-
containsDataSource
Checks whether the data store contains a data source with the specified name.- Parameters:
dataSourceName- the name of the data source to be checked- Returns:
trueif the data store contains a data source with the given name- Throws:
JRDFoxException- thrown if an error is encountered
-
describeDataSource
Returns information about the data source with the given name.- Parameters:
dataSourceName- the name of the data source whose information is to be returned- Returns:
- information about the data source
- Throws:
JRDFoxException- thrown if an error is encountered
-
registerDataSource
void registerDataSource(java.lang.String dataSourceName, java.util.Map<java.lang.String,java.lang.String> dataSourceParameters) throws JRDFoxExceptionRegisters a data source with a data store. The new data source is described using the supplied key-value pairs. This operation can be invoked only if no transaction is active on the connection.- Parameters:
dataSourceName- the name of the data source to be createddataSourceParameters- the key-value pairs that describe the data source to be created- Throws:
JRDFoxException- thrown if an error is encountered
-
deregisterDataSource
Deregisters the data source table with the specified name from the data store. This operation can be invoked only if no transaction is active on the connection.- Parameters:
dataSourceName- the name of the data source to be deleted- Throws:
JRDFoxException- thrown if an error is encountered
-
listDataSourceTables
java.util.List<DataSourceTableInfo> listDataSourceTables(java.lang.String dataSourceName) throws JRDFoxExceptionReturns information about the data source tables of the specified data source in the data store.- Parameters:
dataSourceName- the name of the data source whose tables are to be listed- Returns:
- information about the data source tables of the specified data source
- Throws:
JRDFoxException- thrown if an error is encountered
-
containsDataSourceTable
boolean containsDataSourceTable(java.lang.String dataSourceName, java.lang.String dataSourceTableName) throws JRDFoxExceptionChecks whether the specified data source in the data store contains a data source table with the specified name.- Parameters:
dataSourceName- the name of the data sourcedataSourceTableName- the name of the data source table- Returns:
trueif the specified data source contains the specified data source table- Throws:
JRDFoxException- thrown if an error is encountered
-
describeDataSourceTable
DataSourceTableInfo describeDataSourceTable(java.lang.String dataSourceName, java.lang.String dataSourceTableName) throws JRDFoxExceptionReturns information about the data source table of the specified data source in the data store.- Parameters:
dataSourceName- the name of the data sourcedataSourceTableName- the name of the data source table- Returns:
- information about the data source table
- Throws:
JRDFoxException- thrown if an error is encountered
-
getDataSourceTableData
ResourceValue[][] getDataSourceTableData(java.lang.String dataSourceName, java.lang.String dataSourceTableName, int numberOfRows) throws JRDFoxExceptionReturns a sample of the data from the specified data source table. This method is not designed for efficient importation of data from a data source. Rather, its main purpose is to allow applications to view the data in the source before mounting an appropriate tuple table.- Parameters:
dataSourceName- the name of the data sourcedataSourceTableName- the name of the data source tablenumberOfRows- the maximum number of rows to be returned- Returns:
- a sample of the data from the data source table
- Throws:
JRDFoxException- thrown if an error is encountered
-
listTupleTables
java.util.Map<java.lang.String,java.util.Optional<TupleTableInfo>> listTupleTables() throws JRDFoxExceptionReturns the list of tuple tables currently present in the data store. The result is a map from tuple table names to optional objects containing tuple table information. If the user has sufficient privileges to access a particular tuple table, the optional will contain the information about the tuple table; otherwise, the optional will be empty.- Returns:
- information about the tuple tables currently present in the data store
- Throws:
JRDFoxException- thrown if an error is encountered
-
containsTupleTable
Checks whether the data store contains a tuple table with the specified name.- Parameters:
tupleTableName- the name of the tuple table to be checked- Returns:
trueif the data store contains a tuple table with the given name- Throws:
JRDFoxException- thrown if an error is encountered
-
describeTupleTable
Returns information about the tuple table with the given name.- Parameters:
tupleTableName- the name of the tuple table whose information is to be returned- Returns:
- information about the tuple table
- Throws:
JRDFoxException- thrown if an error is encountered
-
createTupleTable
void createTupleTable(java.lang.String tupleTableName, java.util.Map<java.lang.String,java.lang.String> tupleTableParameters) throws JRDFoxExceptionCreates a tuple table in a data store. The type of the tuple table is described by the supplied parameters. By using appropriate parameters, this method can be used to mount a tuple table from a data source. This operation can be invoked only if no transaction is active on the connection.- Parameters:
tupleTableName- the name of the tuple table to be createdtupleTableParameters- the key-value pairs that describe the tuple table to be created- Throws:
JRDFoxException- thrown if an error is encountered
-
deleteTupleTable
Deletes the tuple table with the specified name from the data store. A tuple table can be deleted only if it is not used in the body or head of any rule currently loaded in the data store. This operation can be invoked only if no transaction is active on the connection.- Parameters:
tupleTableName- the name of the tuple table to be deleted- Throws:
JRDFoxException- thrown if an error is encountered
-
listStatistics
Returns information about all statistics currently managed by the data store.- Returns:
- information about all statistics that the data store currently manages
- Throws:
JRDFoxException- thrown if an error is encountered
-
containsStatistics
Checks whether the data store contains the statistics with the specified name.- Parameters:
statisticsName- the name of the statistics- Returns:
trueif the data store contains the specified statistics- Throws:
JRDFoxException- thrown if an error is encountered
-
describeStatistics
Returns information about the specific statistics of the data store.- Parameters:
statisticsName- the name of the statistics whose information should be returned- Returns:
- information about the statistics
- Throws:
JRDFoxException- thrown if an error is encountered
-
createStatistics
void createStatistics(java.lang.String statisticsName, java.util.Map<java.lang.String,java.lang.String> statisticsParameters) throws JRDFoxExceptionCreates the statistics in a data store. The name of the statistics determines their type; thus, a data store can contain at most one statistics of a particular type, and the type corresponds to the statistics name. The way in which the statistics are gathered is influenced by the the supplied key-value pairs. This operation can be invoked only if no transaction is active on the connection.- Parameters:
statisticsName- the name of the data source to be createdstatisticsParameters- the key-value pairs that describe the statistics to be created- Throws:
JRDFoxException- thrown if an error is encountered
-
deleteStatistics
Deletes the data store statistics with the specified name from the data store. This operation can be invoked only if no transaction is active on the connection.- Parameters:
statisticsName- the name of the data store statistics to be deleted- Throws:
JRDFoxException- thrown if an error is encountered
-
updateStatistics
Updates all statistics that the data store uses to plan queries and rules. This operation should be invoked after large additions to the data store, or after a large number of facts has been derived. This operation can be invoked if either no transaction is active, or a read/write transaction is active. In the latter case, rolling back a transaction does not restore the statistics to their original state.- Throws:
JRDFoxException- thrown if an error is encountered
-
getDataStoreVersionAfterLastOperation
Returns the version that the data store had after the last operation on this connection. If a transaction is active, the current data store version is returned. Note that rolling back a transaction does not restore the data store version.- Returns:
- the version that the data store had after the last transaction on this connection (or 0 if no transaction was performed on this connection)
- Throws:
JRDFoxException- thrown if an error is encountered
-
getDataStoreVersion
If a transaction is active, the data store version associated with the transaction is returned; otherwise, the last committed data store version is returned.- Returns:
- the version of the data store
- Throws:
JRDFoxException- thrown if an error is encountered
-
getLastSnapshotDataStoreVersion
Returns the data store version of the most recent snapshot.- Returns:
- the data store version of the most recent snapshot
- Throws:
JRDFoxException- thrown if an error is encountered
-
updateStatistics
Updates the statistics with the given name that the data store uses to plan queries and rules. This operation should be invoked after large additions to the data store, or after a large number of facts has been derived. This operation can be invoked if either no transaction is active, or a read/write transaction is active. In the latter case, rolling back a transaction does not restore the statistics to their original state.- Parameters:
statisticsName- the name of the statistics that should be updated- Throws:
JRDFoxException- thrown if an error is encountered
-
getCommitProcedure
Returns the data store's commit procedure.- Returns:
- the data store's commit procedure.
- Throws:
JRDFoxException- thrown if an error is encountered
-
setCommitProcedure
Sets the data store's commit procedure.- Parameters:
commitProcedure- a SPARQL update request string- Returns:
trueif the commit procedure was changed- Throws:
JRDFoxException- thrown if an error is encountered
-
setCommitProcedure
Sets the data store's commit procedure.- Parameters:
steps- a list of update steps that form the commit procedure- Returns:
trueif the commit procedure was changed- Throws:
JRDFoxException- thrown if an error is encountered
-
listDeltaQueries
java.util.Map<java.lang.String,java.util.Optional<DeltaQueryInfo>> listDeltaQueries() throws JRDFoxExceptionReturns information about the delta queries currently registered with the data store.- Returns:
- A Map from delta query names to optional objects containing delta query information. If the user has sufficient privileges to access a particular delta query, the optional will contain the information about the delta query; otherwise, the optional will be empty.
- Throws:
JRDFoxException- thrown if an error is encountered
-
containsDeltaQuery
Checks whether the data store contains a delta query with the specified name.- Parameters:
deltaQueryName- the name of the delta query to be checked- Returns:
trueif the data store contains a delta query with the given name- Throws:
JRDFoxException- thrown if an error is encountered
-
describeDeltaQuery
Returns information about the delta query with the given name.- Parameters:
deltaQueryName- the name of the delta query whose information is to be returned- Returns:
- information about the delta query
- Throws:
JRDFoxException- thrown if an error is encountered
-
registerDeltaQuery
void registerDeltaQuery(java.lang.String deltaQueryName, java.lang.String queryText, java.lang.String formatName, long snapshotsMaxSize, long deletionsMaxSize, long additionsMaxSize) throws JRDFoxExceptionRegisters a delta query with a data store.- Parameters:
deltaQueryName- the name of the delta query to be createdqueryText- the string representation of the queryformatName- the format that the query results should be stored and returned insnapshotsMaxSize- the maximum number of answers that a snapshot delta query answer can contain (0 means no answers are stored, andLong.MAX_VALUEmeans no limit)deletionsMaxSize- the maximum number of answers that a deletion delta query answer can contain (0 means no answers are stored, andLong.MAX_VALUEmeans no limit)additionsMaxSize- the maximum number of answers that a addition delta query answer can contain (0 means no answers are stored, andLong.MAX_VALUEmeans no limit)- Throws:
JRDFoxException- thrown if an error is encountered
-
registerDeltaQuery
void registerDeltaQuery(java.lang.String deltaQueryName, Query query, java.lang.String formatName, long snapshotsMaxSize, long deletionsMaxSize, long additionsMaxSize) throws JRDFoxExceptionRegisters a delta query with a data store.- Parameters:
deltaQueryName- the name of the delta query to be createdquery- the query objectformatName- the format that the query results should be stored and returned insnapshotsMaxSize- the maximum number of answers that a snapshot delta query answer can contain (0 means no answers are stored, andLong.MAX_VALUEmeans no limit)deletionsMaxSize- the maximum number of answers that a deletion delta query answer can contain (0 means no answers are stored, andLong.MAX_VALUEmeans no limit)additionsMaxSize- the maximum number of answers that a addition delta query answer can contain (0 means no answers are stored, andLong.MAX_VALUEmeans no limit)- Throws:
JRDFoxException- thrown if an error is encountered
-
deregisterDeltaQuery
Deregisters the delta query with the specified name from the data store.- Parameters:
deltaQueryName- the name of the delta query to be deleted- Throws:
JRDFoxException- thrown if an error is encountered
-
setDeltaQueryEvaluationMode
void setDeltaQueryEvaluationMode(java.lang.String deltaQueryName, DeltaQueryEvaluationMode deltaQueryEvaluationMode) throws JRDFoxExceptionDeregisters the delta query with the specified name from the data store.- Parameters:
deltaQueryName- the name of the delta query to be deleted.deltaQueryEvaluationMode- the desired mode of evaluation of the delta query.- Throws:
JRDFoxException- thrown if an error is encountered
-
listDeltaQueryAnswers
java.util.List<DeltaQueryAnswerInfo> listDeltaQueryAnswers(java.util.Optional<java.lang.String> deltaQueryName, java.util.Optional<java.lang.Long> fromDataStoreVersion, java.util.Optional<java.lang.Long> toDataStoreVersion, java.util.Optional<DeltaQueryAnswerType> deltaQueryAnswerType) throws JRDFoxExceptionLists the delta query answers that match the specified delta query name, the data store version range, and delta query answer type.- Parameters:
deltaQueryName- the name of the delta query for which answers are provided.fromDataStoreVersion- the lower bound on the data store version of the delta query answers.toDataStoreVersion- the upper bound on the data store version of the delta query answers.deltaQueryAnswerType- the type of the delta query answers.- Returns:
- a list of delta query answer information objects
- Throws:
JRDFoxException- thrown if an error is encountered
-
deleteDeltaQueryAnswers
long deleteDeltaQueryAnswers(java.util.Optional<java.lang.String> deltaQueryName, java.util.Optional<java.lang.Long> fromDataStoreVersion, java.util.Optional<java.lang.Long> toDataStoreVersion, java.util.Optional<DeltaQueryAnswerType> deltaQueryAnswerType) throws JRDFoxExceptionDeletes the delta query answers that match the specified delta query name, the data store version range, and delta query answer type.- Parameters:
deltaQueryName- the name of the delta query for which answers are provided.fromDataStoreVersion- the lower bound on the data store version of the delta query answers.toDataStoreVersion- the upper bound on the data store version of the delta query answers.deltaQueryAnswerType- the type of the delta query answers.- Returns:
- the number of delta query answers that were deleted
- Throws:
JRDFoxException- thrown if an error is encountered
-
exportDeltaQueryAnswer
void exportDeltaQueryAnswer(java.io.OutputStream outputStream, java.lang.String deltaQueryName, long dataStoreVersion, DeltaQueryAnswerType deltaQueryAnswerType) throws JRDFoxExceptionExports the delta query answer with the specified name, data store version, and delta query answer type.- Parameters:
outputStream- the output stream to which the delta query answer is writtendeltaQueryName- the name of the delta querydataStoreVersion- the data store version of the delta query answer to be returneddeltaQueryAnswerType- the type of the delta query answer to be returned- Throws:
JRDFoxException- thrown if an error is encountered
-
getTransactionState
Returns the state of the transaction associated with this connection.- Returns:
- the state of the transaction
- Throws:
JRDFoxException- thrown if an error is encountered
-
transactionRequiresRollback
Returnstrueif a transaction is active on this connection and this transaction must be rolled back (i.e., it cannot be committed). This happens when certain operations invoked in a transaction result in an error.- Returns:
trueif the currently active transaction must be committed- Throws:
JRDFoxException- thrown if an error is encountered
-
beginTransaction
Starts a new transaction on this connection.- Parameters:
transactionType- determines the type of the transaction (i.e., whether a read-only or a read/write transaction is requested)- Throws:
JRDFoxException- thrown if an error is encountered
-
commitTransaction
Commits the transaction associated with this connection. If an exception is thrown during a commit operation,transactionRequiresRollback()will returntrue, and the transaction should be explicitly rolled back usingrollbackTransaction().- Throws:
JRDFoxException- thrown if an error is encountered
-
rollbackTransaction
Rolls back the transaction associated with this connection.- Throws:
JRDFoxException- thrown if an error is encountered
-
compact
Compact the data in the data store. This involves removing all deleted triples, and possibly sorting the data in order to facilitate faster access. This may result in reduced memory usage and/or disk usage for persisted data stores. This operation can be invoked only if no transaction is active.- Throws:
JRDFoxException- thrown if an error is encountered
-
clear
Clears the specified parts of the data store.- Parameters:
dataStoreParts- a bit-mask constructed fromDataStorePartvalues specifying what to clear- Throws:
JRDFoxException
-
clearRulesAxiomsExplicateFacts
Clears all rules and turns all facts in the data store into EDB facts. After this operation, the data store is in the same state as if all derived facts have been imported from a file. This operation can be invoked only if no transaction is active.- Throws:
JRDFoxException- thrown if an error is encountered
-
exportData
void exportData(java.io.OutputStream outputStream, java.lang.String formatName, java.util.Map<java.lang.String,java.lang.String> parameters) throws JRDFoxExceptionExports the data in the data store using the given format. The format determines which subset of the store data is to be exported; for example, the Turtle format can store triples, but not facts in other tuple tables or the rules.- Parameters:
outputStream- receives the exported dataformatName- the name of the output formatparameters- key-value pairs that, depending on the format, customize the export process- Throws:
JRDFoxException- thrown if an error is encountered
-
exportData
void exportData(java.io.File file, java.lang.String formatName, java.util.Map<java.lang.String,java.lang.String> parameters) throws JRDFoxExceptionExports the data in the data store using the given format. The format determines which subset of the store data is to be exported; for example, the Turtle format can store triples, but not facts in other tuple tables or the rules.- Parameters:
file- receives the exported dataformatName- the name of the output formatparameters- key-value pairs that, depending on the format, customize the export process- Throws:
JRDFoxException- thrown if an error is encountered
-
exportData
void exportData(java.io.File file, java.lang.String encryptionAlgorithm, java.lang.String encryptionKey, java.lang.String formatName, java.util.Map<java.lang.String,java.lang.String> parameters) throws JRDFoxExceptionExports the data in the data store using the given format. The format determines which subset of the store data is to be exported; for example, the Turtle format can store triples, but not facts in other tuple tables or the rules.- Parameters:
file- receives the exported dataencryptionAlgorithm- the name of the encryption algorithm to use (ornullif no encryption should be used)encryptionKey- the key to use for encryption (ornullif no encryption should be used)formatName- the name of the output formatparameters- key-value pairs that, depending on the format, customize the export process- Throws:
JRDFoxException- thrown if an error is encountered
-
importData
ImportResult importData(UpdateType updateType, InputSourceFactory inputSourceFactory, java.lang.String formatName, ImportNotificationMonitor importNotificationMonitor) throws JRDFoxExceptionImports the data described by the given input source factory into the current data store.- Parameters:
updateType- specifies whether the imported data should be added or removed from the data storeinputSourceFactory- the content being importedformatName- the name of the format of the dataimportNotificationMonitor- receives errors/warnings encountered during import- Returns:
- provides information about the importation process
- Throws:
JRDFoxException- thrown if an error is encountered
-
importData
ImportResult importData(UpdateType updateType, java.util.Collection<InputSourceFactory> inputSourceFactories, java.lang.String formatName, ImportNotificationMonitor importNotificationMonitor) throws JRDFoxExceptionImports the data described by the given input source factories into the current data store. If this server is configured to use more than one thread, then sources are parsed and imported in parallel.- Parameters:
updateType- specifies whether the imported data should be added or removed from the data storeinputSourceFactories- the content being importedformatName- the name of the format of the dataimportNotificationMonitor- receives errors/warnings encountered during import- Returns:
- provides information about the importation process
- Throws:
JRDFoxException- thrown if an error is encountered
-
importData
Imports the data from the given file into the current data store.- Parameters:
updateType- specifies whether the imported data should be added or removed from the data storefile- the content being imported- Returns:
- provides information about the importation process
- Throws:
JRDFoxException- thrown if an error is encountered
-
importData
Imports the data from the given string into the current data store.- Parameters:
updateType- specifies whether the imported data should be added or removed from the data storecontent- the content being imported- Returns:
- provides information about the importation process
- Throws:
JRDFoxException- thrown if an error is encountered
-
importData
ImportResult importData(UpdateType updateType, java.io.InputStream inputStream) throws JRDFoxExceptionImports the data from the given input stream into the current data store.- Parameters:
updateType- specifies whether the imported data should be added or removed from the data storeinputStream- the content being imported- Returns:
- provides information about the importation process
- Throws:
JRDFoxException- thrown if an error is encountered
-
importData
ImportResult importData(ResourceValue defaultGraph, UpdateType updateType, InputSourceFactory inputSourceFactory, java.lang.String formatName, ImportNotificationMonitor importNotificationMonitor) throws JRDFoxExceptionImports the data described by the given input source factory into the current data store Triples in the default graph will be put into the named graph specified using thedefaultGraphparameter.- Parameters:
defaultGraph- the resource identifying the default graphupdateType- specifies whether the imported data should be added or removed from the data storeinputSourceFactory- the content being importedformatName- the name of the format of the dataimportNotificationMonitor- receives errors/warnings encountered during import- Returns:
- provides information about the importation process
- Throws:
JRDFoxException- thrown if an error is encountered
-
importData
ImportResult importData(ResourceValue defaultGraph, UpdateType updateType, java.util.Collection<InputSourceFactory> inputSourceFactories, java.lang.String formatName, ImportNotificationMonitor importNotificationMonitor) throws JRDFoxExceptionImports the data described by the given input source factories into the current data store. Triples in the default graph will be put into the named graph specified using thedefaultGraphparameter. If this server is configured to use more than one thread, then sources are parsed and imported in parallel.- Parameters:
defaultGraph- the resource identifying the default graphupdateType- specifies whether the imported data should be added or removed from the data storeinputSourceFactories- the content being importedformatName- the name of the format of the dataimportNotificationMonitor- receives errors/warnings encountered during import- Returns:
- provides information about the importation process
- Throws:
JRDFoxException- thrown if an error is encountered
-
importData
ImportResult importData(ResourceValue defaultGraph, UpdateType updateType, java.io.File file) throws JRDFoxExceptionImports the data from the given file into the current data store. Triples in the default graph will be put into the named graph specified using thedefaultGraphparameter.- Parameters:
defaultGraph- the resource identifying the default graphupdateType- specifies whether the imported data should be added or removed from the data storefile- the content being imported- Returns:
- provides information about the importation process
- Throws:
JRDFoxException- thrown if an error is encountered
-
importData
ImportResult importData(ResourceValue defaultGraph, UpdateType updateType, java.lang.String content) throws JRDFoxExceptionImports the data from the given string into the current data store. Triples in the default graph will be put into the named graph specified using thedefaultGraphparameter.- Parameters:
defaultGraph- the resource identifying the default graphupdateType- specifies whether the imported data should be added or removed from the data storecontent- the content being imported- Returns:
- provides information about the importation process
- Throws:
JRDFoxException- thrown if an error is encountered
-
importData
ImportResult importData(ResourceValue defaultGraph, UpdateType updateType, java.io.InputStream inputStream) throws JRDFoxExceptionImports the data from the given input stream into the current data store. Triples in the default graph will be put into the named graph specified using thedefaultGraphparameter.- Parameters:
defaultGraph- the resource identifying the default graphupdateType- specifies whether the imported data should be added or removed from the data storeinputStream- the content being imported- Returns:
- provides information about the importation process
- Throws:
JRDFoxException- thrown if an error is encountered
-
importAxiomsFromTriples
ImportResult importAxiomsFromTriples(ResourceValue sourceGraph, boolean translateAssertions, ResourceValue destinationGraph, UpdateType updateType, ImportNotificationMonitor importNotificationMonitor) throws JRDFoxExceptionParses the given source graph into OWL axioms, and imports the axioms into the destination graph.- Parameters:
sourceGraph- the resource identifying the source graphtranslateAssertions- assertions are translated if this parameter istruedestinationGraph- the resource identifying the destination graphupdateType- specifies whether the imported data should be added or removed from the data storeimportNotificationMonitor- receives errors/warnings encountered during import- Returns:
- provides information about the importation process
- Throws:
JRDFoxException- thrown if an error is encountered
-
importAxiomsFromTriples
ImportResult importAxiomsFromTriples(ResourceValue sourceGraph, boolean translateAssertions, ResourceValue destinationGraph, UpdateType updateType) throws JRDFoxExceptionParses the given source graph into OWL axioms, and imports the axioms into the destination graph.- Parameters:
sourceGraph- the resource identifying the source graphtranslateAssertions- assertions are translated if this parameter istruedestinationGraph- the resource identifying the destination graphupdateType- specifies whether the imported data should be added or removed from the data store- Returns:
- provides information about the importation process
- Throws:
JRDFoxException- thrown if an error is encountered
-
listRules
Returns the information about the rules currently loaded into the data store.- Returns:
- information about the rules currently loaded into the data store
- Throws:
JRDFoxException- thrown if an error is encountered
-
addRule
Adds a rule to the data store.- Parameters:
rule- the rule to be added- Returns:
- the number of rules that were changed
- Throws:
JRDFoxException- thrown if an error is encountered
-
addRules
Adds a collection of rules to the data store.- Parameters:
datalogProgram- the rules to be added- Returns:
- the number of rules that were changed
- Throws:
JRDFoxException- thrown if an error is encountered
-
deleteRule
Deletes a rule to the data store.- Parameters:
rule- the rule to be deleted- Returns:
- the number of rules that were changed
- Throws:
JRDFoxException- thrown if an error is encountered
-
deleteRules
Deletes a collection of rules to the data store.- Parameters:
datalogProgram- the rules to be deleted- Returns:
- the number of rules that were changed
- Throws:
JRDFoxException- thrown if an error is encountered
-
recompile
Recompiles the rules and commit procedure using the currently available statistics. This method should be called after bulk updates to a data store in order to ensure that the rules are evaluated using efficient query plans. This operation can be invoked if either no transaction is active, or a read/write transaction is active.- Throws:
JRDFoxException- thrown if an error is encountered
-
requiresIncrementalReasoning
Returnstrueif the next data store update must be performed using incremental reasoning (rather than standard using the standard datalog materialization "from scratch" algorithm).- Returns:
trueif the next data store update must be performed using incremental reasoning- Throws:
JRDFoxException- thrown if an error is encountered
-
updateMaterialization
Updates the materialization so that all and only the consequences of the explicitly stated facts and the rules are derived. This operation is automatically applied internally so that all queries are always evaluated with respect to the updated materialization. However, requesting an update explicitly can be beneficial in some cases (e.g., when benchmarking reasoning algorithms). This operation can be invoked only if a read/write transaction is active.- Throws:
JRDFoxException- thrown if an error is encountered
-
recomputeMaterialization
Recomputes the materialization from scratch — that is, deletes all derived facts and applies all rules as if the data had just been freshly imported. This operation can be used when the data in a data source attached to a data store changes: since there is no way for an external data source to notify the data store of data changes, the only option is to recompute everything afresh. This operation can be invoked only if no transaction is active.- Throws:
JRDFoxException- thrown if an error is encountered
-
createExplanation
void createExplanation(java.lang.String factText, int maxDistanceFromRoot, int maxRuleInstancesPerFact, ExplanationType explanationType, java.io.OutputStream outputStream) throws JRDFoxExceptionComputes an explanation for a given fact and saves it in JSON format to the given output stream.- Parameters:
factText- the fact to be explainedmaxDistanceFromRoot- specifies how far in the proof tree to lookmaxRuleInstancesPerFact- specifies the maximum number of rule instances deriving a particular fact to considerexplanationType- determines the type of explanation that should be producedoutputStream- receives the explanation- Throws:
JRDFoxException- thrown if an error is encountered
-
createExplanation
void createExplanation(TupleTableAtom fact, int maxDistanceFromRoot, int maxRuleInstancesPerFact, ExplanationType explanationType, java.io.OutputStream outputStream) throws JRDFoxExceptionComputes an explanation for a given fact and saves it in JSON format to the given output stream.- Parameters:
maxDistanceFromRoot- specifies how far in the proof tree to lookmaxRuleInstancesPerFact- specifies the maximum number of rule instances deriving a particular fact to considerexplanationType- determines the type of explanation that should be producedoutputStream- receives the explanation- Throws:
JRDFoxException- thrown if an error is encountered
-
createCursor
Cursor createCursor(java.lang.String queryText, java.util.Map<java.lang.String,java.lang.String> compilationParameters, int fetchWindowSize) throws JRDFoxExceptionCreates a cursor over the results of the given query. Since calling C++ from Java is expensive, JRDFox cursors have the option to retrieve answers in batches, and the batch size is governed by thefetchWindowSizeparameter. Please note that data store version checking is performed only on each access to the C++ cursor; thus, if the batch size is different from one, then a JRDFox cursor might detect a data store change with a delay.- Parameters:
queryText- the query to be evaluatedcompilationParameters- the key-value pairs guiding query compilationfetchWindowSize- the number of answers that will be retrieved from C++ in each cursor operation- Returns:
- the cursor over the query results
- Throws:
JRDFoxException- thrown if an error is encountered
-
createCursor
Cursor createCursor(java.lang.String queryText, java.util.Map<java.lang.String,java.lang.String> compilationParameters) throws JRDFoxExceptionCreates a cursor over the results of the given query with the default fetch window size of 100.- Parameters:
queryText- the query to be evaluatedcompilationParameters- the key-value pairs guiding query compilation- Returns:
- the cursor over the query results
- Throws:
JRDFoxException- thrown if an error is encountered
-
createCursor
Cursor createCursor(Query query, java.util.Map<java.lang.String,java.lang.String> compilationParameters, int fetchWindowSize) throws JRDFoxExceptionCreates a cursor over the results of the given query. Since calling C++ from Java is expensive, JRDFox cursors have the option to retrieve answers in batches, and the batch size is governed by thefetchWindowSizeparameter. Please note that data store version checking is performed only on each access to the C++ cursor; thus, if the batch size is different from one, then a JRDFox cursor might detect a data store change with a delay.- Parameters:
query- the query to be evaluatedcompilationParameters- the key-value pairs guiding query compilationfetchWindowSize- the number of answers that will be retrieved from C++ in each cursor operation- Returns:
- the cursor over the query results
- Throws:
JRDFoxException- thrown if an error is encountered
-
createCursor
Cursor createCursor(Query query, java.util.Map<java.lang.String,java.lang.String> compilationParameters) throws JRDFoxExceptionCreates a cursor over the results of the given query with the default fetch window size of 100.- Parameters:
query- the query to be evaluatedcompilationParameters- the key-value pairs guiding query compilation- Returns:
- the cursor over the query results
- Throws:
JRDFoxException- thrown if an error is encountered
-
evaluateQuery
StatementResult evaluateQuery(java.lang.String queryText, java.util.Map<java.lang.String,java.lang.String> compilationParameters, QueryAnswerMonitor queryAnswerMonitor) throws JRDFoxExceptionEvaluates a query and calls the suppliedQueryAnswerMonitorinstance for each tuple in the result.- Parameters:
queryText- the query to be evaluatedcompilationParameters- the key-value pairs guiding query compilationqueryAnswerMonitor- an interface containing a callback method that is called for each tuple in the result- Returns:
- provides information about the number of results produced
- Throws:
JRDFoxException- thrown if an error is encountered
-
evaluateQuery
StatementResult evaluateQuery(Query query, java.util.Map<java.lang.String,java.lang.String> compilationParameters, QueryAnswerMonitor queryAnswerMonitor) throws JRDFoxExceptionEvaluates a query and calls the suppliedQueryAnswerMonitorinstance for each tuple in the result.- Parameters:
query- the query to be evaluatedcompilationParameters- the key-value pairs guiding query compilationqueryAnswerMonitor- an interface containing a callback method that is called for each tuple in the result- Returns:
- provides information about the number of results produced
- Throws:
JRDFoxException- thrown if an error is encountered
-
evaluateUpdate
StatementResult evaluateUpdate(java.lang.String updateText, java.util.Map<java.lang.String,java.lang.String> compilationParameters) throws JRDFoxExceptionEvaluates an update.- Parameters:
updateText- the update to be evaluatedcompilationParameters- the key-value pairs guiding statement compilation- Returns:
- provides information about the number of results produced
- Throws:
JRDFoxException- thrown if an error is encountered
-
evaluateUpdate
StatementResult evaluateUpdate(Update update, java.util.Map<java.lang.String,java.lang.String> compilationParameters) throws JRDFoxExceptionEvaluates an update.- Parameters:
update- the update to be evaluatedcompilationParameters- the key-value pairs guiding statement compilation- Returns:
- provides information about the number of results produced
- Throws:
JRDFoxException- thrown if an error is encountered
-
evaluateUpdates
StatementResult evaluateUpdates(java.util.List<Update> updates, java.util.Map<java.lang.String,java.lang.String> compilationParameters) throws JRDFoxExceptionEvaluates a list of updates.- Parameters:
updates- the list of updates to be evaluatedcompilationParameters- the key-value pairs guiding statement compilation- Returns:
- provides information about the number of results produced
- Throws:
JRDFoxException- thrown if an error is encountered
-
evaluateStatement
StatementResult evaluateStatement(java.lang.String statementText, java.util.Map<java.lang.String,java.lang.String> compilationParameters, java.io.OutputStream outputStream, java.lang.String queryAnswerFormatName) throws JRDFoxExceptionEvaluates a statement and serializes the result to the supplied output stream using the specified format.- Parameters:
statementText- the statement to be evaluatedcompilationParameters- the key-value pairs guiding statement compilationoutputStream- receives the statement resultqueryAnswerFormatName- specifies the name of the answer format in case of a query- Returns:
- provides information about the number of results produced
- Throws:
JRDFoxException- thrown if an error is encountered
-
evaluateStatement
StatementResult evaluateStatement(Statement statement, java.util.Map<java.lang.String,java.lang.String> compilationParameters, java.io.OutputStream outputStream, java.lang.String queryAnswerFormatName) throws JRDFoxExceptionEvaluates a statement and serializes the result to the supplied output stream using the specified format.- Parameters:
statement- the statement to be evaluatedcompilationParameters- the key-value pairs guiding statement compilationoutputStream- receives the query resultqueryAnswerFormatName- specifies the name of the answer format in case of a query- Returns:
- provides information about the number of results produced
- Throws:
JRDFoxException- thrown if an error is encountered
-
evaluateStatement
StatementResult evaluateStatement(java.lang.String statementText, java.util.Map<java.lang.String,java.lang.String> compilationParameters, java.io.File file, java.lang.String queryAnswerFormatName) throws JRDFoxExceptionEvaluates a statement and serializes the result to the supplied file using the specified format.- Parameters:
statementText- the statement to be evaluatedcompilationParameters- the key-value pairs guiding statement compilationfile- receives the query resultqueryAnswerFormatName- specifies the name of the answer format in case of a query- Returns:
- provides information about the number of results produced
- Throws:
JRDFoxException- thrown if an error is encountered
-
evaluateStatement
StatementResult evaluateStatement(Statement statement, java.util.Map<java.lang.String,java.lang.String> compilationParameters, java.io.File file, java.lang.String queryAnswerFormatName) throws JRDFoxExceptionEvaluates a statement and serializes the result to the supplied file using the specified format.- Parameters:
statement- the statement to be evaluatedcompilationParameters- the key-value pairs guiding statement compilationfile- receives the query resultqueryAnswerFormatName- specifies the name of the answer format in case of a query- Returns:
- provides information about the number of results produced
- Throws:
JRDFoxException- thrown if an error is encountered
-