Package com.hp.hpl.jena.sparql.sse.builders

Examples of com.hp.hpl.jena.sparql.sse.builders.ExprBuildException


        this.argList = new ArrayList<Var>(argList);
       
        //Verify that all mentioned variables are in the arguments list
        Set<Var> mentioned = this.expr.getVarsMentioned();
        for (Var v : mentioned) {
          if (!argList.contains(v)) throw new ExprBuildException("Cannot use the variable " + v.toString() + " in the expression since it is not included in the argList argument.  All variables must be arguments to the function");
        }       
        //If used variables is greater than argument variables this is an error
        if (mentioned.size() > this.argList.size()) throw new ExprBuildException("Mismatch between variables used in expression and number of variables in argument list, expected " + this.argList.size() + " but found " + mentioned.size());
        //May have more arguments than used, however this only gives warning(s)
        if (mentioned.size() < this.argList.size()) {
          for (Var v : this.argList) {
            if (!mentioned.contains(v) && warnOnUnusedVariable) LOG.warn("Function <" + uri + "> has argument " + v + " which is never used in the expression");
          }
View Full Code Here


     */
    @Override
    public Function create(String uri) {
        UserDefinedFunctionDefinition def = this.definitions.get(uri);
        if (def == null)
            throw new ExprBuildException("Function <" + uri + "> not known by this function factory");
        return def.newFunctionInstance();
    }
View Full Code Here

                    subArgs.add(arg);
                } else {
                    //Variable args must be checked to ensure they are within the number of
                    //arguments of the invoked function
                    //We then use the arg as-is to substitute
                    if (i > defArgs.size()) throw new ExprBuildException("Unable to expand function dependency, the function <" + def.getUri() + "> is called but uses an argument ?" + var + " which is not an argument to the outer function");
                    subArgs.add(arg);
                }
            }
           
            //Expand the function
View Full Code Here

     * @throws ExprBuildException Thrown if an expression cannot be generated
     */
    @Override
    public void build(String uri, ExprList args) {
        //Substitutes the arguments into the base expression to give the actual expression to evaluate
        if (uri == null || !uri.equals(this.getUri())) throw new ExprBuildException("Incorrect URI passed to build() call, expected <" + this.getUri() + "> but got <" + uri + ">");
        if (this.getArgList().size() != args.size()) throw new ExprBuildException("Incorrect number of arguments for user defined <" + this.getUri() + "> function");
       
        Map<String, Expr> substitutions = new HashMap<String, Expr>();
        for (int i = 0; i < this.getArgList().size(); i++) {
            substitutions.put(this.getArgList().get(i).getVarName(), args.get(i));
        }
View Full Code Here

        this.argList = new ArrayList<>(argList);
       
        //Verify that all mentioned variables are in the arguments list
        Set<Var> mentioned = this.expr.getVarsMentioned();
        for (Var v : mentioned) {
          if (!argList.contains(v)) throw new ExprBuildException("Cannot use the variable " + v.toString() + " in the expression since it is not included in the argList argument.  All variables must be arguments to the function");
        }       
        //If used variables is greater than argument variables this is an error
        if (mentioned.size() > this.argList.size()) throw new ExprBuildException("Mismatch between variables used in expression and number of variables in argument list, expected " + this.argList.size() + " but found " + mentioned.size());
        //May have more arguments than used, however this only gives warning(s)
        if (mentioned.size() < this.argList.size()) {
          for (Var v : this.argList) {
            if (!mentioned.contains(v) && warnOnUnusedVariable) LOG.warn("Function <" + uri + "> has argument " + v + " which is never used in the expression");
          }
View Full Code Here

     */
    @Override
    public Function create(String uri) {
        UserDefinedFunctionDefinition def = this.definitions.get(uri);
        if (def == null)
            throw new ExprBuildException("Function <" + uri + "> not known by this function factory");
        return def.newFunctionInstance();
    }
View Full Code Here

     * @throws ExprBuildException Thrown if an expression cannot be generated
     */
    @Override
    public void build(String uri, ExprList args) {
        //Substitutes the arguments into the base expression to give the actual expression to evaluate
        if (uri == null || !uri.equals(this.getUri())) throw new ExprBuildException("Incorrect URI passed to build() call, expected <" + this.getUri() + "> but got <" + uri + ">");
        if (this.getArgList().size() != args.size()) throw new ExprBuildException("Incorrect number of arguments for user defined <" + this.getUri() + "> function");
       
        Map<String, Expr> substitutions = new HashMap<>();
        for (int i = 0; i < this.getArgList().size(); i++) {
            substitutions.put(this.getArgList().get(i).getVarName(), args.get(i));
        }
View Full Code Here

     * @throws ExprBuildException Thrown if the given URI is not a known function
     */
    @Override
    public Function create(String uri) {
        UserDefinedFunctionDefinition def = this.definitions.get(uri);
        if (def == null) throw new ExprBuildException("Function <" + uri + "> not known by this function factory");
        return def.newFunctionInstance();
    }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.sparql.sse.builders.ExprBuildException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.