/** * submits histogram requests in parallel to all given endpoints according to a given key type * * @param histogram the histogram request * @param keyType the key type * @return the result of the addressed endpoints */ public String[] submitHistogramRequestWithKeyType(final String histogram, final String keyType) { final String[] urls = new String[this.urlsOfEndpoints.length]; for (int i = 0; i < this.urlsOfEndpoints.length; i++) { urls[i] = EndpointManagement.addContext( EndpointManagement.addContext(this.urlsOfEndpoints[i], "histogram/"), keyType); } return EndpointManagement.submitHistogramRequest(histogram, urls); }
/** * submits a subgraph to a specific registered SPARQL endpoint * * @param subgraph the given subgraph to be submitted * @param key the key container containing the the number of the endpoint to which the query is * sent to * @return the query result of the submitted subgraph */ public QueryResult submitSubgraphQuery(final String subgraph, final KeyContainer<Integer> key) { final String url = EndpointManagement.addContext( EndpointManagement.addContext(this.urlsOfEndpoints[key.key], "subgraph/"), key); try { return EndpointManagement.submitSPARQLQuery(url, subgraph); } catch (final IOException e) { System.err.println(e); e.printStackTrace(); return null; } }
/** * submits a query parallel to all registered endpoints (according to one key type to avoid * duplicates) * * @param query the query to be submitted * @param keyType the key type to be used * @return the query result containing the result of all endpoints (collected in an asynchronous * way) */ public QueryResult submitSPARQLQueryWithKeyType(final String query, final String keyType) { final String[] urls = new String[this.urlsOfEndpoints.length]; for (int i = 0; i < this.urlsOfEndpoints.length; i++) { urls[i] = EndpointManagement.addContext(this.urlsOfEndpoints[i], keyType); } return EndpointManagement.submitSPARQLQuery(query, urls); }
/** * Submits a histogram request to all registered endpoints * * @param histogram the histogram request to be submitted to all endpoints * @return the histograms of all endpoints */ public String[] submitHistogramRequest(final String histogram) { final String[] urlsWithContext = new String[this.urlsOfEndpoints.length]; for (int i = 0; i < this.urlsOfEndpoints.length; i++) { urlsWithContext[i] = EndpointManagement.addContext(this.urlsOfEndpoints[i], "histogram/"); } return EndpointManagement.submitHistogramRequest(histogram, urlsWithContext); }
/** * submits a histogram request to a specific registered SPARQL endpoint * * @param histogram the given subgraph to be submitted * @param key the key container containing the the number of the endpoint to which the query is * sent to * @return the query result of the submitted subgraph */ public String submitHistogramRequest(final String histogram, final KeyContainer<Integer> key) { final String url = EndpointManagement.addContext( EndpointManagement.addContext(this.urlsOfEndpoints[key.key], "histogram/"), key); return EndpointManagement.submitHistogramRequest(histogram, url); }
/** * submits asynchronously a SPARUL query to a specific registered SPARQL endpoint * * @param query the query to be submitted * @param key the key container containing the number of the endpoint to which the query is sent * to */ public void submitSPARULQuery(final String query, final KeyContainer<Integer> key) { this.submitSPARULQuery( query, EndpointManagement.addContext(this.urlsOfEndpoints[key.key], key)); }