I want to delete any statement that has a specific IRI as the predicate or object (with any context) but the StartdogRepositoryConnection is not actually doing what it is supposed to do.
Steps to reproduce
// ... repository initialization
RepositoryConnection connection = stardogRepository.getConnection();
// Remove all statements with `someIRI` as the object
connection.remove( (Resource) null, null, someIRI );
// Remove all statements with `someIRI` as the predicate
connection.remove( (Resource) null, someIRI, null );
Expected results
Any statement, from any context with the specified patterns is deleted.
Actual results
Nothing (maybe just the general graph is affected).
Workaround
// ... repository initialization
RepositoryConnection connection = stardogRepository.getConnection();
try ( RepositoryResult<Statement> statementsWithSomeIRIAsAnObject = connection.getStatements( null, null, someIRI, false ) ) {
connection.remove( statementsWithSomeIRIAsAnObject );
}
try ( RepositoryResult<Statement> statementsWithSomeIRIAsAPredicate = connection.getStatements( null, someIRI, null, false ) ) {
connection.remove( statementsWithSomeIRIAsAPredicate );
}
Environment
Stardog: 5.0.3
Stardog/RDF4J bindings: com.complexible.stardog.rdf4j:stardog-rdf4j:5.0.3
Notes
- I turned on the
query.all.graphs
option but the results are the same.