use of org.apache.jena.graph.Triple in project jena by apache.
the class SecuredModelImpl method getBag.
@Override
public SecuredBag getBag(final Resource r) throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
checkRead(new Triple(r.asNode(), RDF.type.asNode(), RDF.Bag.asNode()));
return SecuredBagImpl.getInstance(holder.getSecuredItem(), holder.getBaseItem().getBag(r));
}
use of org.apache.jena.graph.Triple in project jena by apache.
the class SecuredModelImpl method remove.
@Override
public SecuredModel remove(final Resource s, final Property p, final RDFNode o) throws UpdateDeniedException, DeleteDeniedException, AuthenticationRequiredException {
checkUpdate();
checkDelete(new Triple(s.asNode(), p.asNode(), o.asNode()));
holder.getBaseItem().remove(s, p, o);
return holder.getSecuredItem();
}
use of org.apache.jena.graph.Triple in project jena by apache.
the class SecuredModelImpl method createBag.
@Override
public SecuredBag createBag() throws UpdateDeniedException, AddDeniedException, AuthenticationRequiredException {
checkUpdate();
checkCreate(new Triple(SecurityEvaluator.FUTURE, RDF.type.asNode(), RDF.Bag.asNode()));
return SecuredBagImpl.getInstance(holder.getSecuredItem(), holder.getBaseItem().createBag());
}
use of org.apache.jena.graph.Triple in project jena by apache.
the class SecuredModelImpl method createResource.
@Override
public SecuredResource createResource(final String uri, final Resource type) throws UpdateDeniedException, AddDeniedException, AuthenticationRequiredException {
final Resource r = ResourceFactory.createResource(uri);
final Triple t = new Triple(r.asNode(), RDF.type.asNode(), type.asNode());
if (holder.getBaseItem().contains(r, RDF.type, type)) {
checkRead();
checkRead(t);
} else {
checkUpdate();
checkCreate(t);
}
return SecuredResourceImpl.getInstance(holder.getSecuredItem(), holder.getBaseItem().createResource(uri, type));
}
use of org.apache.jena.graph.Triple in project jena by apache.
the class SecuredModelImpl method removeAllReifications.
@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();
}
}
}
Aggregations