protected void setOp(Op op) { queryOp = op ; context.put(ARQConstants.sysCurrentAlgebra, op) ; } }
public RDFWriterRIOT(String jenaName) { this.basename = "org.apache.jena.riot.writer." + jenaName.toLowerCase(Locale.ROOT); this.jenaName = jenaName; context.put(SysRIOT.sysRdfWriterProperties, properties); }
/** * Convenience method to set the {@link HttpContext} * * @param httpContext * HTTP Context */ public void setHttpContext(HttpContext httpContext) { getContext().put(HTTP_CONTEXT, httpContext); }
private void init() { if ( query != null ) context.put(ARQConstants.sysCurrentQuery, query) ; // NB: Setting timeouts via the context after creating a QueryExecutionBase // will not work. But we can't move it until the point the execution starts because of // get and set timeout operations on this object. setAnyTimeouts() ; }
/** Store a named value only if it is not currently set */ public void setIfUndef(Symbol property, Object value) { Object x = mapGet(property) ; if ( x == null ) put(property, value) ; }
private static Context context(StreamManager streamMgr) { Context context = new Context() ; context.put(SysRIOT.sysStreamManager, streamMgr) ; return context ; }
private Cache<String, ListMultimap<String, TextHit>> prepareCache(ExecutionContext execCxt) { @SuppressWarnings("unchecked") Cache<String, ListMultimap<String, TextHit>> queryCache = (Cache<String, ListMultimap<String, TextHit>>) execCxt.getContext().get(cacheSymbol); if (queryCache == null) { /* doesn't yet exist, need to create it */ queryCache = CacheFactory.createCache(CACHE_SIZE); execCxt.getContext().put(cacheSymbol, queryCache); } return queryCache; }
private Cache<String, ListMultimap<String, TextHit>> prepareCache(ExecutionContext execCxt) { @SuppressWarnings("unchecked") Cache<String, ListMultimap<String, TextHit>> queryCache = (Cache<String, ListMultimap<String, TextHit>>) execCxt.getContext().get(cacheSymbol); if (queryCache == null) { /* doesn't yet exist, need to create it */ queryCache = CacheFactory.createCache(CACHE_SIZE); execCxt.getContext().put(cacheSymbol, queryCache); } return queryCache; }
protected Plan createPlan() { // Decide the algebra to actually execute. Op op = queryOp ; if ( ! startBinding.isEmpty() ) { op = Substitute.substitute(op, startBinding) ; context.put(ARQConstants.sysCurrentAlgebra, op) ; // Don't reset the startBinding because it also is // needed in the output. } op = modifyOp(op) ; QueryIterator queryIterator = null ; if ( dataset != null ) // Null means setting up but not executing a query. queryIterator = evaluate(op, dataset, startBinding, context) ; else // Bypass management interface queryIterator = evaluateNoMgt(op, dataset, startBinding, context) ; // This could be an automagic iterator to catch close. return new PlanOp(getOp(), this, queryIterator) ; }
ctx.put(OpExecutorViewCache.STORAGE_MAP, storageMap);
ctx.put(OpExecutorViewCache.STORAGE_MAP, storageMap);
@SuppressWarnings("unchecked") @Test public void update_service_context_application_02() { // This test requires no service context to be set Map<String, Context> serviceContextMap = (Map<String, Context>) ARQ.getContext().get(Service.serviceContext); if (serviceContextMap == null) { ARQ.getContext().put(Service.serviceContext, new HashMap<String, Context>()); serviceContextMap = (Map<String, Context>) ARQ.getContext().get(Service.serviceContext); } if (serviceContextMap.get(SERVICE) == null) { serviceContextMap.put(SERVICE, new Context(ARQ.getContext())); } Context serviceContext = serviceContextMap.get(SERVICE); try { HttpClient testClient = HttpClients.custom().build(); serviceContext.put(Service.queryClient, testClient); UpdateRequest updates = UpdateFactory.create("CREATE GRAPH <http://example>"); UpdateProcessRemoteBase engine = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemote(updates, SERVICE); Assert.assertNotNull(engine); // Check that client settings were changed Assert.assertEquals(testClient, engine.getClient()); } finally { serviceContext.remove(Service.queryClient); } } }
@SuppressWarnings("unchecked") @Test public void query_service_context_application_02() { // This test requires us to set some authentication credentials for the // service Map<String, Context> serviceContextMap = (Map<String, Context>) ARQ.getContext().get(Service.serviceContext); if (serviceContextMap == null) { ARQ.getContext().put(Service.serviceContext, new HashMap<String, Context>()); serviceContextMap = (Map<String, Context>) ARQ.getContext().get(Service.serviceContext); } if (serviceContextMap.get(SERVICE) == null) { serviceContextMap.put(SERVICE, new Context(ARQ.getContext())); } Context serviceContext = serviceContextMap.get(SERVICE); try { HttpClient testClient = HttpClients.custom().build(); serviceContext.put(Service.queryClient, testClient); Query q = QueryFactory.create("ASK { }"); QueryEngineHTTP engine = QueryExecutionFactory.createServiceRequest(SERVICE, q); Assert.assertNotNull(engine); // Check that no settings were changed Assert.assertEquals(-1, engine.getTimeout1()); Assert.assertEquals(-1, engine.getTimeout2()); Assert.assertTrue(engine.getAllowCompression()); Assert.assertEquals(testClient, engine.getClient()); } finally { serviceContext.remove(Service.queryClient); } }
@SuppressWarnings("unchecked") @Test public void query_service_context_application_05() { // This test requires us to set that GZip and Deflate are permitted Map<String, Context> serviceContextMap = (Map<String, Context>) ARQ.getContext().get(Service.serviceContext); if (serviceContextMap == null) { ARQ.getContext().put(Service.serviceContext, new HashMap<String, Context>()); serviceContextMap = (Map<String, Context>) ARQ.getContext().get(Service.serviceContext); } if (serviceContextMap.get(SERVICE) == null) { serviceContextMap.put(SERVICE, new Context(ARQ.getContext())); } Context serviceContext = serviceContextMap.get(SERVICE); try { serviceContext.put(Service.queryCompression, false); Query q = QueryFactory.create("ASK { }"); QueryEngineHTTP engine = QueryExecutionFactory.createServiceRequest(SERVICE, q); Assert.assertNotNull(engine); // Check that no settings were changed Assert.assertEquals(-1, engine.getTimeout1()); Assert.assertEquals(-1, engine.getTimeout2()); Assert.assertFalse(engine.getAllowCompression()); Assert.assertNull(engine.getClient()); } finally { serviceContext.remove(Service.queryCompression); } }
@SuppressWarnings("unchecked") @Test public void query_service_context_application_04() { // This test requires us to set some timeouts for the service Map<String, Context> serviceContextMap = (Map<String, Context>) ARQ.getContext().get(Service.serviceContext); if (serviceContextMap == null) { ARQ.getContext().put(Service.serviceContext, new HashMap<String, Context>()); serviceContextMap = (Map<String, Context>) ARQ.getContext().get(Service.serviceContext); } if (serviceContextMap.get(SERVICE) == null) { serviceContextMap.put(SERVICE, new Context(ARQ.getContext())); } Context serviceContext = serviceContextMap.get(SERVICE); try { serviceContext.put(Service.queryTimeout, "10,20"); Query q = QueryFactory.create("ASK { }"); QueryEngineHTTP engine = QueryExecutionFactory.createServiceRequest(SERVICE, q); Assert.assertNotNull(engine); // Check that no settings were changed Assert.assertEquals(20, engine.getTimeout1()); Assert.assertEquals(10, engine.getTimeout2()); Assert.assertTrue(engine.getAllowCompression()); Assert.assertNull(engine.getClient()); } finally { serviceContext.remove(Service.queryTimeout); } }
@SuppressWarnings("unchecked") @Test public void query_service_context_application_03() { // This test requires us to set some timeouts for the service Map<String, Context> serviceContextMap = (Map<String, Context>) ARQ.getContext().get(Service.serviceContext); if (serviceContextMap == null) { ARQ.getContext().put(Service.serviceContext, new HashMap<String, Context>()); serviceContextMap = (Map<String, Context>) ARQ.getContext().get(Service.serviceContext); } if (serviceContextMap.get(SERVICE) == null) { serviceContextMap.put(SERVICE, new Context(ARQ.getContext())); } Context serviceContext = serviceContextMap.get(SERVICE); try { serviceContext.put(Service.queryTimeout, "10"); Query q = QueryFactory.create("ASK { }"); QueryEngineHTTP engine = QueryExecutionFactory.createServiceRequest(SERVICE, q); Assert.assertNotNull(engine); // Check that no settings were changed Assert.assertEquals(-1, engine.getTimeout1()); Assert.assertEquals(10, engine.getTimeout2()); Assert.assertTrue(engine.getAllowCompression()); Assert.assertNull(engine.getClient()); } finally { serviceContext.remove(Service.queryTimeout); } }
getContext().put(ARQConstants.sysCurrentDataset, getDataset()) ;