Class SnapshotStorageConnector
- All Implemented Interfaces:
Closeable
,StatementExecutor
,StorageConnector
,Wrapper
JenaOntoDriverProperties.SNAPSHOT
-based
transactional strategy.
It is also used when inference is required from the driver.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the specified statements to the specified context in the storage.void
begin()
Begins a transaction.void
commit()
Commits the current transaction.boolean
contains
(org.apache.jena.rdf.model.Resource subject, org.apache.jena.rdf.model.Property property, org.apache.jena.rdf.model.RDFNode value, Collection<String> contexts) Checks whether the specified context (named graph) contains any statements matching the specified criteria.executeAskQuery
(org.apache.jena.query.Query query, Statement.StatementOntology target) Executes the specified SPARQL ASK query.executeSelectQuery
(org.apache.jena.query.Query query, Statement.StatementOntology target) Executes the specified SPARQL SELECT query, returning the Jena ARQ result set.void
executeUpdate
(String query, Statement.StatementOntology target) Executes the specified SPARQL 1.1 Update query.List<org.apache.jena.rdf.model.Statement>
find
(org.apache.jena.rdf.model.Resource subject, org.apache.jena.rdf.model.Property property, org.apache.jena.rdf.model.RDFNode value, Collection<String> contexts) Retrieves statements corresponding to the specified criteria from the specified named graph.Lists all contexts (named graph) in the repository (including the transactional ones).boolean
isOpen()
Retrieves status of this resource.void
Removes the specified statements from the specified context in the storage.void
remove
(org.apache.jena.rdf.model.Resource subject, org.apache.jena.rdf.model.Property property, org.apache.jena.rdf.model.RDFNode object, String context) Removes statements matching the specified pattern from the specified storage context.void
Removes all property values specified by the provided argument for the specified subject(s).void
rollback()
Rolls back the current transaction.<T> T
Returns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy.Methods inherited from class cz.cvut.kbss.ontodriver.jena.connector.SharedStorageConnector
close, reloadStorage, setDataset
-
Method Details
-
begin
public void begin()Description copied from interface:StorageConnector
Begins a transaction.- Specified by:
begin
in interfaceStorageConnector
- Overrides:
begin
in classSharedStorageConnector
-
commit
Description copied from interface:StorageConnector
Commits the current transaction.- Specified by:
commit
in interfaceStorageConnector
- Overrides:
commit
in classSharedStorageConnector
- Throws:
JenaDriverException
- If commit fails
-
rollback
public void rollback()Description copied from interface:StorageConnector
Rolls back the current transaction.- Specified by:
rollback
in interfaceStorageConnector
- Overrides:
rollback
in classSharedStorageConnector
-
find
public List<org.apache.jena.rdf.model.Statement> find(org.apache.jena.rdf.model.Resource subject, org.apache.jena.rdf.model.Property property, org.apache.jena.rdf.model.RDFNode value, Collection<String> contexts) Description copied from interface:StorageConnector
Retrieves statements corresponding to the specified criteria from the specified named graph.The first three parameters are optional, their absence signifies that any value in that position is acceptable.
contexts
are also optional, their absence means that the default graph should be used.- Specified by:
find
in interfaceStorageConnector
- Overrides:
find
in classSharedStorageConnector
- Parameters:
subject
- Statement subject, optionalproperty
- Property, optionalvalue
- Value, optionalcontexts
- Named graph IRIs, optional. If empty, the default graph will be used- Returns:
- Collection of matching statements
-
contains
public boolean contains(org.apache.jena.rdf.model.Resource subject, org.apache.jena.rdf.model.Property property, org.apache.jena.rdf.model.RDFNode value, Collection<String> contexts) Description copied from interface:StorageConnector
Checks whether the specified context (named graph) contains any statements matching the specified criteria.The first three parameters are optional, their absence signifies that any value in that position is acceptable.
context
is also optional, its absence means that the default graph should be used.- Specified by:
contains
in interfaceStorageConnector
- Overrides:
contains
in classSharedStorageConnector
- Parameters:
subject
- Subject, optionalproperty
- Property, optionalvalue
- Value, optionalcontexts
- Named graph IRIs, optional. If empty, the default graph will be used- Returns:
true
if at least one statement matches the criteria,false
otherwise
-
getContexts
Description copied from interface:StorageConnector
Lists all contexts (named graph) in the repository (including the transactional ones).- Specified by:
getContexts
in interfaceStorageConnector
- Overrides:
getContexts
in classSharedStorageConnector
- Returns:
- List of named graph URIs
-
add
Description copied from interface:StorageConnector
Adds the specified statements to the specified context in the storage.Requires an active transaction.
context
is optional, its absence means that the statements will be added into the the default graph.- Specified by:
add
in interfaceStorageConnector
- Overrides:
add
in classSharedStorageConnector
- Parameters:
statements
- Statements to addcontext
- Target context, optional
-
remove
Description copied from interface:StorageConnector
Removes the specified statements from the specified context in the storage.Requires an active transaction.
context
is optional, its absence means that the statements will be removed from the the default graph.- Specified by:
remove
in interfaceStorageConnector
- Overrides:
remove
in classSharedStorageConnector
- Parameters:
statements
- Statements to removecontext
- Target context, optional
-
remove
public void remove(org.apache.jena.rdf.model.Resource subject, org.apache.jena.rdf.model.Property property, org.apache.jena.rdf.model.RDFNode object, String context) Description copied from interface:StorageConnector
Removes statements matching the specified pattern from the specified storage context.context
is optional, its absence means that the statements will be removed from the the default graph.- Specified by:
remove
in interfaceStorageConnector
- Overrides:
remove
in classSharedStorageConnector
- Parameters:
subject
- Statement subject, optionalproperty
- Statement property, optionalobject
- Statement object, optionalcontext
- Repository context IRI, optional
-
removePropertyValues
Description copied from interface:StorageConnector
Removes all property values specified by the provided argument for the specified subject(s).- Specified by:
removePropertyValues
in interfaceStorageConnector
- Overrides:
removePropertyValues
in classSharedStorageConnector
- Parameters:
spc
- Subject-predicate-contexts tuples
-
executeSelectQuery
public AbstractResultSet executeSelectQuery(org.apache.jena.query.Query query, Statement.StatementOntology target) throws JenaDriverException Description copied from interface:StatementExecutor
Executes the specified SPARQL SELECT query, returning the Jena ARQ result set.The
target
specifies whether the query should be executed on the shared repository or whether the transactional snapshot will be used to evaluate the query. However, some implementations may ignore this parameter.- Specified by:
executeSelectQuery
in interfaceStatementExecutor
- Overrides:
executeSelectQuery
in classSharedStorageConnector
- Parameters:
query
- Query to executetarget
- Dataset on which the query should be executed- Returns:
- ARQ result set
- Throws:
JenaDriverException
- If query execution fails
-
executeAskQuery
public AbstractResultSet executeAskQuery(org.apache.jena.query.Query query, Statement.StatementOntology target) throws JenaDriverException Description copied from interface:StatementExecutor
Executes the specified SPARQL ASK query.The
target
specifies whether the query should be executed on the shared repository or whether the transactional snapshot will be used to evaluate the query. However, some implementations may ignore this parameter.- Specified by:
executeAskQuery
in interfaceStatementExecutor
- Overrides:
executeAskQuery
in classSharedStorageConnector
- Parameters:
query
- Query to executetarget
- Dataset on which the query should be executed- Returns:
- ASK result
- Throws:
JenaDriverException
- If query execution fails
-
executeUpdate
public void executeUpdate(String query, Statement.StatementOntology target) throws JenaDriverException Description copied from interface:StatementExecutor
Executes the specified SPARQL 1.1 Update query.The
target
specifies whether the query should be executed on the shared repository or whether the transactional snapshot will be used to evaluate the query. However, some implementations may ignore this parameter.- Specified by:
executeUpdate
in interfaceStatementExecutor
- Overrides:
executeUpdate
in classSharedStorageConnector
- Parameters:
query
- Query to executetarget
- Dataset on which the update should be executed- Throws:
JenaDriverException
- If query execution fails
-
isOpen
public boolean isOpen()Description copied from interface:Closeable
Retrieves status of this resource. -
unwrap
Description copied from interface:Wrapper
Returns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy. If the receiver implements the interface then the result is the receiver or a proxy for the receiver. If the receiver is a wrapper and the wrapped object implements the interface then the result is the wrapped object or a proxy for the wrapped object. Otherwise return the the result of calling unwrap recursively on the wrapped object or a proxy for that result. If the receiver is not a wrapper and does not implement the interface, then anOntoDriverException
is thrown.
-