Examples of ExprEvalException


Examples of com.hp.hpl.jena.sparql.expr.ExprEvalException

                    total = nv ;
                else
                    total = XSDFuncOp.numAdd(nv, total) ;
            }
            else
                throw new ExprEvalException("Not a number: "+nv) ;
        }
View Full Code Here

Examples of com.hp.hpl.jena.sparql.expr.ExprEvalException

                    total = nv ;
                else
                    total = XSDFuncOp.numAdd(nv, total) ;
            }
            else
                throw new ExprEvalException("avg: not a number: "+nv) ;

            if ( DEBUG ) System.out.println("avg: ("+total+","+count+")") ;
        }
View Full Code Here

Examples of com.hp.hpl.jena.sparql.expr.ExprEvalException

        if ( args == null )
            // The contract on the function interface is that this should not happen.
            throw new ARQInternalErrorException(Utils.className(this)+": Null args list") ;
       
        if ( args.size() != 2 )
            throw new ExprEvalException(Utils.className(this)+": Wrong number of arguments: Wanted 2, got "+args.size()) ;
       
        NodeValue v1 = args.get(0) ;
        NodeValue v2 = args.get(1) ;
       
        return exec(v1, v2) ;
View Full Code Here

Examples of com.hp.hpl.jena.sparql.expr.ExprEvalException

        if ( args == null )
            // The contract on the function interface is that this should not happen.
            throw new ARQInternalErrorException("Function '"+Utils.className(this)+" Null args list") ;
       
        if ( args.size() != 0 )
            throw new ExprEvalException("Function '"+Utils.className(this)+" Wanted 0, got "+args.size()) ;
       
        return exec() ;
    }
View Full Code Here

Examples of com.hp.hpl.jena.sparql.expr.ExprEvalException

            // http://www.w3.org/TR/xpath-functions/#casting
            String s = null ;
            Node n = v.asNode() ;

            if ( n.isBlank() )
                throw new ExprEvalException("CastXSD: Can't cast blank nodes: "+v) ;

            if ( n.isURI() )
            {
                if ( castType.equals(XSDDatatype.XSDstring) )
                    s = n.getURI() ;
                else
                    throw new ExprEvalException("CastXSD: Can't cast node: "+v+" to "+castType.getURI()) ;
            }
            else if ( n.isLiteral() )
                // What if there is a lang tag?
                s = n.getLiteralLexicalForm() ;
            else
                throw new ExprEvalException("CastXSD: Can't cast node: "+v+ "(not a literal, not URI to string)") ;

            if ( s == null && v.isString() )
                s = v.getString() ;

            if ( s == null )
                throw new ExprEvalException("CastXSD: Can't cast: "+v+ "(has no string appearance)") ;
           
            //        // Special case - non-normalised xsd:booleans use 0 and 1.
            //        if ( v.isBoolean() )
            //        {
            //            if ( s.equals("0") ) s = "false" ;
View Full Code Here

Examples of com.hp.hpl.jena.sparql.expr.ExprEvalException

                     castType.equals(XSDDatatype.XSDdouble) ||
                     castType.equals(XSDDatatype.XSDboolean) ||
                     castType instanceof XSDAbstractDateTimeType )   // Includes durations, and Gregorian
                {
                    if ( s.startsWith(" ") || s.endsWith(" ") )
                        throw new ExprEvalException("CastXSD: Not a valid literal form (has whitespace): '"+s+"'") ;
                }
            }

            // Plain cast.
            try {
                if ( ! castType.isValid(s) )
                    throw new ExprEvalException("CastXSD: Not a valid literal form: '"+s+"'") ;
                // Unfortunately, validity testing happens in NodeValue.makeNode as well.
                // but better error messages this way.
                return NodeValue.makeNode(s, castType) ;
            } catch (RuntimeException ex) {
                throw new ExprEvalException("CastXSD: Not a strictly valid literal form: '"+s+"'") ;
            }
        }
View Full Code Here

Examples of com.hp.hpl.jena.sparql.expr.ExprEvalException

{
    @Override
    public QueryIterator execEvaluated(Binding binding, Node subject, Node predicate, Node object, ExecutionContext execCxt)
    {
        if ( Var.isVar(subject) )
            throw new ExprEvalException("bnode: subject is an unbound variable") ;
        if ( ! subject.isBlank() )
            return IterLib.noResults(execCxt) ;
        String str = subject.getBlankNodeLabel() ;
        Node obj = Node.createLiteral(str) ;
        if ( Var.isVar(object) )
View Full Code Here

Examples of com.hp.hpl.jena.sparql.expr.ExprEvalException

    @Override
    public QueryIterator execEvaluated(Binding binding, Node subject, Node predicate, PropFuncArg object,
                                       ExecutionContext execCxt)
    {
        if ( ! Var.isVar(subject) )
            throw new ExprEvalException("Subject is not a variable ("+subject+")") ;
       
        String x = "" ;
        for ( Node node : object.getArgList() )
        {
            if ( Var.isVar(node) )
View Full Code Here

Examples of com.hp.hpl.jena.sparql.expr.ExprEvalException

    /** check and get a string (may be a simple literal, literal with language tag or an XSD string). */
    public static Node checkAndGetStringLiteral(String label, NodeValue nv)
    {
        Node n = nv.asNode() ;
        if ( ! n.isLiteral() )
            throw new ExprEvalException(label+": Not a literal: "+nv) ;
        RDFDatatype dt = n.getLiteralDatatype() ;
        String lang = n.getLiteralLanguage() ;
       
        if ( dt != null && ! dt.equals(XSDDatatype.XSDstring) )
            throw new ExprEvalException(label+": Not a string literal: "+nv) ;
        return n ;
    }
View Full Code Here

Examples of com.hp.hpl.jena.sparql.expr.ExprEvalException

        if ( n1.getLiteralDatatype() != null )
        {
            // n1 is an xsd string by checkAndGetString
            if ( XSDDatatype.XSDstring.equals(n2.getLiteralDatatypeURI()) ) return ;
            if ( n2.getLiteralLanguage().equals("") ) return ;
            throw new ExprEvalException(label+": Incompatible: "+arg1+" and "+arg2) ;
        }
       
        // Incompatible?
        // arg1 simple or xsd:string, arg2 has a lang.
        if ( lang1.equals("") && ! lang2.equals("") )
            throw new ExprEvalException(label+": Incompatible: "+arg1+" and "+arg2) ;
        // arg1 with lang, arg2 has a different lang.
        if ( ! lang1.equals("") && (!lang2.equals("") && ! lang1.equals(lang2) ) ) 
            throw new ExprEvalException(label+": Incompatible: "+arg1+" and "+arg2) ;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.