use of org.eclipse.rdf4j.query.algebra.SingletonSet in project rdf4j by eclipse.
the class TupleExprBuilder method visit.
@Override
public TupleExpr visit(ASTDescribe node, Object data) throws VisitorException {
TupleExpr tupleExpr = (TupleExpr) data;
if (tupleExpr == null) {
tupleExpr = new SingletonSet();
}
Extension e = new Extension();
ProjectionElemList projectionElements = new ProjectionElemList();
for (int i = 0; i < node.jjtGetNumChildren(); i++) {
ValueExpr resource = (ValueExpr) node.jjtGetChild(i).jjtAccept(this, null);
if (resource instanceof Var) {
projectionElements.addElement(new ProjectionElem(((Var) resource).getName()));
} else {
String alias = "_describe_" + UUID.randomUUID().toString().replaceAll("-", "_");
ExtensionElem elem = new ExtensionElem(resource, alias);
e.addElement(elem);
projectionElements.addElement(new ProjectionElem(alias));
}
}
if (!e.getElements().isEmpty()) {
e.setArg(tupleExpr);
tupleExpr = e;
}
Projection p = new Projection(tupleExpr, projectionElements);
return new DescribeOperator(p);
}
Aggregations