Interface RepoConnection
- All Superinterfaces:
Closeable
,StatementExecutor
,Wrapper
- All Known Implementing Classes:
GraphDBStorageConnection
,StorageConnection
A RDF4J repository connection wrapper.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addStatements
(Collection<org.eclipse.rdf4j.model.Statement> statements) Adds the specified statements to the underlying repository.void
begin()
Explicitly starts a transaction.void
commit()
Commits the changes made since transaction beginning.boolean
containsStatement
(org.eclipse.rdf4j.model.Resource subject, org.eclipse.rdf4j.model.IRI property, org.eclipse.rdf4j.model.Value value, boolean includeInferred, Set<org.eclipse.rdf4j.model.IRI> contexts) Checks whether the repository contains any statements matching the specified criteria.Collection<org.eclipse.rdf4j.model.Statement>
findStatements
(org.eclipse.rdf4j.model.Resource subject, org.eclipse.rdf4j.model.IRI property, org.eclipse.rdf4j.model.Value value, boolean includeInferred) Finds statements corresponding to the specified criteria.Collection<org.eclipse.rdf4j.model.Statement>
findStatements
(org.eclipse.rdf4j.model.Resource subject, org.eclipse.rdf4j.model.IRI property, org.eclipse.rdf4j.model.Value value, boolean includeInferred, Set<org.eclipse.rdf4j.model.IRI> contexts) Finds statements corresponding to the specified criteria.List<org.eclipse.rdf4j.model.Resource>
Gets resources representing currently existing contexts in the repository.org.eclipse.rdf4j.model.ValueFactory
Gets Rdf4j value factory.boolean
isInferred
(org.eclipse.rdf4j.model.Statement statement, Set<org.eclipse.rdf4j.model.IRI> contexts) Checks whether the specified statement is inferred by the repository.void
Removes statements that have the specified subject and predicate pairs.void
removeStatements
(Collection<org.eclipse.rdf4j.model.Statement> statements) Removes the specified statements from the underlying repository.void
rollback()
Rolls back changes made since transaction beginning.Methods inherited from interface cz.cvut.kbss.ontodriver.rdf4j.connector.StatementExecutor
executeBooleanQuery, executeSelectQuery, executeUpdate
-
Method Details
-
begin
Explicitly starts a transaction.- Throws:
Rdf4jDriverException
- If unable to start transaction
-
commit
Commits the changes made since transaction beginning.- Throws:
Rdf4jDriverException
- If an error occurs during commit- See Also:
-
rollback
Rolls back changes made since transaction beginning.- Throws:
Rdf4jDriverException
- If an error occurs when rolling back- See Also:
-
getContexts
Gets resources representing currently existing contexts in the repository.- Returns:
- List of resources
- Throws:
Rdf4jDriverException
- If repository access error occurs
-
getValueFactory
org.eclipse.rdf4j.model.ValueFactory getValueFactory()Gets Rdf4j value factory.- Returns:
ValueFactory
-
findStatements
Collection<org.eclipse.rdf4j.model.Statement> findStatements(org.eclipse.rdf4j.model.Resource subject, org.eclipse.rdf4j.model.IRI property, org.eclipse.rdf4j.model.Value value, boolean includeInferred) throws Rdf4jDriverException Finds statements corresponding to the specified criteria.Note that some of the parameters are optional.
This version searches the default context.
- Parameters:
subject
- Statement subject, optionalproperty
- Statement property, optionalvalue
- Statement value, optionalincludeInferred
- Whether to include inferred statements as well- Returns:
- Collection of matching statements
- Throws:
Rdf4jDriverException
- If a repository access error occurs- See Also:
-
findStatements
Collection<org.eclipse.rdf4j.model.Statement> findStatements(org.eclipse.rdf4j.model.Resource subject, org.eclipse.rdf4j.model.IRI property, org.eclipse.rdf4j.model.Value value, boolean includeInferred, Set<org.eclipse.rdf4j.model.IRI> contexts) throws Rdf4jDriverException Finds statements corresponding to the specified criteria.Note that some parameters are optional
- Parameters:
subject
- Statement subject, optionalproperty
- Statement property, optionalvalue
- Statement value, optionalincludeInferred
- Whether to include inferred statements as wellcontexts
- Contexts in which the search should be performed. Empty collection indicates the default context will be searched- Returns:
- Collection of matching statements
- Throws:
Rdf4jDriverException
- If a repository access error occurs
-
containsStatement
boolean containsStatement(org.eclipse.rdf4j.model.Resource subject, org.eclipse.rdf4j.model.IRI property, org.eclipse.rdf4j.model.Value value, boolean includeInferred, Set<org.eclipse.rdf4j.model.IRI> contexts) throws Rdf4jDriverException Checks whether the repository contains any statements matching the specified criteria.- Parameters:
subject
- Statement subject, optionalproperty
- Statement property, optionalvalue
- Statement value, optionalincludeInferred
- Whether to include inferred statements as wellcontexts
- Optionally specify contexts in which the search should be performed. If empty, the default one is used- Returns:
- Boolean indicating whether the statement exists
- Throws:
Rdf4jDriverException
- If a repository access error occurs
-
isInferred
boolean isInferred(org.eclipse.rdf4j.model.Statement statement, Set<org.eclipse.rdf4j.model.IRI> contexts) throws Rdf4jDriverException Checks whether the specified statement is inferred by the repository.Note that given the nature of the RDF4J API, this method will return
false
even if the statement is both asserted and inferred, as there is no way to easily ask only for inferred statements but both asserted and inferred statements are returned.Also note that if the repository does not contain the statement at all,
false
is returned.- Parameters:
statement
- Statement whose inference to checkcontexts
- Optionally specify contexts in which the search should be performed. If empty, the default one is used- Returns:
true
iff the specified statement is inferred in any of the specified contexts- Throws:
Rdf4jDriverException
- If a repository access error occurs
-
addStatements
void addStatements(Collection<org.eclipse.rdf4j.model.Statement> statements) throws Rdf4jDriverException Adds the specified statements to the underlying repository.Note that this operation is transactional and the changes are required to be persistent only after successful
commit()
.- Parameters:
statements
- The statements to add- Throws:
IllegalStateException
- If transaction is not activeRdf4jDriverException
- If a repository access error occurs
-
removeStatements
void removeStatements(Collection<org.eclipse.rdf4j.model.Statement> statements) throws Rdf4jDriverException Removes the specified statements from the underlying repository.Note that this operation is transactional and the changes are required to be persistent only after successful
commit()
.- Parameters:
statements
- The statements to remove- Throws:
IllegalStateException
- If transaction is not activeRdf4jDriverException
- If a repository access error occurs
-
removePropertyValues
Removes statements that have the specified subject and predicate pairs.- Parameters:
spc
- Subject-predicate-contexts tuples- Throws:
Rdf4jDriverException
- If a repository access error occurs
-