Class AsyncHttpRDF

java.lang.Object
org.apache.jena.http.AsyncHttpRDF

public class AsyncHttpRDF extends Object
A collection of convenience operations for HTTP level operations for RDF related tasks which are performed asynchronously. See also HttpRDF.
  • Constructor Details

    • AsyncHttpRDF

      public AsyncHttpRDF()
  • Method Details

    • asyncGetGraph

      public static CompletableFuture<org.apache.jena.graph.Graph> asyncGetGraph(String url)
      Get a graph, asynchronously
    • asyncGetGraph

      public static CompletableFuture<org.apache.jena.graph.Graph> asyncGetGraph(HttpClient httpClient, String url)
      Get a graph, asynchronously
    • asyncGetDatasetGraph

      public static CompletableFuture<DatasetGraph> asyncGetDatasetGraph(String url)
      Get a dataset, asynchronously
    • asyncGetDatasetGraph

      public static CompletableFuture<DatasetGraph> asyncGetDatasetGraph(HttpClient httpClient, String url)
      Get a dataset, asynchronously
    • asyncLoadDatasetGraph

      public static CompletableFuture<Void> asyncLoadDatasetGraph(String url, DatasetGraph dsg)
      Load a DatasetGraph asynchronously. The dataset is updated inside a transaction.
    • asyncLoadDatasetGraph

      public static CompletableFuture<Void> asyncLoadDatasetGraph(HttpClient httpClient, String url, DatasetGraph dsg)
      Load a DatasetGraph asynchronously. The dataset is updated inside a transaction.
    • asyncLoadDatasetGraph

      public static CompletableFuture<Void> asyncLoadDatasetGraph(HttpClient httpClient, String url, Map<String,String> headers, DatasetGraph dsg)
      Load a DatasetGraph asynchronously. The dataset is updated inside a transaction.
    • asyncGetToStream

      public static CompletableFuture<Void> asyncGetToStream(HttpClient httpClient, String url, String acceptHeader, StreamRDF dest, Transactional transactional)
      Execute an asynchronous GET and parse the result to a StreamRDF. If "transactional" is not null, the object is used a write transaction around the parsing step.

      Call CompletableFuture.join() to await completion.
      Call syncOrElseThrow(CompletableFuture) to await completion, with exceptions translated to the underlying RuntimeException.

    • syncOrElseThrow

      public static void syncOrElseThrow(CompletableFuture<Void> cf)
      Wait for the CompletableFuture or throw a runtime exception. This operation extracts RuntimeException from the CompletableFuture.
    • getOrElseThrow

      public static <T> T getOrElseThrow(CompletableFuture<T> cf)
      Wait for the CompletableFuture then return the result or throw a runtime exception. This operation extracts RuntimeException from the CompletableFuture.
    • getOrElseThrow

      public static <T> T getOrElseThrow(CompletableFuture<T> cf, HttpRequest httpRequest)
      Get the value of a CompletableFuture that executes of an HTTP request. In case on any error, an HttpException is thrown.
      Type Parameters:
      T - The type of the value being computed.
      Parameters:
      cf - The completable future.
      httpRequest - An optional HttpRequest for improving feedback in case of exceptions.
      Returns:
      The value computed by the completable future.