use of org.apache.jena.graph.FrontsTriple in project jena by apache.
the class WhereClauseTest method testAddGraph_frontsTriple.
@ContractTest
public void testAddGraph_frontsTriple() {
final Node s = NodeFactory.createURI("s");
final Node p = NodeFactory.createURI("p");
final Node o = NodeFactory.createURI("o");
FrontsTriple ft = new FrontsTriple() {
@Override
public Triple asTriple() {
return new Triple(s, p, o);
}
};
WhereClause<?> whereClause = getProducer().newInstance();
AbstractQueryBuilder<?> builder = whereClause.addGraph("<g>", ft);
Query query = builder.build();
ElementPathBlock epb = new ElementPathBlock();
ElementNamedGraph eng = new ElementNamedGraph(NodeFactory.createURI("g"), epb);
epb.addTriplePath(new TriplePath(new Triple(s, p, o)));
WhereValidator visitor = new WhereValidator(eng);
query.getQueryPattern().visit(visitor);
assertTrue(visitor.matching);
}
use of org.apache.jena.graph.FrontsTriple in project jena by apache.
the class SecuredItemImpl method checkCreateReified.
/**
* Check that a triple can be reified.
*
* @param uri The URI for the reification subject. May be null.
* @param front the frontstriple that is to be reified.
* @throws AddDeniedException on failure to add triple
* @throws UpdateDeniedException if the updates of the graph are not
* allowed.
* @throws AuthenticationRequiredException if user is not authenticated and is
* required to be.
*/
protected void checkCreateReified(final String uri, final FrontsTriple front) throws AddDeniedException, UpdateDeniedException, AuthenticationRequiredException {
checkUpdate();
Triple t = front.asTriple();
final Node n = uri == null ? SecurityEvaluator.FUTURE : NodeFactory.createURI(uri);
checkCreate(new Triple(n, RDF.subject.asNode(), t.getSubject()));
checkCreate(new Triple(n, RDF.predicate.asNode(), t.getPredicate()));
checkCreate(new Triple(n, RDF.object.asNode(), t.getObject()));
}
Aggregations