public static void setFilter(Context context, Predicate<Tuple<NodeId>> filter) { context.set(SystemTDB.symTupleFilter, filter) ; } }
@Test public void testCxt3() { Context cxt = new Context() ; cxt.set(p1, "v") ; cxt.setIfUndef(p1, "w") ; Object v = cxt.get(p1) ; assertSame("Not as first set", "v", v) ; }
/** * Switch the default optimizer on and off for a specific Context. * Note that storage subsystems may also be applying * separately controlled optimizations. */ public static void enableOptimizer(Context context, boolean state) { context.set(ARQ.optimization, state) ; }
/** Set the XML style sheet processing instruction {@code <?xml-stylesheet...>}. * Set to null to not use a stylesheet. */ public static void setStylesheetURL(Context cxt, String stylesheetURL) { cxt.set(ResultSetWriterXML.xmlStylesheet, stylesheetURL); }
public static void setFilter(Context context, Predicate<Tuple<NodeId>> filter) { context.set(SystemTDB.symTupleFilter, filter) ; } }
/** Set whether to include {@code <?xml ...>}. * Set to null for "default" behaviour. */ public static void setXMLinstruction(Context cxt, Boolean value) { if ( value != null ) cxt.set(ResultSetWriterXML.xmlInstruction, value.booleanValue()); else cxt.unset(ResultSetWriterXML.xmlInstruction); }
public static void setGenerator(Context context, StageGenerator builder) { if ( ARQ.stageGenerator == null ) // Indicator of initialization problems Log.warn(StageBuilder.class, "ARQ.stageGenerator = null") ; context.set(ARQ.stageGenerator, builder) ; }
@Override public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { context.set(Symbol.create(attribute.getName()), attribute.getValue()) ; }
@Override public void filterTDB(DatasetGraph dsg, QueryExecution qExec) { Predicate<?> pred = tuple->false; qExec.getContext().set(GraphFilter.getContextKey(dsg), pred); } }
/** Create a text-indexed DatasetGraph, optionally allowing the text index to be closed if the DatasetGraph is */ public static DatasetGraph create(DatasetGraph dsg, TextIndex textIndex, boolean closeIndexOnDSGClose, TextDocProducer producer) { if (producer == null) producer = new TextDocProducerTriples(textIndex) ; DatasetGraph dsgt = new DatasetGraphText(dsg, textIndex, producer, closeIndexOnDSGClose) ; // Also set on dsg Context c = dsgt.getContext() ; c.set(TextQuery.textIndex, textIndex) ; return dsgt ; }
/** Create a text-indexed dataset */ public static DatasetGraph create(DatasetGraph dsg, SpatialIndex spatialIndex) { SpatialDocProducer producer = new SpatialDocProducerTriples(spatialIndex) ; DatasetGraph dsgt = new DatasetGraphSpatial(dsg, spatialIndex, producer) ; // Also set on dsg dsgt.getContext().set(SpatialQuery.spatialIndex, spatialIndex) ; return dsgt ; }
public Object open(Assembler a, Resource root, Mode mode) { Resource r = getResourceValue(root, pSetting ) ; String k = getAsStringValue(r, pName) ; String v = getAsStringValue(r, pValue) ; Symbol symbol = Symbol.create(k) ; ARQ.getContext().set(symbol, v) ; return r ; } }
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 ; } }
/** 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) ; }
@Test public void timeout_22() { String qs = prefix + "SELECT * { ?s ?p ?o }" ; ARQ.getContext().set(ARQ.queryTimeout, "-1") ; try(QueryExecution qExec = QueryExecutionFactory.create(qs, ds)) { ResultSet rs = qExec.execSelect() ; ResultSetFormatter.consume(rs) ; } }
@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 testCxt5() { Context cxt = new Context() ; cxt.set(p1, "false") ; assertTrue("Not false", cxt.isFalse(p1)) ; assertTrue("Not false or undef", cxt.isFalseOrUndef(p1)) ; }
@Test public void testCloseWhenNoBag() { params.set(ARQ.spillToDiskThreshold, 0); QueryIteratorBase base = new MockQueryIterator(BindingFactory.create()); QueryIterDistinct d = new QueryIterDistinct(base, c); // when there is no databag, close leaves it null assertNull(d.db); d.close(); assertNull(d.db); }