public void addRequestParam(String name, String... val) { opts.addRequestParam(name, val); }
/** * Setup the connection options. */ protected void setupConnectOptions() { opts.method = mgr.getQueryMethod(); if(update) { opts.addRequestParam("update", query); } else { opts.addRequestParam("query", query); } final UUID queryId = getQueryId(); if (queryId != null) opts.addRequestParam(QUERYID, queryId.toString()); }
opts.addRequestParam(FILE, file); opts.addRequestParam(COMPRESS, Boolean.toString(compress)); opts.addRequestParam(BLOCK, Boolean.toString(block));
final ConnectOptions opts = mgr.newQueryConnectOptions(sparqlEndpointURL, uuid, tx); opts.addRequestParam("GETSTMTS"); opts.addRequestParam(RemoteRepositoryDecls.INCLUDE_INFERRED, Boolean.toString(includeInferred)); if (subj != null) { opts.addRequestParam("s", EncodeDecodeValue.encodeValue(subj)); opts.addRequestParam("p", EncodeDecodeValue.encodeValue(pred)); opts.addRequestParam("o", EncodeDecodeValue.encodeValue(obj)); opts.addRequestParam("c", EncodeDecodeValue.encodeContexts(contexts));
/** * Resets the mapgraph runtime for the compute mode. * * @param computeMode the desired compute mode */ public void resetMapgraphRuntime(final ComputeMode computeMode) throws Exception { assertMapgraphRuntimeAvailable(); if (computeMode==null) { throw new IllegalArgumentException("Compute mode must not be null"); } final String repositoryUrl = getSparqlEndpointUrlForNamespaceOrDefault(null /* default namespace */); final ConnectOptions opts = newConnectOptions(repositoryUrl, UUID.randomUUID(), null/* tx */); JettyResponseListener response = null; // Setup the request entity. { opts.addRequestParam(MAPGRAPH, MAPGRAPH_RESET); opts.addRequestParam(COMPUTE_MODE, computeMode.toString()); opts.method = "POST"; } try { checkResponseCode(response = doConnect(opts)); } finally { if (response != null) response.abort(); } }
opts.addRequestParam("blueprints");
opts.addRequestParam(MAPGRAPH, ""); opts.method = "GET";
opts.addRequestParam(RemoteRepositoryDecls.FORCE_INDEX_CREATE, "true");
/** * Checks whether the mapgraph runtime is available. * @return */ public boolean mapgraphRuntimeAvailable() throws Exception { final String repositoryUrl = getSparqlEndpointUrlForNamespaceOrDefault(null /* default namespace */); /** * First reset the runtime */ final ConnectOptions opts = newConnectOptions(repositoryUrl, UUID.randomUUID(), null/* tx */); JettyResponseListener response = null; // Setup the request entity. { opts.addRequestParam(MAPGRAPH, MAPGRAPH_CHECK_RUNTIME_AVAILABLE); opts.method = "POST"; } try { response = doConnect(opts); return response.getStatus()==200 /* HTTP OK */; } finally { if (response != null) response.abort(); } }
opts.addRequestParam("CONTEXTS");
opts.addRequestParam("cancelQuery");
/** * List the currently running queries on the server * */ public Collection<RunningQuery> showQueries() throws Exception { final ConnectOptions opts = newUpdateConnectOptions(baseServiceURL, null, null/* txId */); opts.addRequestParam(SHOW_QUERIES); opts.setAcceptHeader(IMimeTypes.MIME_APPLICATION_JSON); JettyResponseListener response = null; try { // Issue request, check response status code. checkResponseCode(response = doConnect(opts)); final String contentType = response.getContentType(); if (!IMimeTypes.MIME_APPLICATION_JSON.equals(contentType)) throw new RuntimeException("Expected MIME_TYPE " + IMimeTypes.MIME_APPLICATION_JSON + " but received : " + contentType + "."); final InputStream is = response.getInputStream(); final List<RunningQuery> runningQueries = JsonHelper.readRunningQueryList(is); return runningQueries; } finally { /* * Ensure that the http response entity is consumed so that the http * connection will be released in a timely fashion. */ if (response != null) response.abort(); } }
opts.addRequestParam(MAPGRAPH, CHECK_PUBLISHED); opts.method = "POST";
opts.addRequestParam("STATUS");
opts.addRequestParam(MAPGRAPH, MAPGRAPH_PUBLISH); opts.method = "POST";
opts.addRequestParam(MAPGRAPH, MAPGRAPH_DROP); opts.method = "POST";
opts.addRequestParam("ABORT");
opts.addRequestParam("PREPARE");
opts.addRequestParam("timestamp", Long.toString(timestamp));
opts.addRequestParam("COMMIT");