Class BaseSesameHttpProtocolConnector
Abstract Base Class for connecting to any Store that supports the Sesame 2.0 HTTP Communication protocol.
Inheritance
Implements
Inherited Members
Namespace: VDS.RDF.Storage
Assembly: dotNetRdf.Client.dll
Syntax
public abstract class BaseSesameHttpProtocolConnector : BaseAsyncHttpConnector, IAsyncQueryableStorage, IAsyncStorageProvider, IConfigurationSerializable, IQueryableStorage, IStorageProvider, IStorageCapabilities, IDisposable
Remarks
See here for the protocol specification, this base class supports Version 5 of the protocol which does not include SPARQL Update support.
Constructors
| Edit this page View SourceBaseSesameHttpProtocolConnector(string, string)
Creates a new connection to a Sesame HTTP Protocol supporting Store.
Declaration
public BaseSesameHttpProtocolConnector(string baseUri, string storeID)
Parameters
Type | Name | Description |
---|---|---|
string | baseUri | Base Uri of the Store. |
string | storeID | Store ID. |
BaseSesameHttpProtocolConnector(string, string, IWebProxy)
Creates a new connection to a Sesame HTTP Protocol supporting Store.
Declaration
public BaseSesameHttpProtocolConnector(string baseUri, string storeID, IWebProxy proxy)
Parameters
Type | Name | Description |
---|---|---|
string | baseUri | Base Uri of the Store. |
string | storeID | Store ID. |
IWebProxy | proxy | Proxy Server. |
BaseSesameHttpProtocolConnector(string, string, string, string)
Creates a new connection to a Sesame HTTP Protocol supporting Store.
Declaration
public BaseSesameHttpProtocolConnector(string baseUri, string storeID, string username, string password)
Parameters
Type | Name | Description |
---|---|---|
string | baseUri | Base Uri of the Store. |
string | storeID | Store ID. |
string | username | Username to use for requests that require authentication. |
string | password | Password to use for requests that require authentication. |
BaseSesameHttpProtocolConnector(string, string, string, string, IWebProxy)
Creates a new connection to a Sesame HTTP Protocol supporting Store.
Declaration
public BaseSesameHttpProtocolConnector(string baseUri, string storeID, string username, string password, IWebProxy proxy)
Parameters
Type | Name | Description |
---|---|---|
string | baseUri | Base Uri of the Store. |
string | storeID | Store ID. |
string | username | Username to use for requests that require authentication. |
string | password | Password to use for requests that require authentication. |
IWebProxy | proxy | Proxy Server. |
Fields
| Edit this page View Source_baseUri
Base Uri for the Store.
Declaration
protected string _baseUri
Field Value
Type | Description |
---|---|
string |
_fullContextEncoding
Whether to do full encoding of contexts.
Declaration
protected bool _fullContextEncoding
Field Value
Type | Description |
---|---|
bool |
_queryPath
Query Path Prefix.
Declaration
protected string _queryPath
Field Value
Type | Description |
---|---|
string |
_repositoriesPrefix
Repositories Prefix.
Declaration
protected string _repositoriesPrefix
Field Value
Type | Description |
---|---|
string |
_server
Server the store is hosted on.
Declaration
protected SesameServer _server
Field Value
Type | Description |
---|---|
SesameServer |
_store
Store ID.
Declaration
protected string _store
Field Value
Type | Description |
---|---|
string |
_updatePath
Update Path Prefix.
Declaration
protected string _updatePath
Field Value
Type | Description |
---|---|
string |
Properties
| Edit this page View SourceAsyncParentServer
Gets the parent server.
Declaration
public override IAsyncStorageServer AsyncParentServer { get; }
Property Value
Type | Description |
---|---|
IAsyncStorageServer |
Overrides
| Edit this page View SourceBaseUri
Gets the Base URI to the repository.
Declaration
public string BaseUri { get; }
Property Value
Type | Description |
---|---|
string |
DeleteSupported
Returns that deleting graphs from the Sesame store is supported.
Declaration
public override bool DeleteSupported { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
| Edit this page View SourceIOBehaviour
Gets the Save Behaviour of Stores that use the Sesame HTTP Protocol.
Declaration
public override IOBehaviour IOBehaviour { get; }
Property Value
Type | Description |
---|---|
IOBehaviour |
Overrides
| Edit this page View SourceIsReadOnly
Returns that the Connection is not read-only.
Declaration
public override bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
| Edit this page View SourceIsReady
Returns that the Connection is ready.
Declaration
public override bool IsReady { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
| Edit this page View SourceListGraphsSupported
Returns that listing Graphs is supported.
Declaration
public override bool ListGraphsSupported { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
| Edit this page View SourceParentServer
Gets the parent server.
Declaration
public override IStorageServer ParentServer { get; }
Property Value
Type | Description |
---|---|
IStorageServer |
Overrides
| Edit this page View SourceRepositoryName
Gets the Repository Name that is in use.
Declaration
public string RepositoryName { get; }
Property Value
Type | Description |
---|---|
string |
UpdateSupported
Returns that Updates are supported on Sesame HTTP Protocol supporting Stores.
Declaration
public override bool UpdateSupported { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
Methods
| Edit this page View SourceCreateRdfWriter()
Creates an RDF Writer to use for saving data to the store.
Declaration
protected virtual IRdfWriter CreateRdfWriter()
Returns
Type | Description |
---|---|
IRdfWriter |
CreateRequest(string, string, HttpMethod, Dictionary<string, string>)
Helper method for creating HTTP Requests to the Store.
Declaration
protected virtual HttpRequestMessage CreateRequest(string servicePath, string accept, HttpMethod method, Dictionary<string, string> queryParams)
Parameters
Type | Name | Description |
---|---|---|
string | servicePath | Path to the Service requested. |
string | accept | Acceptable Content Types. |
HttpMethod | method | HTTP Method. |
Dictionary<string, string> | queryParams | Querystring Parameters. |
Returns
Type | Description |
---|---|
HttpRequestMessage |
CreateRequest(string, string, string, Dictionary<string, string>)
Helper method for creating HTTP Requests to the Store.
Declaration
[Obsolete("This method is obsolete and will be removed in a future release. Use the overload that returns an HttpRequestMessage instead.")]
protected virtual HttpWebRequest CreateRequest(string servicePath, string accept, string method, Dictionary<string, string> queryParams)
Parameters
Type | Name | Description |
---|---|---|
string | servicePath | Path to the Service requested. |
string | accept | Acceptable Content Types. |
string | method | HTTP Method. |
Dictionary<string, string> | queryParams | Querystring Parameters. |
Returns
Type | Description |
---|---|
HttpWebRequest |
DeleteGraph(string)
Deletes a Graph from the Sesame store.
Declaration
public virtual void DeleteGraph(string graphUri)
Parameters
Type | Name | Description |
---|---|---|
string | graphUri | URI of the Graph to delete. |
DeleteGraph(string, AsyncStorageCallback, object)
Deletes a Graph from the Store.
Declaration
public override 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. |
Overrides
| Edit this page View SourceDeleteGraph(Uri)
Deletes a Graph from the Sesame store.
Declaration
public virtual void DeleteGraph(Uri graphUri)
Parameters
Type | Name | Description |
---|---|---|
Uri | graphUri | URI of the Graph to delete. |
DeleteGraphAsync(string, CancellationToken)
Deletes a graph from the store asynchronously.
Declaration
public override Task DeleteGraphAsync(string graphName, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | graphName | Name of the graph to delete. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
Overrides
| Edit this page View SourceEscapeQuery(string)
Escapes a Query to avoid a character encoding issue when communicating a query to Sesame.
Declaration
protected virtual string EscapeQuery(string query)
Parameters
Type | Name | Description |
---|---|---|
string | query | Query. |
Returns
Type | Description |
---|---|
string |
GetSaveContentType()
Gets the Content Type used to save data to the store i.e. the MIME type to use for the Content-Type header.
Declaration
protected virtual string GetSaveContentType()
Returns
Type | Description |
---|---|
string |
ListGraphNames()
Gets an enumeration of the names of the graphs in the store.
Declaration
public virtual IEnumerable<string> ListGraphNames()
Returns
Type | Description |
---|---|
IEnumerable<string> |
Remarks
Implementations should implement this method only if they need to provide a custom way of listing Graphs. If the Store for which you are providing a manager can efficiently return the Graphs using a SELECT DISTINCT ?g WHERE { GRAPH ?g { ?s ?p ?o } } query then there should be no need to implement this function.
ListGraphs()
Gets the list of Graphs in the Sesame store.
Declaration
public virtual IEnumerable<Uri> ListGraphs()
Returns
Type | Description |
---|---|
IEnumerable<Uri> |
ListGraphsAsync(CancellationToken)
List the names of the graph on the remote server asynchronously.
Declaration
public override 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. |
Overrides
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)
Loads a Graph from the Store.
Declaration
public virtual void LoadGraph(IGraph g, string graphUri)
Parameters
Type | Name | Description |
---|---|---|
IGraph | g | Graph to load into. |
string | graphUri | Uri of the Graph to load. |
Remarks
If a Null/Empty Uri is specified then the default graph (statements with no context in Sesame parlance) will be loaded.
LoadGraph(IGraph, Uri)
Loads a Graph from the Store.
Declaration
public virtual void LoadGraph(IGraph g, Uri graphUri)
Parameters
Type | Name | Description |
---|---|---|
IGraph | g | Graph to load into. |
Uri | graphUri | Uri of the Graph to load. |
Remarks
If a Null Uri is specified then the default graph (statements with no context in Sesame parlance) will be loaded.
LoadGraph(IRdfHandler, string)
Loads a Graph from the Store.
Declaration
public virtual void LoadGraph(IRdfHandler handler, string graphUri)
Parameters
Type | Name | Description |
---|---|---|
IRdfHandler | handler | RDF Handler. |
string | graphUri | Uri of the Graph to load. |
Remarks
If a Null/Empty Uri is specified then the default graph (statements with no context in Sesame parlance) will be loaded.
LoadGraph(IRdfHandler, string, AsyncStorageCallback, object)
Loads a Graph from the Store asynchronously.
Declaration
public override 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. |
Overrides
| Edit this page View SourceLoadGraph(IRdfHandler, Uri)
Loads a Graph from the Store.
Declaration
public virtual void LoadGraph(IRdfHandler handler, Uri graphUri)
Parameters
Type | Name | Description |
---|---|---|
IRdfHandler | handler | RDF Handler. |
Uri | graphUri | Uri of the Graph to load. |
Remarks
If a Null Uri is specified then the default graph (statements with no context in Sesame parlance) will be loaded.
LoadGraphAsync(IRdfHandler, string, CancellationToken)
Loads a graph from the store asynchronously.
Declaration
public override 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 |
Overrides
| Edit this page View SourceQuery(string)
Makes a SPARQL Query against the underlying Store.
Declaration
public virtual object Query(string sparqlQuery)
Parameters
Type | Name | Description |
---|---|---|
string | sparqlQuery | SPARQL Query. |
Returns
Type | Description |
---|---|
object |
Query(string, AsyncStorageCallback, object)
Makes a SPARQL Query against the underlying store.
Declaration
public void Query(string sparqlQuery, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
string | sparqlQuery | SPARQL Query. |
AsyncStorageCallback | callback | Callback. |
object | state | State to pass to the callback. |
Query(IRdfHandler, ISparqlResultsHandler, string)
Makes a SPARQL Query against the underlying Store processing the results with an appropriate handler from those provided.
Declaration
public virtual void Query(IRdfHandler rdfHandler, ISparqlResultsHandler resultsHandler, string sparqlQuery)
Parameters
Type | Name | Description |
---|---|---|
IRdfHandler | rdfHandler | RDF Handler. |
ISparqlResultsHandler | resultsHandler | Results Handler. |
string | sparqlQuery | SPARQL Query. |
Query(IRdfHandler, ISparqlResultsHandler, string, AsyncStorageCallback, object)
Makes a SPARQL Query against the underlying store processing the resulting Graph/Result Set with a handler of your choice.
Declaration
public void Query(IRdfHandler rdfHandler, ISparqlResultsHandler resultsHandler, string sparqlQuery, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
IRdfHandler | rdfHandler | RDF Handler. |
ISparqlResultsHandler | resultsHandler | SPARQL Results Handler. |
string | sparqlQuery | SPARQL Query. |
AsyncStorageCallback | callback | Callback. |
object | state | State to pass to the callback. |
QueryAsync(string, CancellationToken)
Queries the store asynchronously.
Declaration
public Task<object> QueryAsync(string sparqlQuery, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | sparqlQuery | SPARQL Query. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<object> |
QueryAsync(IRdfHandler, ISparqlResultsHandler, string, CancellationToken)
Queries the store asynchronously.
Declaration
public Task QueryAsync(IRdfHandler rdfHandler, ISparqlResultsHandler resultsHandler, string sparqlQuery, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IRdfHandler | rdfHandler | RDF Handler that will receive graph results from CONSTRUCT or DESCRIBE queries. |
ISparqlResultsHandler | resultsHandler | SPARQL Results set handler that will receive results from ASK or SELECT queries. |
string | sparqlQuery | The SPARQL query to execute. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
SaveGraph(IGraph)
Saves a Graph into the Store (Warning: Completely replaces any existing Graph with the same URI unless there is no URI - see remarks for details).
Declaration
public virtual void SaveGraph(IGraph g)
Parameters
Type | Name | Description |
---|---|---|
IGraph | g | Graph to save. |
Remarks
If the Graph has no URI then the contents will be appended to the Store, if the Graph has a URI then existing data associated with that URI will be replaced.
SaveGraph(IGraph, AsyncStorageCallback, object)
Saves a Graph to the Store asynchronously.
Declaration
public override 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. |
Overrides
| Edit this page View SourceSaveGraphAsync(HttpRequestMessage, CancellationToken)
Save a graph to the store asynchronously.
Declaration
public Task SaveGraphAsync(HttpRequestMessage request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestMessage | request | The HTTP request to make to save the graph. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task |
SaveGraphAsync(HttpRequestMessage, IGraph, AsyncStorageCallback, object)
Save a graph to the store asynchronously.
Declaration
public void SaveGraphAsync(HttpRequestMessage request, IGraph g, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestMessage | request | The HTTP request to make to save the graph. |
IGraph | g | The graph being saved. |
AsyncStorageCallback | callback | The callback to invoke on completion. |
object | state | State to pass to the callback. |
SaveGraphAsync(IGraph, CancellationToken)
Saves a Graph to the Store asynchronously.
Declaration
public override Task SaveGraphAsync(IGraph g, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IGraph | g | Graph to save. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
Overrides
| Edit this page View SourceSerializeConfiguration(ConfigurationSerializationContext)
Serializes the connection's configuration.
Declaration
public virtual void SerializeConfiguration(ConfigurationSerializationContext context)
Parameters
Type | Name | Description |
---|---|---|
ConfigurationSerializationContext | context | Configuration Serialization Context. |
ToString()
Gets a String which gives details of the Connection.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |
Overrides
| Edit this page View SourceUpdateGraph(string, IEnumerable<Triple>, IEnumerable<Triple>)
Updates a Graph.
Declaration
public virtual void UpdateGraph(string graphUri, IEnumerable<Triple> additions, IEnumerable<Triple> removals)
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. |
UpdateGraph(string, IEnumerable<Triple>, IEnumerable<Triple>, AsyncStorageCallback, object)
Updates a Graph in the Store asynchronously.
Declaration
public override 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. |
Overrides
| Edit this page View SourceUpdateGraph(Uri, IEnumerable<Triple>, IEnumerable<Triple>)
Updates a Graph.
Declaration
public virtual void UpdateGraph(Uri graphUri, IEnumerable<Triple> additions, IEnumerable<Triple> removals)
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. |
UpdateGraph(IRefNode, IEnumerable<Triple>, IEnumerable<Triple>)
Updates a Graph in the Store.
Declaration
public virtual void UpdateGraph(IRefNode graphName, IEnumerable<Triple> additions, IEnumerable<Triple> removals)
Parameters
Type | Name | Description |
---|---|---|
IRefNode | graphName | Name of the Graph to update. |
IEnumerable<Triple> | additions | Triples to add to the Graph. |
IEnumerable<Triple> | removals | Triples to remove from the Graph. |
Remarks
Note: Not all Stores are capable of supporting update at the individual Triple level and as such it is acceptable for such a Store to throw a NotSupportedException or an RdfStorageException if the Store cannot provide this functionality.
Behaviour of this method with regards to non-existent Graph is up to the implementor, it may create a new empty Graph and apply the updates to that or it may throw an error. Implementors should state in the XML comments for their implementation what behaviour is implemented.
Implementers MUST allow for either the additions or removals argument to be null.
Exceptions
Type | Condition |
---|---|
NotSupportedException | May be thrown if the underlying Store is not capable of doing Updates at the Triple level. |
RdfStorageException | May be thrown if the underlying Store is not capable of doing Updates at the Triple level or if some error occurs while attempting the Update. |
UpdateGraphAsync(string, IEnumerable<Triple>, IEnumerable<Triple>, CancellationToken)
Updates a graph in the store asynchronously.
Declaration
public override Task UpdateGraphAsync(string graphName, IEnumerable<Triple> additions, IEnumerable<Triple> removals, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | graphName | Name of the graph to update. |
IEnumerable<Triple> | additions | Triples to be added. |
IEnumerable<Triple> | removals | Triples to be removed. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |