use of org.apache.jena.arq.querybuilder.ConstructBuilder in project jena by apache.
the class WhereHandlerTest method testMakeSubQueryFromConstruct.
@Test
public void testMakeSubQueryFromConstruct() {
AbstractQueryBuilder<?> sb = new ConstructBuilder().addConstruct("?x", RDF.type, NodeFactory.createURI("foo")).addWhere("?x", RDF.type, RDF.Alt);
ElementSubQuery esq = handler.makeSubQuery(sb);
Triple t1 = new Triple(NodeFactory.createVariable("x"), RDF.type.asNode(), RDF.Alt.asNode());
TriplePath tp = new TriplePath(t1);
ElementPathBlock epb = new ElementPathBlock();
epb.addTriple(tp);
Query q = new Query();
q.setQuerySelectType();
q.setQueryResultStar(true);
q.setQueryPattern(epb);
ElementSubQuery esq2 = new ElementSubQuery(q);
WhereValidator wv = new WhereValidator(esq2);
esq.visit(wv);
assertTrue(wv.matching);
}
Aggregations