Examples of NodeValue


Examples of com.github.mustachejava.util.NodeValue

  }

  private void writeNode(final JsonGenerator jg, Node invert) throws IOException {
    jg.writeStartObject();
    for (final Map.Entry<String, NodeValue> entry : invert.entrySet()) {
      NodeValue nodeValue = entry.getValue();
      if (nodeValue.isList() && nodeValue.list().size() > 0) {
        jg.writeFieldName(entry.getKey());
        List<Node> list = nodeValue.list();
        boolean array = list.size() > 1;
        if (array) jg.writeStartArray();
        for (Node node : list) {
          writeNode(jg, node);
        }
        if (array) jg.writeEndArray();
      } else {
        String value = nodeValue.value();
        if (value != null) {
          jg.writeFieldName(entry.getKey());
          try {
            double v = Double.parseDouble(value);
            jg.writeNumber(v);
View Full Code Here

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

        // Loose style. Add any duration to any date or time value.
        if ( vs1.equals(VSPACE_DATETIME) && vs2.equals(VSPACE_DURATION) )
        {
            XMLGregorianCalendar cal = nv1.getDateTime() ;
            XMLGregorianCalendar result = xsd_add(cal, nv2.getDuration()) ;
            NodeValue r = NodeValue.makeDateTime(result) ;
            return r ;
        }
        // Loose style. Add any duration to any date or time value.
        if ( vs1.equals(VSPACE_DATE) && vs2.equals(VSPACE_DURATION) )
        {
            XMLGregorianCalendar cal = nv1.getDateTime() ;
            XMLGregorianCalendar result = xsd_add(cal, nv2.getDuration()) ;
            NodeValue r = NodeValue.makeDate(result) ;
            return r ;
        }
        // Loose style. Add any duration to any date or time value.
        if ( vs1.equals(VSPACE_TIME) && vs2.equals(VSPACE_DURATION) )
        {
            // ONLY dayTime.
            XMLGregorianCalendar cal = nv1.getDateTime() ;
            XMLGregorianCalendar result = xsd_add(cal, nv2.getDuration()) ;
            NodeValue r = NodeValue.makeNode(result.toXMLFormat(), XSDDatatype.XSDtime) ;
            return r ;
        }
       
        if ( isDT(vs2) && vs1.equals(VSPACE_DURATION) )
            // Carefully ...
View Full Code Here

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

        if ( vs1.equals(VSPACE_DATETIME) && vs2.equals(VSPACE_DURATION) )
        {
            XMLGregorianCalendar cal = nv1.getDateTime() ;
            // add-negation
            XMLGregorianCalendar result = xsd_subtract(cal, nv2.getDuration()) ;
            NodeValue r = NodeValue.makeDateTime(result) ;
            return r ;
        }
        if ( vs1.equals(VSPACE_DATE) && vs2.equals(VSPACE_DURATION) )
        {
            XMLGregorianCalendar cal = nv1.getDateTime() ;
            // add-negation
            XMLGregorianCalendar result = xsd_subtract(cal, nv2.getDuration()) ;
            NodeValue r = NodeValue.makeDate(result) ;
            return r ;
        }
        if ( vs1.equals(VSPACE_TIME) && vs2.equals(VSPACE_DURATION) )
        {
            XMLGregorianCalendar cal = nv1.getDateTime() ;
            // add-negation
            XMLGregorianCalendar result = xsd_subtract(cal, nv2.getDuration()) ;
            NodeValue r = NodeValue.makeNode(result.toXMLFormat(), XSDDatatype.XSDtime) ;
            return r ;
        }
       
        throw new ExprEvalTypeException("Operator '-' : Undefined subtraction: "+nv1+" and "+nv2) ;
    }
View Full Code Here

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

        if ( !doEval )
            return ;
       
        try {
            FunctionEnv env = new FunctionEnvBase(context) ;
            NodeValue v = expr.eval(binding, env) ;
            checkValue(expr, v) ;
        }
        catch (NullPointerException ex)
        { throw ex ; }
        catch (Exception ex)
View Full Code Here

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

                    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

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

        Location loc = new Location(dir) ;
        DatasetGraph dsg = TDBFactory.createDatasetGraph(loc) ;

        if ( root.hasProperty(pUnionDefaultGraph) ) {
            Node b = root.getProperty(pUnionDefaultGraph).getObject().asNode() ;
            NodeValue nv = NodeValue.makeNode(b) ;
            if ( nv.isBoolean() )
                dsg.getContext().set(TDB.symUnionDefaultGraph, nv.getBoolean()) ;
            else
                Log.warn(DatasetAssemblerTDB.class, "Failed to recognize value for union graph setting (ignored): " + b) ;
        }

        /*
 
View Full Code Here

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

        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

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

                    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

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

        {
            SortCondition sc = iter.next() ;
            if ( sc.expression == null )
                throw new QueryExecException("Broken sort condition") ;

            NodeValue nv1 = null ;
            NodeValue nv2 = null ;
           
            try { nv1 = sc.expression.eval(bind1, env) ; }
            catch (VariableNotBoundException ex) {}
            catch (ExprEvalException ex)
            { Log.warn(this, ex.getMessage()) ; }
View Full Code Here

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

        boolean transactional = true;
       
        if (root.hasProperty(DatasetAssemblerVocab.pTransactional))
        {
            Node b = root.getProperty(DatasetAssemblerVocab.pTransactional).getObject().asNode();
            NodeValue nv = NodeValue.makeNode(b);
            if (nv.isBoolean())
            {
                transactional = nv.getBoolean();
            }
            else
            {
                Log.warn(DatasetNullAssembler.class,
                         "Failed to recognize value for transactional setting (ignored): " + b);
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.