use of org.apache.jena.rdf.model.RSIterator in project jena by apache.
the class SecuredModelImpl method removeAllReifications.
/**
* @sec.graph Update
* @sec.triple Delete on every reification statement for each statement in
* statements.
* @throws UpdateDeniedException
* @throws DeleteDeniedException
* @throws AuthenticationRequiredException if user is not authenticated and is
* required to be.
*/
@Override
public void removeAllReifications(final Statement s) throws UpdateDeniedException, DeleteDeniedException, AuthenticationRequiredException {
checkUpdate();
if (canDelete(new Triple(Node.ANY, RDF.subject.asNode(), wildCardNode(s.getSubject()))) && canDelete(new Triple(Node.ANY, RDF.predicate.asNode(), wildCardNode(s.getPredicate()))) && canDelete(new Triple(Node.ANY, RDF.object.asNode(), wildCardNode(s.getObject())))) {
holder.getBaseItem().removeAllReifications(s);
} else {
final RSIterator iter = holder.getBaseItem().listReifiedStatements(s);
try {
while (iter.hasNext()) {
final ReifiedStatement rs = iter.next();
checkDelete(new Triple(rs.asNode(), RDF.subject.asNode(), wildCardNode(s.getSubject())));
checkDelete(new Triple(rs.asNode(), RDF.predicate.asNode(), wildCardNode(s.getPredicate())));
checkDelete(new Triple(rs.asNode(), RDF.object.asNode(), wildCardNode(s.getObject())));
}
holder.getBaseItem().removeAllReifications(s);
} finally {
iter.close();
}
}
}
use of org.apache.jena.rdf.model.RSIterator in project jena by apache.
the class SecuredStatementImpl method removeReification.
/**
* @sec.graph Update
* @sec.triple Delete
* @throws UpdateDeniedException
* @throws DeleteDeniedException
* @throws AuthenticationRequiredException if user is not authenticated and is
* required to be.
*/
@Override
public void removeReification() throws UpdateDeniedException, DeleteDeniedException, AuthenticationRequiredException {
checkUpdate();
if (!canDelete(Triple.ANY)) {
StmtIterator iter = null;
final RSIterator rsIter = holder.getBaseItem().listReifiedStatements();
try {
while (rsIter.hasNext()) {
final ReifiedStatement stmt = rsIter.next();
iter = stmt.listProperties();
while (iter.hasNext()) {
final Statement s = iter.next();
checkDelete(s);
}
}
} finally {
rsIter.close();
if (iter != null) {
iter.close();
}
}
}
holder.getBaseItem().removeReification();
}
Aggregations