/** Is a property not set? */ public boolean isUndef(Symbol property) { return !isDefined(property) ; }
/** * Return whether a {@code DatasetGraph} has access control, either because it is wrapped in * {@link DatasetGraphAccessControl} or because it has the context settings. */ public static boolean isAccessControlled(DatasetGraph dsg) { if ( dsg instanceof DatasetGraphAccessControl ) return true; // if ( dsg.getContext().isDefined(DataAccessCtl.symControlledAccess) ) // return true; if ( dsg.getContext().isDefined(DataAccessCtl.symAuthorizationService) ) return true; return false; }
/** * Return the global {@code EnvJavaScript}. * Returns null if no JavaScript has been provided. */ public static EnvJavaScript get() { if ( global == null ) { synchronized(EnvJavaScript.class) { Context context = ARQ.getContext(); if ( context.isDefined(symJavaScriptFunctions) || context.isDefined(symJavaScriptLibFile) ) global = create(ARQ.getContext()); } } return global ; }
/** * Gets the HTTP client that is being used, may be null if no request has yet been made * @return HTTP Client or null */ public HttpClient getClient() { Context arqContext = ARQ.getContext(); if (arqContext.isDefined(Service.serviceContext)) { @SuppressWarnings("unchecked") Map<String, Context> context = (Map<String, Context>) arqContext.get(Service.serviceContext); if (context.containsKey(serviceURL)) { Context serviceContext = context.get(serviceURL); if (serviceContext.isDefined(Service.queryClient)) return serviceContext.get(Service.queryClient); } } return client; }
@Override public void write(OutputStream outStream, boolean result, Context context) { XMLOutputASK out = new XMLOutputASK(outStream); if ( context != null && context.isDefined(xmlInstruction) ) out.xmlInst = context.isTrue(xmlInstruction); if ( context != null && context.isDefined(xmlStylesheet) ) out.stylesheetURL = (String)(context.get(xmlStylesheet)); out.exec(result); }
private void setAnyTimeouts() { if ( context.isDefined(ARQ.queryTimeout) ) { Object obj = context.get(ARQ.queryTimeout); if ( obj instanceof Number ) { long x = ((Number)obj).longValue(); setTimeout(x); } else if ( obj instanceof String ) { String str = obj.toString(); // Set, not merge. EngineLib.parseSetTimeout(this, str, TimeUnit.MILLISECONDS, false); } else Log.warn(this, "Can't interpret timeout: " + obj); } queryStartTime = System.currentTimeMillis(); }
@Override public void write(OutputStream outStream, ResultSet resultSet, Context context) { XMLOutputResultSet xOut = new XMLOutputResultSet(outStream, context); if ( context != null && context.isDefined(xmlInstruction) ) xOut.setXmlInst(context.isTrue(xmlInstruction)); if ( context != null && context.isDefined(xmlStylesheet) ) xOut.setStylesheetURL((String)(context.get(xmlStylesheet))); ResultSetApply a = new ResultSetApply(resultSet, xOut); a.apply(); }
if (context.isDefined(Service.queryTimeout)) { Object obj = context.get(Service.queryTimeout); if (obj instanceof Number) {
/** Create a dataset description, given a query and context. * The context overrides the query FROM/FROM NAMED. * If neither the context nor query has a dataset description, return null. * The context uses the key {@link ARQConstants#sysDatasetDescription}. */ public static DatasetDescription create(Query query, Context context) { if ( context != null && context.isDefined(ARQConstants.sysDatasetDescription) ) { try { return (DatasetDescription)context.get(ARQConstants.sysDatasetDescription) ; } catch (ClassCastException ex) { throw new ARQException("Unexpected type (expected DatasetDescription): "+ex.getMessage()) ; } } if ( query != null && query.hasDatasetDescription() ) return query.getDatasetDescription() ; return null ; }
/** * Return the {@code StreamManager} in a context, or the global one if the context is * null or does not contain a valid entry for a {@code StreamManager}. * <p> * The {@code StreamManager} is keyed in the context by * {@link SysRIOT#sysStreamManager}. */ public static StreamManager get(Context context) { if ( context == null ) return get(); try { if ( context.isDefined(SysRIOT.sysStreamManager)) return (StreamManager)context.get(SysRIOT.sysStreamManager); } catch (ClassCastException ex) { log.warn("Context symbol '" + SysRIOT.sysStreamManager + "' is not a " + Lib.classShortName(StreamManager.class)); } return get(); }
if (context.isDefined(queryTimeout)) { Object obj = context.get(queryTimeout); if (obj instanceof Number) {
@Override public NodeValue exec() { Context cxt = functionEnv.getContext(); if ( cxt.isDefined(symNowTz) ) { NodeValue nvx = cxt.get(symNowTz); return nvx; } NodeValue nvx = execAdjust(); // String formattedDate = fromQueryTime(cxt); // NodeValue nvx = NodeValue.makeNode(formattedDate, null, XSD.dateTime.getURI()); cxt.set(symNowTz, nvx); return nvx; }
if (context.isDefined(Service.serviceContext)) { Map<String, Context> servicesContext = context.get(Service.serviceContext); if (servicesContext.containsKey(service)) { Context serviceContext = servicesContext.get(service); if (serviceContext.isDefined(Service.queryClient)) client = serviceContext.get(Service.queryClient);
if (jenaContext.isDefined(JSONLD_CONTEXT)) { isCtxDefined = true; Object o = jenaContext.get(JSONLD_CONTEXT);
@Test public void dsg_sink() { Dataset ds = (Dataset)AssemblerUtils.build(DIR+"assem_dsg_sink.ttl", DatasetAssemblerVocab.tDatasetSink); assertNotNull(ds); assertTrue(ds.getContext().isDefined(ARQ.queryTimeout)); ds.getDefaultModel().add(stmt); assertEquals(0, ds.getDefaultModel().size()); }
super.dataset = DynamicDatasets.dynamicDataset(dsDesc, dataset, context.isTrue(SDB.unionDefaultGraph) ) ; if ( context.isDefined(ARQConstants.sysDatasetDescription) ) throw new SDBException("Queries with dataset descriptions set in the context not supported" ) ;
if ( context.isDefined(filterPlacementOldName) ) { if ( context.isUndef(ARQ.optFilterPlacement) ) context.set(ARQ.optFilterPlacement, context.get(filterPlacementOldName)) ;