use of org.apache.jena.sparql.path.P_Seq in project jena by apache.
the class WhereClauseTest method testAddOptionalStringWithPath.
@ContractTest
public void testAddOptionalStringWithPath() {
WhereClause<?> whereClause = getProducer().newInstance();
AbstractQueryBuilder<?> builder = whereClause.addOptional("<one>", "<two>/<dos>", "three");
Path path = new P_Seq(new P_Link(NodeFactory.createURI("two")), new P_Link(NodeFactory.createURI("dos")));
ElementPathBlock epb = new ElementPathBlock();
ElementOptional optional = new ElementOptional(epb);
TriplePath tp = new TriplePath(NodeFactory.createURI("one"), path, NodeFactory.createLiteral("three"));
epb.addTriplePath(tp);
WhereValidator visitor = new WhereValidator(optional);
builder.build().getQueryPattern().visit(visitor);
assertTrue(visitor.matching);
}
use of org.apache.jena.sparql.path.P_Seq in project jena by apache.
the class PathRewriter method visit.
@Override
public void visit(P_Seq pathSeq) {
pathSeq.getRight().visit(this);
pathSeq.getLeft().visit(this);
push(new P_Seq(pop(), pop()));
}
Aggregations