Class BaseAsyncHttpConnector
Abstract Base Class for HTTP Based IAsyncStorageProvider implementations.
Inheritance
Inherited Members
Namespace: VDS.RDF.Storage
Assembly: dotNetRdf.dll
Syntax
public abstract class BaseAsyncHttpConnector : BaseHttpConnector, IAsyncStorageProvider, IStorageCapabilities, IDisposable
Remarks
It is expected that most classes extending from this will also then implement IStorageProvider separately for their synchronous communication, this class purely provides partial helper implementations for the asynchronous communication.
Constructors
| Edit this page View SourceBaseAsyncHttpConnector()
Create a new connector.
Declaration
protected BaseAsyncHttpConnector()
BaseAsyncHttpConnector(HttpClientHandler)
Create a new connector.
Declaration
protected BaseAsyncHttpConnector(HttpClientHandler httpClientHandler)
Parameters
Type | Name | Description |
---|---|---|
HttpClientHandler | httpClientHandler |
Properties
| Edit this page View SourceAsyncParentServer
Gets the parent server (if any).
Declaration
public virtual IAsyncStorageServer AsyncParentServer { get; }
Property Value
Type | Description |
---|---|
IAsyncStorageServer |
DeleteSupported
Gets whether the Store supports Graph deletion via the DeleteGraph() method.
Declaration
public abstract bool DeleteSupported { get; }
Property Value
Type | Description |
---|---|
bool |
IOBehaviour
Gets the IO Behaviour of the Store.
Declaration
public abstract IOBehaviour IOBehaviour { get; }
Property Value
Type | Description |
---|---|
IOBehaviour |
IsReadOnly
Gets whether the Store is read only.
Declaration
public abstract bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
bool |
IsReady
Indicates whether the Store is ready to accept requests.
Declaration
public abstract bool IsReady { get; }
Property Value
Type | Description |
---|---|
bool |
ListGraphsSupported
Gets whether the Store supports listing graphs via the ListGraphs() method.
Declaration
public abstract bool ListGraphsSupported { get; }
Property Value
Type | Description |
---|---|
bool |
ParentServer
Gets the parent server (if any).
Declaration
public virtual IStorageServer ParentServer { get; }
Property Value
Type | Description |
---|---|
IStorageServer |
UpdateSupported
Gets whether the Store supports Triple level updates via the UpdateGraph() method.
Declaration
public abstract bool UpdateSupported { get; }
Property Value
Type | Description |
---|---|
bool |
UriFactory
Gets or sets the URI factory for the connector to use.
Declaration
protected IUriFactory UriFactory { get; set; }
Property Value
Type | Description |
---|---|
IUriFactory |
Methods
| Edit this page View SourceDeleteGraph(string, AsyncStorageCallback, object)
Deletes a Graph from the Store.
Declaration
public abstract void DeleteGraph(string graphUri, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
string | graphUri | URI of the Graph to delete. |
AsyncStorageCallback | callback | Callback. |
object | state | State to pass to the callback. |
DeleteGraph(Uri, AsyncStorageCallback, object)
Deletes a Graph from the Store.
Declaration
public virtual void DeleteGraph(Uri graphUri, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
Uri | graphUri | URI of the Graph to delete. |
AsyncStorageCallback | callback | Callback. |
object | state | State to pass to the callback. |
DeleteGraphAsync(HttpRequestMessage, bool, string, AsyncStorageCallback, object)
Helper method for doing async delete operations, callers just need to provide an appropriately prepared HTTP request.
Declaration
protected void DeleteGraphAsync(HttpRequestMessage request, bool allow404, string graphUri, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestMessage | request | HTTP request. |
bool | allow404 | Whether a 404 response counts as success. |
string | graphUri | URI of the Graph to delete. |
AsyncStorageCallback | callback | Callback. |
object | state | State to pass to the callback. |
DeleteGraphAsync(HttpRequestMessage, bool, CancellationToken)
Helper method for deleting a graph from a store.
Declaration
protected Task DeleteGraphAsync(HttpRequestMessage request, bool allow404, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestMessage | request | The delete request to send. |
bool | allow404 | True if the client should ignore a 404 returned as the result of trying to delete a non-existent graph. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | A Task representing the result of the asynchronous operation. |
DeleteGraphAsync(HttpWebRequest, bool, string, AsyncStorageCallback, object)
Helper method for doing async delete operations, callers just need to provide an appropriately prepared HTTP request.
Declaration
[Obsolete("This method is obsolete and will be removed in a future release")]
protected void DeleteGraphAsync(HttpWebRequest request, bool allow404, string graphUri, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
HttpWebRequest | request | HTTP request. |
bool | allow404 | Whether a 404 response counts as success. |
string | graphUri | URI of the Graph to delete. |
AsyncStorageCallback | callback | Callback. |
object | state | State to pass to the callback. |
DeleteGraphAsync(string, CancellationToken)
Deletes a graph from the store asynchronously.
Declaration
public abstract Task DeleteGraphAsync(string graphName, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | graphName | Name of the graph to delete. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
ListGraphs(AsyncStorageCallback, object)
Lists the Graphs in the Store asynchronously.
Declaration
[Obsolete("Replaced with ListGraphsAsync(CancellationToken)")]
public virtual void ListGraphs(AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
AsyncStorageCallback | callback | Callback. |
object | state | State to pass to the callback. |
ListGraphsAsync(CancellationToken)
List the names of the graph on the remote server asynchronously.
Declaration
public virtual Task<IEnumerable<string>> ListGraphsAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<IEnumerable<string>> | Task that returns the list of graph names. |
Remarks
This implementation uses a SPARQL query to list the names of the graphs in the store. Many stores support more efficient means of listing graphs and so this method SHOULD be overridden. If the store does not implement the IAsyncQueryableStorage interface, then this method MUST be overridden.
Exceptions
Type | Condition |
---|---|
RdfStorageException | Raised if the store does not support the asynchronous SPARQL query required to retrieve a list of graph names. |
LoadGraph(IGraph, string, AsyncStorageCallback, object)
Loads a Graph from the Store asynchronously.
Declaration
public virtual void LoadGraph(IGraph g, string graphUri, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
IGraph | g | Graph to load into. |
string | graphUri | URI of the Graph to load. |
AsyncStorageCallback | callback | Callback. |
object | state | State to pass to the callback. |
LoadGraph(IGraph, Uri, AsyncStorageCallback, object)
Loads a Graph from the Store asynchronously.
Declaration
public virtual void LoadGraph(IGraph g, Uri graphUri, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
IGraph | g | Graph to load into. |
Uri | graphUri | URI of the Graph to load. |
AsyncStorageCallback | callback | Callback. |
object | state | State to pass to the callback. |
LoadGraph(IRdfHandler, string, AsyncStorageCallback, object)
Loads a Graph from the Store asynchronously.
Declaration
public abstract void LoadGraph(IRdfHandler handler, string graphUri, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
IRdfHandler | handler | Handler to load with. |
string | graphUri | URI of the Graph to load. |
AsyncStorageCallback | callback | Callback. |
object | state | State to pass to the callback. |
LoadGraph(IRdfHandler, Uri, AsyncStorageCallback, object)
Loads a Graph from the Store asynchronously.
Declaration
public virtual void LoadGraph(IRdfHandler handler, Uri graphUri, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
IRdfHandler | handler | Handler to load with. |
Uri | graphUri | URI of the Graph to load. |
AsyncStorageCallback | callback | Callback. |
object | state | State to pass to the callback. |
LoadGraphAsync(HttpRequestMessage, IRdfHandler, CancellationToken)
Helper method for doing async load operations, callers just need to provide an appropriately prepared HTTP request.
Declaration
protected Task LoadGraphAsync(HttpRequestMessage request, IRdfHandler handler, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestMessage | request | HTTP Request. |
IRdfHandler | handler | Handler to load with. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
LoadGraphAsync(HttpRequestMessage, IRdfHandler, AsyncStorageCallback, object)
Helper method for doing async load operations, callers just need to provide an appropriately prepared HTTP request.
Declaration
protected void LoadGraphAsync(HttpRequestMessage request, IRdfHandler handler, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestMessage | request | HTTP Request. |
IRdfHandler | handler | Handler to load with. |
AsyncStorageCallback | callback | Callback. |
object | state | State to pass to the callback. |
LoadGraphAsync(IGraph, string, CancellationToken)
Loads a graph from the store asynchronously.
Declaration
public virtual Task LoadGraphAsync(IGraph g, string graphName, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IGraph | g | The graph to load data into. |
string | graphName | The name of the graph to retrieve from the store. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
Remarks
This implementation delegates to the LoadGraphAsync(IRdfHandler, string, CancellationToken) method by wrapping g
in a GraphHandler.
LoadGraphAsync(IRdfHandler, string, CancellationToken)
Loads a graph from the store asynchronously.
Declaration
public abstract Task LoadGraphAsync(IRdfHandler handler, string graphName, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IRdfHandler | handler | The handler to receive the loaded triples. |
string | graphName | Name of the graph to load. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
MakeRequestSequence(IEnumerable<HttpRequestMessage>, AsyncStorageCallback, object)
Helper method for doing async operations where a sequence of HTTP requests must be run.
Declaration
protected void MakeRequestSequence(IEnumerable<HttpRequestMessage> requests, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<HttpRequestMessage> | requests | HTTP requests. |
AsyncStorageCallback | callback | Callback. |
object | state | State to pass to the callback. |
SaveGraph(IGraph, AsyncStorageCallback, object)
Saves a Graph to the Store asynchronously.
Declaration
public abstract void SaveGraph(IGraph g, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
IGraph | g | Graph to save. |
AsyncStorageCallback | callback | Callback. |
object | state | State to pass to the callback. |
SaveGraphAsync(HttpRequestMessage, CancellationToken)
Helper method for doing async save operations.
Declaration
protected Task SaveGraphAsync(HttpRequestMessage request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestMessage | request | A request message with the request content already set. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
SaveGraphAsync(HttpRequestMessage, IGraph, AsyncStorageCallback, object)
Helper method for doing callback-based async save operations.
Declaration
protected void SaveGraphAsync(HttpRequestMessage request, IGraph g, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestMessage | request | A request message with the request content already set. |
IGraph | g | The graph to be saved. |
AsyncStorageCallback | callback | The callback to invoke on completion. |
object | state | State to pass to the callback. |
SaveGraphAsync(HttpRequestMessage, IRdfWriter, IGraph, AsyncStorageCallback, object)
Helper method for doing callback-based async save operations.
Declaration
protected void SaveGraphAsync(HttpRequestMessage request, IRdfWriter writer, IGraph g, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestMessage | request | A request message whose content will be set by this method. |
IRdfWriter | writer | RDF writer to use to write graph content to the request stream. |
IGraph | g | The graph to be saved. |
AsyncStorageCallback | callback | The callback to invoke on completion. |
object | state | State to pass to the callback. |
SaveGraphAsync(HttpWebRequest, IRdfWriter, IGraph, AsyncStorageCallback, object)
Helper method for doing async save operations, callers just need to provide an appropriately prepared HTTP requests and a RDF writer which will be used to write the data to the request body.
Declaration
[Obsolete("This method is obsolete and will be removed in a future release.")]
protected void SaveGraphAsync(HttpWebRequest request, IRdfWriter writer, IGraph g, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
HttpWebRequest | request | HTTP request. |
IRdfWriter | writer | RDF Writer. |
IGraph | g | Graph to save. |
AsyncStorageCallback | callback | Callback. |
object | state | State to pass to the callback. |
SaveGraphAsync(IGraph, CancellationToken)
Saves a Graph to the Store asynchronously.
Declaration
public abstract Task SaveGraphAsync(IGraph g, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IGraph | g | Graph to save. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
UpdateGraph(string, IEnumerable<Triple>, IEnumerable<Triple>, AsyncStorageCallback, object)
Updates a Graph in the Store asynchronously.
Declaration
public abstract void UpdateGraph(string graphUri, IEnumerable<Triple> additions, IEnumerable<Triple> removals, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
string | graphUri | URI of the Graph to update. |
IEnumerable<Triple> | additions | Triples to be added. |
IEnumerable<Triple> | removals | Triples to be removed. |
AsyncStorageCallback | callback | Callback. |
object | state | State to pass to the callback. |
UpdateGraph(Uri, IEnumerable<Triple>, IEnumerable<Triple>, AsyncStorageCallback, object)
Updates a Graph in the Store asynchronously.
Declaration
public virtual void UpdateGraph(Uri graphUri, IEnumerable<Triple> additions, IEnumerable<Triple> removals, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
Uri | graphUri | URI of the Graph to update. |
IEnumerable<Triple> | additions | Triples to be added. |
IEnumerable<Triple> | removals | Triples to be removed. |
AsyncStorageCallback | callback | Callback. |
object | state | State to pass to the callback. |
UpdateGraphAsync(HttpRequestMessage, IRdfWriter, IEnumerable<Triple>, CancellationToken)
Helper method for simple updates that only add triples to a graph in the store.
Declaration
protected Task UpdateGraphAsync(HttpRequestMessage request, IRdfWriter writer, IEnumerable<Triple> additions, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestMessage | request | A pre-prepared request message without its content set. |
IRdfWriter | writer | The RDF writer to use to create the request content. |
IEnumerable<Triple> | additions | The triples to be added to the store. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
Remarks
This helper method sets the content of request
to a new GraphContent instance using the provided writer
. It then sends the request to the server and provides a default handling of the response message.
UpdateGraphAsync(HttpRequestMessage, IRdfWriter, Uri, IEnumerable<Triple>, AsyncStorageCallback, object)
Helper method for doing async update operations, callers just need to provide an appropriately prepared HTTP request and a RDF writer which will be used to write the data to the request body.
Declaration
protected void UpdateGraphAsync(HttpRequestMessage request, IRdfWriter writer, Uri graphUri, IEnumerable<Triple> additions, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestMessage | request | HTTP Request. |
IRdfWriter | writer | RDF writer. |
Uri | graphUri | URI of the Graph to update. |
IEnumerable<Triple> | additions | Triples. |
AsyncStorageCallback | callback | Callback. |
object | state | State to pass to the callback. |
UpdateGraphAsync(HttpWebRequest, IRdfWriter, Uri, IEnumerable<Triple>, AsyncStorageCallback, object)
Helper method for doing async update operations, callers just need to provide an appropriately prepared HTTP request and a RDF writer which will be used to write the data to the request body.
Declaration
[Obsolete("This method is obsolete and will be removed in a future release")]
protected void UpdateGraphAsync(HttpWebRequest request, IRdfWriter writer, Uri graphUri, IEnumerable<Triple> ts, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
HttpWebRequest | request | HTTP Request. |
IRdfWriter | writer | RDF writer. |
Uri | graphUri | URI of the Graph to update. |
IEnumerable<Triple> | ts | Triples. |
AsyncStorageCallback | callback | Callback. |
object | state | State to pass to the callback. |
UpdateGraphAsync(string, IEnumerable<Triple>, IEnumerable<Triple>, CancellationToken)
Updates a graph in the store asynchronously.
Declaration
public abstract Task UpdateGraphAsync(string graphUri, IEnumerable<Triple> additions, IEnumerable<Triple> removals, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | graphUri | |
IEnumerable<Triple> | additions | Triples to be added. |
IEnumerable<Triple> | removals | Triples to be removed. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |