public static FunctionRegistry standardRegistry() { FunctionRegistry reg = get(ARQ.getContext()) ; return reg ; }
/** Set normal mode, including expression evaluation */ public static void setNormalMode() { SystemARQ.StrictDateTimeFO = false ; SystemARQ.ValueExtensions = true ; SystemARQ.EnableRomanNumerals = false ; setNormalMode(ARQ.getContext()) ; }
/** 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() { // Intialize if there is no registry already set DescribeHandlerRegistry reg = get(ARQ.getContext()) ; if ( reg == null ) { reg = standardRegistry() ; set(ARQ.getContext(), reg) ; } return reg ; }
public synchronized static ProcedureRegistry get() { // Intialize if there is no registry already set ProcedureRegistry reg = get(ARQ.getContext()) ; if ( reg == null ) { reg = standardRegistry() ; set(ARQ.getContext(), reg) ; } return reg ; }
private static void wireIntoExecution() { // Globally change the stage generator to intercept BGP on TDB // Globally change the stage generator to intercept BGP on TDB Context cxt = ARQ.getContext() ; StageGenerator orig = StageBuilder.chooseStageGenerator(cxt) ; // Wire in the TDB stage generator which will make TDB work whether // or not the TDB executor is used. This means that datasets of mixed // graph types inside a general purpose dataset work. StageGenerator stageGenerator = new StageGeneratorDirectTDB(orig) ; StageBuilder.setGenerator(ARQ.getContext(), stageGenerator) ; }
private static void wireIntoExecution() { // Globally change the stage generator to intercept BGP on TDB Context cxt = ARQ.getContext() ; StageGenerator orig = StageBuilder.chooseStageGenerator(cxt) ; // Wire in the TDB stage generator which will make TDB work whether // or not the TDB executor is used. This means that datasets of mixed // graph types inside a general purpose dataset work. StageGenerator stageGenerator = new StageGeneratorDirectTDB(orig) ; StageBuilder.setGenerator(ARQ.getContext(), stageGenerator) ; }
public static FunctionRegistry get() { // Intialize if there is no registry already set FunctionRegistry reg = get(ARQ.getContext()) ; if ( reg == null ) { Log.warn(FunctionRegistry.class, "Standard function registry should already have been initialized"); init() ; reg = get(ARQ.getContext()) ; } return reg ; }
/** Merge an outer (global) and local context to produce a new context * The new context is always a separate copy. */ public static Context mergeCopy(Context contextGlobal, Context contextLocal) { if ( contextGlobal == null ) contextGlobal = ARQ.getContext(); Context context = contextGlobal.copy(); if ( contextLocal != null ) // Copy per-dataset settings. context.putAll(contextLocal); return context ; }
private Context setup() { Context cxt = ARQ.getContext().copy(); setStylesheetURL(cxt, stylesheetURL); setXMLinstruction(cxt, includeXMLinst); return cxt; } }
@Override public void visit(OpService opService) { QueryIterator qIter = Service.exec(opService, ARQ.getContext()) ; Table table = TableFactory.create(qIter) ; push(table) ; }
public static void init() { // Intialize if there is no registry already set PropertyFunctionRegistry reg = new PropertyFunctionRegistry() ; StandardPropertyFunctions.loadStdDefs(reg) ; set(ARQ.getContext(), reg) ; }
public static void init() { // Intialize if there is no registry already set FunctionRegistry reg = new FunctionRegistry() ; StandardFunctions.loadStdDefs(reg) ; set(ARQ.getContext(), reg) ; }
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 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 ; } }
private static void test(Graph graph, Node start, String string, Node[] expectedNodes, boolean directionForward, boolean ordered) { Path p = PathParser.parse(string, pmap) ; Iterator<Node> resultsIter = directionForward ? PathEval.eval(graph, start, p, ARQ.getContext()) : PathEval.evalReverse(graph, start, p, ARQ.getContext()) ; List<Node> results = Iter.toList(resultsIter) ; List<Node> expected = Arrays.asList(expectedNodes) ; Assert.assertTrue("expected:"+expected+", got:"+results, equalsUnordered(expected, results)) ; if ( ordered ) Assert.assertEquals("expected(ordered)", expected, results) ; } }
private static List<Binding> eval(Graph graph, Node start, String pathStr, Node finish) { Path path = SSE.parsePath(pathStr, pmap) ; QueryIterator qIter = PathLib.execTriplePath(BindingFactory.root(), start, path, finish, new ExecutionContext(ARQ.getContext(), graph, null, null)) ; return Iter.toList(qIter) ; }
@Test public void timeout_21() { String qs = prefix + "SELECT * { ?s ?p ?o }" ; ARQ.getContext().set(ARQ.queryTimeout, "20,10") ; QueryExecution qExec = QueryExecutionFactory.create(qs, ds) ; ResultSet rs = qExec.execSelect() ; sleep(50) ; exceptionExpected(rs) ; }
@Test public void timeout_20() { String qs = prefix + "SELECT * { ?s ?p ?o }" ; ARQ.getContext().set(ARQ.queryTimeout, "20") ; QueryExecution qExec = QueryExecutionFactory.create(qs, ds) ; ResultSet rs = qExec.execSelect() ; sleep(50) ; exceptionExpected(rs) ; }