Package com.hp.hpl.jena.sparql.expr

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


    public NodeValue exec()
    {
        Object obj = getContext().get(systemSymbol) ;
       
        if ( obj == null )
            throw new ExprEvalException("null for system symbol: "+systemSymbol) ;
        if ( ! ( obj instanceof Node ) )
            throw new ExprEvalException("Not a Node: "+Utils.className(obj)) ;
       
        Node n = (Node)obj ;
//        if ( n == null )
//            throw new ExprEvalException("No value for system variable: "+systemSymbol) ; 
        // NodeValue.makeNode could have a cache.
View Full Code Here


    @Override
    public NodeValue exec(NodeValue v)
    {
        Node n = v.asNode() ;
        if ( ! n.isURI() )
            throw new ExprEvalException("Not a URI: "+FmtUtils.stringForNode(n)) ;
        String str = n.getNameSpace() ;
        return NodeValue.makeString(str) ;
    }
View Full Code Here

    @Override
    public NodeValue exec(NodeValue v)
    {
        Node n = v.asNode() ;
        if ( ! n.isBlank() )
            throw new ExprEvalException("bnode: not a blank node") ;
       
        NodeValue nv = NodeValue.makeString(n.getBlankNodeId().getLabelString()) ;
        return nv ;
    }
View Full Code Here

    @Override
    public NodeValue exec(NodeValue v)
    {
        Node n = v.asNode() ;
        if ( ! n.isURI() )
            throw new ExprEvalException("Not a URI: "+FmtUtils.stringForNode(n)) ;
        String str = n.getLocalName() ;
        return NodeValue.makeString(str) ;
    }
View Full Code Here

    }
    @Override
    public NodeValue exec(List<NodeValue> args)
    {
        if ( args.size() > 3 )
            throw new ExprEvalException("substring: Wrong number of arguments: "+
                                        args.size()+" : [wanted 2 or 3]") ;
       
        NodeValue v1 = args.get(0) ;
        NodeValue v2 = args.get(1) ;
        NodeValue v3 = null ;
View Full Code Here

    @Override
    public NodeValue exec(NodeValue nv)
    {
        if ( ! nv.isInteger() )
            throw new ExprEvalException("Not an integer") ;
        int x = nv.getInteger().intValue() ;
        Lib.sleep(x) ;
        return nv ;
    }
View Full Code Here

    public NodeValue exec(NodeValue v)
    {
        if ( ! v.isString() )
        {
            Log.warn(this, "date: argument not a string: "+v) ;
            throw new ExprEvalException("date: argument not a string: "+v) ;
        }
       
        String lexicalForm = v.getString() ;
       
        // Quite picky about format
        if ( ! lexicalForm.matches("\\d{4}-\\d{2}-\\d{2}") )
        {
            Log.warn(this, "date: argument not in date format: "+v) ;
            throw new ExprEvalException("date: argument not in date format: "+v) ;
        }
       
        lexicalForm=lexicalForm+"T00:00:00Z" ;
       
        NodeValue nv = NodeValue.makeNode(lexicalForm, XSDDatatype.XSDdateTime) ;
View Full Code Here

{
    @Override
    public NodeValue exec(NodeValue x)
    {
        if ( ! x.isInteger() )
            throw new ExprEvalException("evenInteger: Not an intger: "+x) ;
        int i = x.getInteger().getLowestSetBit() ;
       
        boolean b = (i == -1) || ( i != 0 )
       
        return NodeValue.makeNodeBoolean( b ) ;
View Full Code Here

    }

    @Override
    public NodeValue exec(List<NodeValue> args) {
        if ( args.size() > 1 )
            throw new ExprEvalException("replace: Wrong number of arguments: "+args.size()+" : [wanted 1]") ;
       
        NodeValue v1 = args.get(0) ;
       
        return convert(v1) ;
    }
View Full Code Here

                Node n = argObject.getArg(i) ;
                int nInt = asInteger(n) ;
                if ( isInteger(nInt) )
                {
                    if ( limit > 0 )
                        throw new ExprEvalException("2 potential limits to Lucene search: "+argObject) ;
                    limit = nInt ;
                    if ( limit < 0 )
                        limit = Query.NOLIMIT ;
                    continue ;
                }
               
                float nFloat = asFloat(n) ;
                if ( isFloat(nFloat) )
                {
                    if ( scoreLimit > 0 )
                        throw new ExprEvalException("2 potential score limits to Lucene search: "+argObject) ;
                    if ( nFloat < 0 )
                        throw new ExprEvalException("Negative score limit to Lucene search: "+argObject) ;
                    scoreLimit = nFloat ;
                    continue ;
                }
                throw new ExprEvalException("Bad argument to Lucene search: "+argObject) ;
            }
           
            if ( scoreLimit < 0 )
                scoreLimit = 0.0f ;
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.sparql.expr.ExprEvalException

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.