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

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


    public static NodeValue eval(Expr expr, Binding binding)
    {
        Context context = ARQ.getContext().copy() ;
        context.set(ARQConstants.sysCurrentTime, NodeFactory.nowAsDateTime()) ;
        FunctionEnv env = new ExecutionContext(context, null, null, null) ;
        NodeValue r = expr.eval(binding, env) ;
        return r ;
    }
View Full Code Here


            BuilderLib.broken(item, "Not an integer: "+item) ;
        Node node = item.getNode() ;
        if ( ! node.isLiteral() )
            BuilderLib.broken(item, "Not an integer: "+item) ;

        NodeValue nv = NodeValue.makeNode(node) ;
        if ( ! nv.isInteger() )
            BuilderLib.broken(item, "Not an integer: "+item) ;
        return nv.getInteger() ;
    }
View Full Code Here

        String sep = iter.next().asString() ;

        List<String> x = new ArrayList<String>() ;
        for ( ; iter.hasNext() ; )
        {
            NodeValue arg = iter.next();
            x.add( arg.asString() ) ;
        }
       
        return NodeValue.makeString(StrUtils.strjoin(sep, x)) ;
    }
View Full Code Here

    public Node getValue(Binding key)
    {
        Accumulator acc = buckets.get(key) ;
        if ( acc == null )
            throw new ARQInternalErrorException("Null for accumulator") ;
        NodeValue nv = acc.getValue();
        if ( nv == null )
            return null ;
        return nv.asNode() ;
    }
View Full Code Here

        String sep = iter.next().asString() ;

        List<String> x = new ArrayList<>() ;
        for ( ; iter.hasNext() ; )
        {
            NodeValue arg = iter.next();
            x.add( arg.asString() ) ;
        }
       
        return NodeValue.makeString(StrUtils.strjoin(sep, x)) ;
    }
View Full Code Here

                    BindingMap b = BindingFactory.create(k) ;
                   
                    for ( Pair<Var, Accumulator> pair : accs )
                    {
                        Var v = pair.getLeft() ;
                        NodeValue value = pair.getRight().getValue() ;
                        Node n = (value==null) ? null : value.asNode() ;
                        if ( v == null || n == null )
                        {}
                        else
                            b.add(v, n) ;
                    }
View Full Code Here

        Expr expr = exprs.get(var) ;
        if ( expr == null )
            return binding.get(var) ;
       
        try {
            NodeValue nv = expr.eval(binding, funcEnv) ;
            if ( nv == null )
                return null ;
            return nv.asNode() ;
        } catch (ExprEvalException ex)
        //{ Log.warn(this, "Eval failure "+expr+": "+ex.getMessage()) ; }
        { }
        return null ;
    }
View Full Code Here

            throw new ARQInternalErrorException("FunctionBase: Null args list") ;
       
        List<NodeValue> evalArgs = new ArrayList<>() ;
        for ( Expr e : args )
        {
            NodeValue x = e.eval( binding, env );
            evalArgs.add( x );
        }
       
        NodeValue nv =  exec(evalArgs) ;
        arguments = null ;
        return nv ;
    }
View Full Code Here

   
    @Override
    final public void accumulate(Binding binding, FunctionEnv functionEnv)
    {
        try {
            NodeValue nv = expr.eval(binding, functionEnv) ;
            if ( values.contains(nv) )
                return ;
            values.add(nv) ;
            accumulateDistinct(nv, binding, functionEnv) ;
            count++ ;
View Full Code Here

                    else
                    {
                        // Default action
                        ARQ.getContext().set(ARQConstants.sysCurrentTime, NodeFactoryExtra.nowAsDateTime()) ;
                        FunctionEnv env = new ExecutionContext(ARQ.getContext(), null, null, null) ;
                        NodeValue r = expr.eval(null, env) ;
                        //System.out.println(r.asQuotedString()) ;
                        Node n = r.asNode() ;
                        String s = NodeFmtLib.displayStr(n) ;
                        System.out.println(s) ;
                    }
                } catch (ExprEvalException ex)
                {
View Full Code Here

TOP

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

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.