Examples of ExprEvalException


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

    @Override
    public NodeValue exec(NodeValue nv)
    {
        if ( ! nv.isInteger() )
            throw new ExprEvalException("Not an integer") ;
        int x = nv.getInteger().intValue() ;
        Lib.sleep(x) ;
        return NodeValue.TRUE ;
    }
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 = NodeFactory.createLiteral(str) ;
        if ( Var.isVar(object) )
View Full Code Here

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

    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

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

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

                boolean b = n1.getLiteralLexicalForm().equals(n2.getLiteralLexicalForm()) ;
                if ( b )
                    return true ;
            }
            // Two literals, different terms, different language tags.
            NodeValue.raise(new ExprEvalException("Mismatch in RDFterm-equals: "+n1+", "+n2)) ;
        }
        // One or both not a literal.
        return false ;
    }
View Full Code Here

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

//        if ( node.isBlank() )   return node.getBlankNodeId().getLabelString() ;
//        if ( node.isBlank() )   return "" ;
        if ( node.isBlank() )
            NodeValue.raise(new ExprTypeException("Blank node: "+node)) ;
       
        NodeValue.raise(new ExprEvalException("Not a string: "+node)) ;
        return "[undef]" ;
    }
View Full Code Here

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

        }
       
        // Simple literal or xsd:string
        String str = simpleLiteralOrXSDString(nv) ;
        if  (str == null )
            throw new ExprEvalException("Can't make an IRI from "+nv) ;

        IRI iri = null ;
        String iriStr = nv.getLiteralLexicalForm() ;
           
        // Level of checking?
        if ( baseIRI != null )
        {
            IRI base = iriFactory.create(baseIRI);
            iri = base.create(iriStr);
        }
        else
            iri = iriFactory.create(iriStr);

        if ( ! iri.isAbsolute() )
            throw new ExprEvalException("Relative IRI string: "+iriStr) ;
        if ( warningsForIRIs && iri.hasViolation(false) )
        {
            String msg = "unknown violation from IRI library" ;
            Iterator<Violation> iter = iri.violations(false) ;
            if ( iter.hasNext() )
View Full Code Here

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

        return null ;
    }
   
    public static NodeValue strDatatype(NodeValue v1, NodeValue v2)
    {
        if ( ! v1.isString() ) throw new ExprEvalException("Not a string (arg 1): "+v1) ;
        if ( ! v2.isIRI() ) throw new ExprEvalException("Not an IRI (arg 2): "+v2) ;
       
        String lex = v1.asString() ;
        Node dt = v2.asNode() ;
        // Check?
       
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.