/**
  * 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 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 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 SPARQL query to a specific registered SPARQL endpoint
  *
  * @param query the given query 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 query
  */
 public QueryResult submitSPARQLQuery(final String query, final KeyContainer<Integer> key) {
   final String url = EndpointManagement.addContext(this.urlsOfEndpoints[key.key], key);
   try {
     return EndpointManagement.submitSPARQLQuery(url, query);
   } catch (final IOException e) {
     System.err.println(e);
     e.printStackTrace();
     return null;
   }
 }
 /**
  * submits a SPARQL query to a specific registered SPARQL endpoint
  *
  * @param query the given query to be submitted
  * @param number the number of the endpoint to which the query is sent to
  * @return the query result of the submitted query
  */
 public QueryResult submitSPARQLQuery(final String query, final int number) {
   final String url = this.urlsOfEndpoints[number];
   try {
     return EndpointManagement.submitSPARQLQuery(url, query);
   } catch (final IOException e) {
     System.err.println(e);
     e.printStackTrace();
     return null;
   }
 }
 /**
  * Submits a histogram request to a given url
  *
  * @param histogram the histogram request
  * @param url the url to which the request is sent to
  * @return the response of the histogram request
  */
 public static String submitHistogramRequest(final String histogram, final String url) {
   try {
     final Tuple<String, InputStream> response =
         Client.submitQueryAndRetrieveStream(
             url,
             histogram,
             "application/sparql-results+json"); // mime type would be better application/json, but
     // for that we do not have registered formatter,
     // such that errors would occur
     return EndpointManagement.getStringFromInputStream(response.getSecond());
   } catch (final IOException e) {
     System.err.println(e);
     e.printStackTrace();
     return null;
   }
 }
 /**
  * submits a query parallel to all registered endpoints
  *
  * @param query the query to be submitted
  * @return the query result containing the result of all endpoints (collected in an asynchronous
  *     way)
  */
 public QueryResult submitSPARQLQuery(final String query) {
   return EndpointManagement.submitSPARQLQuery(query, this.urlsOfEndpoints);
 }
 /**
  * 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));
 }