public static NodeValue eval(Expr expr, Binding binding) { Context context = ARQ.getContext().copy() ; context.set(ARQConstants.sysCurrentTime, NodeFactoryExtra.nowAsDateTime()) ; FunctionEnv env = new ExecutionContext(context, null, null, null) ; NodeValue r = expr.eval(binding, env) ; return r ; }
private static Context setupContext(Context context, DatasetGraph dataset) { // To many copies? if ( context == null ) // Copy of global context to protect against change. context = ARQ.getContext() ; context = context.copy() ; if ( dataset.getContext() != null ) context.putAll(dataset.getContext()) ; context.set(ARQConstants.sysCurrentTime, NodeFactoryExtra.nowAsDateTime()) ; return context ; } }
/** Setup a context using another context and a dataset. * This adds the current time. */ public static Context setupContextExec(Context globalContext, DatasetGraph dataset) { if ( globalContext == null ) globalContext = ARQ.getContext(); // Copy per-dataset settings. Context dsgCxt = ( dataset != null && dataset.getContext() != null ) ? dataset.getContext() : null; Context context = mergeCopy(globalContext, dsgCxt); context.set(ARQConstants.sysCurrentTime, NodeFactoryExtra.nowAsDateTime()) ; // Allocators. // context.set(ARQConstants.sysVarAllocNamed, new VarAlloc(ARQConstants.allocVarMarkerExec)) ; // context.set(ARQConstants.sysVarAllocAnon, new VarAlloc(ARQConstants.allocVarAnonMarkerExec)) ; // Add VarAlloc for variables and bNodes (this is not the parse name). // More added later e.g. query (if there is a query), algebra form (in setOp) return context; }
cxt.set(ARQConstants.sysCurrentTime, NodeFactoryExtra.nowAsDateTime());
addPair(meta.getList(), "timestamp", NodeFactoryExtra.nowAsDateTime()) ; addPair(meta.getList(), "run@", DateTimeUtils.nowAsString()) ; if ( count >= 0 )
addPair(meta.getList(), "timestamp", NodeFactoryExtra.nowAsDateTime()) ; addPair(meta.getList(), "run@", DateTimeUtils.nowAsString()) ; if ( count >= 0 )
cxt.set(ARQConstants.sysCurrentTime, NodeFactoryExtra.nowAsDateTime());
/** Create an execution environment suitable for testing functions and expressions */ public static FunctionEnv createTest() { Context cxt = ARQ.getContext().copy(); cxt.set(ARQConstants.sysCurrentTime, NodeFactoryExtra.nowAsDateTime()) ; return new FunctionEnvBase(cxt) ; }
private NodeValue cast(String input$) { Expr input = ExprUtils.parse(input$) ; ARQ.getContext().set(ARQConstants.sysCurrentTime, NodeFactoryExtra.nowAsDateTime()) ; FunctionEnv env = new ExecutionContext(ARQ.getContext(), null, null, null) ; return input.eval(null, env) ; } }
ARQ.getContext().set(ARQConstants.sysCurrentTime, NodeFactoryExtra.nowAsDateTime()) ; FunctionEnv env = new ExecutionContext(ARQ.getContext(), null, null, null) ; NodeValue r = expr.eval(null, env) ;
ARQ.getContext().set(ARQConstants.sysCurrentTime, NodeFactoryExtra.nowAsDateTime()) ; FunctionEnv env = new ExecutionContext(ARQ.getContext(), null, null, null) ; NodeValue r = expr.eval(null, env) ;