body = new Filter(body, new Compare(new FunctionCall( RR.STAR_SELECT_GRAPH.stringValue(), filterGraphVars), new Var("_const-" + UUID.randomUUID(), RDF.NIL), CompareOp.NE)); body = new Extension(body, new ExtensionElem(new FunctionCall( RR.STAR_SELECT_GRAPH.stringValue(), bindGraphVars), prefix));
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; }
@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; }
@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; }
expr = new FunctionCall(funcName, args);
return new Str(toValue(expr.getArg(0), md)); } else if (op == Ops.NUMCAST) { return new FunctionCall(toVar(expr.getArg(1), md).getValue().stringValue(), toValue(expr.getArg(0), md)); } else if (FUNCTION_OPS.containsKey(op)) { List<ValueExpr> args = new ArrayList<ValueExpr>(expr.getArgs().size()); args.add(toValue(e, md)); return new FunctionCall(FUNCTION_OPS.get(op), args); } else { throw new IllegalArgumentException(expr.toString());
return new Str(toValue(expr.getArg(0), md)); }else if (op == Ops.NUMCAST){ return new FunctionCall(toVar(expr.getArg(1), md).getValue().stringValue(), toValue(expr.getArg(0), md)); }else if (FUNCTION_OPS.containsKey(op)){ List<ValueExpr> args = new ArrayList<ValueExpr>(expr.getArgs().size()); args.add(toValue(e, md)); return new FunctionCall(FUNCTION_OPS.get(op), args); }else{ throw new IllegalArgumentException(expr.toString());
return new Str(toValue(expr.getArg(0), md)); } else if (op == Ops.NUMCAST) { return new FunctionCall(toVar(expr.getArg(1), md).getValue().stringValue(), toValue(expr.getArg(0), md)); } else if (FUNCTION_OPS.containsKey(op)) { List<ValueExpr> args = new ArrayList<ValueExpr>(expr.getArgs().size()); args.add(toValue(e, md)); return new FunctionCall(FUNCTION_OPS.get(op), args); } else { throw new IllegalArgumentException(expr.toString());