For IntelliJ IDEA,
Android Studio or Eclipse



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) ; } }
/** Apply static transformations to a query to optimize it */ public static Op optimize(Op op, Context context) { if ( context == null ) context = ARQ.getContext() ; // Call-through to somewhere to manage all the optimizations if ( op == null ) return null ; return Optimize.optimize(op, context) ; }
public static DescribeHandlerRegistry get(Context context) { if ( context == null ) return null ; return (DescribeHandlerRegistry)ARQ.getContext().get(ARQConstants.registryDescribeHandlers) ; }
public static void printPlan(Query query, QueryExecution qe) { QueryEngineFactory f = QueryEngineRegistry.findFactory(query, qe.getDataset().asDatasetGraph(), ARQ.getContext()) ; if ( f == null ) System.err.println("printPlan: Unknown engine type: "+Lib.className(qe)) ; Plan plan = f.create(query, qe.getDataset().asDatasetGraph(), BindingRoot.create(), ARQ.getContext()) ; SerializationContext sCxt = new SerializationContext(query) ; IndentedWriter out = IndentedWriter.stdout ; plan.output(out, sCxt) ; out.flush(); }
public static void register() { init() ; String NS = ARQ.PATH ; ContextMBean cxtBean = new ContextMBean(ARQ.getContext()) ; QueryEngineInfo qeInfo = QueryEngineBase.queryEngineInfo ; // Done in ARQ initialization -- // register(NS+".system:type=SystemInfo", ARQ.systemInfo) ; register(NS + ".system:type=Context", cxtBean) ; register(NS + ".system:type=Engine", qeInfo) ; }
@Test public void query_with_auth_12() { ARQ.getContext().remove(Service.serviceContext); QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(authServiceQuery, "ASK { }"); // Auth credentials for valid user with correct password qe.setClient(withCreds("allowed", "password")); Assert.assertTrue(qe.execAsk()); }
private static Plan makePlan(Query query, DatasetGraph dataset, Binding input, Context context) { if ( context == null ) context = new Context(ARQ.getContext()) ; if ( input == null ) input = BindingRoot.create() ; QueryEngineFactory f = findFactory(query, dataset, context) ; if ( f == null ) return null ; return f.create(query, dataset, input, context) ; } // ---------------- Internal routines
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 ; } }
public static void init() { // Intialize if there is no registry already set FunctionRegistry reg = new FunctionRegistry() ; StandardFunctions.loadStdDefs(reg) ; set(ARQ.getContext(), reg) ; }
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 ; }
/** * Create a new generator * @param context Context */ public AlgebraGenerator(Context context) { this (context != null ? context : ARQ.getContext().copy(), 0) ; }
private static void setupJS() { Context cxt = ARQ.getContext(); cxt.set(ARQ.symJavaScriptLibFile, JS_LIB_FILE); cxt.set(ARQ.symJavaScriptFunctions, "function inc(x) { return x+1 }"); EnvJavaScript.reset(); }
public synchronized static PropertyFunctionRegistry get() { // Intialize if there is no registry already set PropertyFunctionRegistry reg = get(ARQ.getContext()) ; if ( reg == null ) { reg = standardRegistry() ; set(ARQ.getContext(), reg) ; } return reg ; }
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) ; } }
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 ; } }