Examples of ExprEvalException


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

{
    @Override
    public QueryIterator execEvaluated(final Binding binding, final Node subject, final Node predicate, final PropFuncArg object, final ExecutionContext execCxt)
    {
        if (!Var.isVar(subject))
            throw new ExprEvalException("Subject is not a variable (" + subject + ")") ;

        if (object.getArgListSize() != 2)
            throw new ExprEvalException("Object list must contain exactly two arguments, the string to split and a regular expression") ;

        String s = object.getArg(0).getLiteralLexicalForm() ;
        String regex = object.getArg(1).getLiteralLexicalForm() ;
       
        final Var subjectVar = Var.alloc(subject);
View Full Code Here

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

     * 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

            // 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() ) {
                Violation viol = iter.next() ;
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

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

        return NodeValue.makeNode(n) ;
    }

    public static NodeValue strLang(NodeValue v1, NodeValue v2) {
        if ( !v1.isString() )
            throw new ExprEvalException("Not a string (arg 1): " + v1) ;
        if ( !v2.isString() )
            throw new ExprEvalException("Not a string (arg 2): " + v2) ;

        String lex = v1.asString() ;
        String lang = v2.asString() ;
        // Check?
View Full Code Here

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

                                            ExecutionContext execCxt)
    {
        // subject a variable.
       
        if ( objectArgs.size() != 2 )
            throw new ExprEvalException("ListIndex : object not a list of length 2") ;
        Node indexNode = objectArgs.get(0) ;
        Node memberNode = objectArgs.get(1) ;
       
        final Collection<Node> x ;
        if ( ! Var.isVar(memberNode) )
View Full Code Here

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

    protected QueryIterator execOneList(Binding binding,
                                        Node listNode, Node predicate, List<Node> objectArgs,
                                        ExecutionContext execCxt)
    {
        if ( Var.isVar(listNode) )
            throw new ExprEvalException("ListIndex : subject not a list or variable bound to a list") ;

        if ( objectArgs.size() != 2 )
            throw new ExprEvalException("ListIndex : object not a list of length 2") ;

        Node indexNode = objectArgs.get(0) ;
        Node memberNode = objectArgs.get(1) ;
       
        Graph graph = execCxt.getActiveGraph() ;
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.