use of org.eclipse.rdf4j.query.algebra.FunctionCall in project rdf4j by eclipse.
the class QueryModelBuilder method visit.
@Override
public FunctionCall visit(ASTFunctionCall node, Object data) throws VisitorException {
ValueConstant vc = (ValueConstant) node.getURI().jjtAccept(this, null);
assert vc.getValue() instanceof IRI;
FunctionCall functionCall = new FunctionCall(vc.getValue().toString());
for (ASTValueExpr argExpr : node.getArgList().getElements()) {
functionCall.addArg((ValueExpr) argExpr.jjtAccept(this, null));
}
return functionCall;
}
use of org.eclipse.rdf4j.query.algebra.FunctionCall in project rdf4j by eclipse.
the class TupleExprBuilder method visit.
@Override
public Object visit(ASTFunctionCall node, Object data) throws VisitorException {
ValueConstant uriNode = (ValueConstant) node.jjtGetChild(0).jjtAccept(this, null);
IRI functionURI = (IRI) uriNode.getValue();
FunctionCall functionCall = new FunctionCall(functionURI.toString());
for (int i = 1; i < node.jjtGetNumChildren(); i++) {
Node argNode = node.jjtGetChild(i);
functionCall.addArg((ValueExpr) argNode.jjtAccept(this, null));
}
return functionCall;
}
use of org.eclipse.rdf4j.query.algebra.FunctionCall in project rdf4j by eclipse.
the class TupleExprBuilder method createFunctionCall.
private FunctionCall createFunctionCall(String uri, SimpleNode node, int minArgs, int maxArgs) throws VisitorException {
FunctionCall functionCall = new FunctionCall(uri);
int noOfArguments = node.jjtGetNumChildren();
if (noOfArguments > maxArgs || noOfArguments < minArgs) {
throw new VisitorException("unexpected number of arguments (" + noOfArguments + ") for function " + uri);
}
for (int i = 0; i < noOfArguments; i++) {
Node argNode = node.jjtGetChild(i);
functionCall.addArg((ValueExpr) argNode.jjtAccept(this, null));
}
return functionCall;
}
Aggregations