Class BaseStardogConnector
Abstract implementation of a connector for Stardog that connects using the HTTP protocol.
Implements
Inherited Members
Namespace: VDS.RDF.Storage
Assembly: dotNetRdf.dll
Syntax
public abstract class BaseStardogConnector : BaseAsyncHttpConnector, IAsyncQueryableStorage, IAsyncStorageProvider, IAsyncTransactionalStorage, IConfigurationSerializable, IQueryableStorage, ITransactionalStorage, IReasoningQueryableStorage, IStorageProvider, IStorageCapabilities, IDisposable
Remarks
Has full support for Stardog Transactions, connection is in auto-commit mode by default i.e. all write operations (Delete/Save/Update) will create and use a dedicated transaction for their operation, if the operation fails the transaction will automatically be rolled back. You can manage Transactions using the Begin(), Commit() and Rollback() methods.
The connector maintains a single transaction which is shared across all threads since Stardog is currently provides only MRSW (Multiple Reader Single Writer) concurrency and does not permit multiple transactions to occur simultaneously.
Constructors
| Edit this page View SourceBaseStardogConnector(string, string)
Creates a new connection to a Stardog Store.
Declaration
protected BaseStardogConnector(string baseUri, string kbID)
Parameters
Type | Name | Description |
---|---|---|
string | baseUri | Base Uri of the Server. |
string | kbID | Knowledge Base (i.e. Database) ID. |
BaseStardogConnector(string, string, IWebProxy)
Creates a new connection to a Stardog Store.
Declaration
protected BaseStardogConnector(string baseUri, string kbID, IWebProxy proxy)
Parameters
Type | Name | Description |
---|---|---|
string | baseUri | Base Uri of the Server. |
string | kbID | Knowledge Base (i.e. Database) ID. |
IWebProxy | proxy | Proxy Server. |
BaseStardogConnector(string, string, string, string)
Creates a new connection to a Stardog Store.
Declaration
protected BaseStardogConnector(string baseUri, string kbID, string username, string password)
Parameters
Type | Name | Description |
---|---|---|
string | baseUri | Base Uri of the Server. |
string | kbID | Knowledge Base (i.e. Database) ID. |
string | username | Username. |
string | password | Password. |
BaseStardogConnector(string, string, string, string, IWebProxy)
Creates a new connection to a Stardog Store.
Declaration
protected BaseStardogConnector(string baseUri, string kbID, string username, string password, IWebProxy proxy)
Parameters
Type | Name | Description |
---|---|---|
string | baseUri | Base Uri of the Server. |
string | kbID | Knowledge Base (i.e. Database) ID. |
string | username | Username. |
string | password | Password. |
IWebProxy | proxy | Proxy Server. |
BaseStardogConnector(string, string, StardogReasoningMode)
Creates a new connection to a Stardog Store.
Declaration
protected BaseStardogConnector(string baseUri, string kbID, StardogReasoningMode reasoning)
Parameters
Type | Name | Description |
---|---|---|
string | baseUri | Base Uri of the Server. |
string | kbID | Knowledge Base (i.e. Database) ID. |
StardogReasoningMode | reasoning | Reasoning Mode. |
BaseStardogConnector(string, string, StardogReasoningMode, HttpClientHandler)
Create a new connection to a Stardog store.
Declaration
protected BaseStardogConnector(string baseUri, string kbId, StardogReasoningMode reasoning, HttpClientHandler httpClientHandler)
Parameters
Type | Name | Description |
---|---|---|
string | baseUri | Base URI of the server. |
string | kbId | Knowledge base ID. |
StardogReasoningMode | reasoning | Reasoning mode. |
HttpClientHandler | httpClientHandler | Handler to configure outgoing HTTP requests. |
BaseStardogConnector(string, string, StardogReasoningMode, IWebProxy)
Creates a new connection to a Stardog Store.
Declaration
protected BaseStardogConnector(string baseUri, string kbID, StardogReasoningMode reasoning, IWebProxy proxy)
Parameters
Type | Name | Description |
---|---|---|
string | baseUri | Base Uri of the Server. |
string | kbID | Knowledge Base (i.e. Database) ID. |
StardogReasoningMode | reasoning | Reasoning Mode. |
IWebProxy | proxy | Proxy Server. |
BaseStardogConnector(string, string, StardogReasoningMode, string, string)
Creates a new connection to a Stardog Store.
Declaration
protected BaseStardogConnector(string baseUri, string kbID, StardogReasoningMode reasoning, string username, string password)
Parameters
Type | Name | Description |
---|---|---|
string | baseUri | Base Uri of the Server. |
string | kbID | Knowledge Base (i.e. Database) ID. |
StardogReasoningMode | reasoning | Reasoning Mode. |
string | username | Username. |
string | password | Password. |
BaseStardogConnector(string, string, StardogReasoningMode, string, string, IWebProxy)
Creates a new connection to a Stardog Store.
Declaration
protected BaseStardogConnector(string baseUri, string kbID, StardogReasoningMode reasoning, string username, string password, IWebProxy proxy)
Parameters
Type | Name | Description |
---|---|---|
string | baseUri | Base Uri of the Server. |
string | kbID | Knowledge Base (i.e. Database) ID. |
StardogReasoningMode | reasoning | Reasoning Mode. |
string | username | Username. |
string | password | Password. |
IWebProxy | proxy | Proxy Server. |
Fields
| Edit this page View SourceAnonymousUser
Constant for the default Anonymous user account and password used by Stardog if you have not supplied a shiro.ini file or otherwise disabled security.
Declaration
public const string AnonymousUser = "anonymous"
Field Value
Type | Description |
---|---|
string |
Server
The underlying server connection.
Declaration
protected BaseStardogServer Server
Field Value
Type | Description |
---|---|
BaseStardogServer |
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 of the Stardog server.
Declaration
public string BaseUri { get; }
Property Value
Type | Description |
---|---|
string |
DeleteSupported
Returns that deleting graphs from the Stardog store is not yet supported (due to a .Net specific issue).
Declaration
public override bool DeleteSupported { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
| Edit this page View SourceIOBehaviour
Gets the IO Behaviour of Stardog.
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
Remarks
Returns true if the knowledge base specified in the class constructor is found on the server, false otherwise.
KbId
Gets the knowledge base ID being used by this connector.
Declaration
public string KbId { get; }
Property Value
Type | Description |
---|---|
string |
ListGraphsSupported
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 SourceReasoning
Gets/Sets the reasoning mode to use for queries.
Declaration
public virtual StardogReasoningMode Reasoning { get; set; }
Property Value
Type | Description |
---|---|
StardogReasoningMode |
UpdateSupported
Returns that Updates are supported on Stardog Stores.
Declaration
public override bool UpdateSupported { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
Methods
| Edit this page View SourceAddStardogHeaders(HttpRequestMessage)
Adds Stardog specific request headers; reasoning needed for < 2.2.
Declaration
protected virtual void AddStardogHeaders(HttpRequestMessage request)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestMessage | request |
AddStardogHeaders(HttpWebRequest)
Adds Stardog specific request headers; reasoning needed for < 2.2.
Declaration
[Obsolete("This method is obsolete and will be removed in a future release. Replaced by AddStardogHeaders(HttpRequestMessage).")]
protected virtual void AddStardogHeaders(HttpWebRequest request)
Parameters
Type | Name | Description |
---|---|---|
HttpWebRequest | request |
Begin()
Begins a new Transaction.
Declaration
public virtual void Begin()
Remarks
A single transaction.
Begin(bool)
Begins a new Transaction.
Declaration
public virtual void Begin(bool enableReasoning)
Parameters
Type | Name | Description |
---|---|---|
bool | enableReasoning | Opens the transaction with reasoning enabled. |
Remarks
A single transaction.
Begin(AsyncStorageCallback, object)
Begins a transaction asynchronously.
Declaration
public virtual void Begin(AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
AsyncStorageCallback | callback | Callback. |
object | state | State to pass to the callback. |
BeginAsync(CancellationToken)
Begins a transaction asynchronously.
Declaration
public virtual Task BeginAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
Exceptions
Type | Condition |
---|---|
RdfStorageException | Raised if there is already an active transaction for this connector or if the Stardog server responds with an error status code or a null or empty response. |
BeginTransaction(bool)
Start a transaction.
Declaration
protected virtual string BeginTransaction(bool enableReasoning = false)
Parameters
Type | Name | Description |
---|---|---|
bool | enableReasoning | Opens the transaction with reasoning enabled (requires StarDog v5.3.0 or later). |
Returns
Type | Description |
---|---|
string | A transaction ID for the new transaction. |
Commit()
Commits the active Transaction.
Declaration
public virtual void Commit()
Remarks
Transactions are scoped to Managed Threads.
Exceptions
Type | Condition |
---|---|
RdfStorageException | Thrown if there is not an active Transaction on the current Thread. |
Commit(AsyncStorageCallback, object)
Commits a transaction asynchronously.
Declaration
public virtual void Commit(AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
AsyncStorageCallback | callback | Callback. |
object | state | State to pass to the callback. |
CommitAsync(CancellationToken)
Commit a transaction asynchronously.
Declaration
public virtual Task CommitAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
Exceptions
Type | Condition |
---|---|
RdfStorageException | Raised if there is currently no open transaction for this connector, or if the Stardog server responds with an error status code. |
CommitTransaction(string)
Commit an open transaction.
Declaration
protected virtual void CommitTransaction(string transactionId)
Parameters
Type | Name | Description |
---|---|---|
string | transactionId | The ID of the transaction to commit. |
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> requestParams)
Parameters
Type | Name | Description |
---|---|---|
string | servicePath | Path to the Service requested. |
string | accept | Acceptable Content Types. |
HttpMethod | method | HTTP Method. |
Dictionary<string, string> | requestParams | 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 has been replaced by CreateRequest(string, string, HttpMethod, Dictionary<string, string>.")]
protected virtual HttpWebRequest CreateRequest(string servicePath, string accept, string method, Dictionary<string, string> requestParams)
Parameters
Type | Name | Description |
---|---|---|
string | servicePath | Path to the Service requested. |
string | accept | Acceptable Content Types. |
string | method | HTTP Method. |
Dictionary<string, string> | requestParams | Querystring Parameters. |
Returns
Type | Description |
---|---|
HttpWebRequest |
DeleteGraph(string)
Deletes a Graph from the Stardog 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 Stardog store.
Declaration
public virtual void DeleteGraph(Uri graphUri)
Parameters
Type | Name | Description |
---|---|---|
Uri | graphUri | URI of the Graph to delete. |
DeleteGraphAsync(string, bool, string, AsyncStorageCallback, object)
Delete a graph as part of an open transaction.
Declaration
protected virtual void DeleteGraphAsync(string tID, bool autoCommit, string graphUri, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
string | tID | The ID of the transaction to use. |
bool | autoCommit | True to commit the transaction at the end of the delete operation, false to leave the transaction open. |
string | graphUri | The URI of the graph to delete. |
AsyncStorageCallback | callback | Callback to invoked on completion of the operation. |
object | state | Additional state to pass into the callback. |
DeleteGraphAsync(string, string, bool, CancellationToken)
Delete a graph asynchronously withing the context of a transaction.
Declaration
protected virtual Task DeleteGraphAsync(string transactionId, string graphName, bool autoCommit, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | transactionId | The transaction to use. |
string | graphName | The name of the graph to be deleted. |
bool | autoCommit | Whether to automatically commit/rollback the transaction. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
Exceptions
Type | Condition |
---|---|
RdfStorageException | Raised if the Stardog server responds with an error status code when deleting thre graph or commiting the transaction. |
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 SourceDispose(bool)
Disposes of the Connector.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing |
Overrides
| Edit this page View SourceGetReasoningParameter()
Get the query parameter string that specifies the current reasoning mode.
Declaration
protected virtual string GetReasoningParameter()
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 Stardog store.
Declaration
public virtual IEnumerable<Uri> ListGraphs()
Returns
Type | Description |
---|---|
IEnumerable<Uri> |
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 an empty/null Uri is specified then the Default Graph of the Store 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 an empty/null URI is specified then the Default Graph of the Store 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 an empty/null URI is specified then the Default Graph of the Store 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 an empty/null URI is specified then the Default Graph of the Store 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 SourceMakeAddTriplesRequestMessage(string, string, IEnumerable<Triple>)
Helper method to construct an HTTP request to add triples to a graph.
Declaration
protected virtual HttpRequestMessage MakeAddTriplesRequestMessage(string transactionId, string graphName, IEnumerable<Triple> additions)
Parameters
Type | Name | Description |
---|---|---|
string | transactionId | The ID of the transaction to use for the update. |
string | graphName | The name of the graph to be updated. |
IEnumerable<Triple> | additions | The triples to add to the graph. |
Returns
Type | Description |
---|---|
HttpRequestMessage |
MakeDeleteGraphRequestMessage(string, string)
Helper method that constructs the request message to send to the server to delete a graph.
Declaration
protected virtual HttpRequestMessage MakeDeleteGraphRequestMessage(string transactionId, string graphName)
Parameters
Type | Name | Description |
---|---|---|
string | transactionId | The ID of the transaction within which the graph will be deleted. |
string | graphName | The name of the graph to be deleted. |
Returns
Type | Description |
---|---|
HttpRequestMessage | A configured HttpRequestMessage instance. |
MakeRemoveTriplesRequestMessage(string, string, IEnumerable<Triple>)
Helper method to construct an HTTP request to remove triples from a graph.
Declaration
protected virtual HttpRequestMessage MakeRemoveTriplesRequestMessage(string transactionId, string graphName, IEnumerable<Triple> removals)
Parameters
Type | Name | Description |
---|---|---|
string | transactionId | The ID of the transaction to use for the update. |
string | graphName | The name of the graph to be updated. |
IEnumerable<Triple> | removals | The triples to remove from the graph. |
Returns
Type | Description |
---|---|
HttpRequestMessage |
Query(string)
Makes a SPARQL Query against the underlying Store using whatever reasoning mode is currently in-use.
Declaration
public virtual object Query(string sparqlQuery)
Parameters
Type | Name | Description |
---|---|---|
string | sparqlQuery | Sparql Query. |
Returns
Type | Description |
---|---|
object |
Query(string, bool)
Makes a SPARQL Query against the underlying Store using whatever reasoning mode is currently in-use, the reasoning can be set by query.
Declaration
public virtual object Query(string sparqlQuery, bool reasoning)
Parameters
Type | Name | Description |
---|---|---|
string | sparqlQuery | Sparql Query. |
bool | reasoning |
Returns
Type | Description |
---|---|
object |
Query(string, AsyncStorageCallback, object)
Queries the store asynchronously.
Declaration
public virtual void Query(string query, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
string | query | 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 using whatever reasoning mode is currently in-use processing the results using 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, bool)
Makes a SPARQL Query against the underlying Store using whatever reasoning mode is currently in-use processing the results using an appropriate handler from those provided, the reasoning can be set by query.
Declaration
public virtual void Query(IRdfHandler rdfHandler, ISparqlResultsHandler resultsHandler, string sparqlQuery, bool reasoning)
Parameters
Type | Name | Description |
---|---|---|
IRdfHandler | rdfHandler | RDF Handler. |
ISparqlResultsHandler | resultsHandler | Results Handler. |
string | sparqlQuery | SPARQL Query. |
bool | reasoning |
Query(IRdfHandler, ISparqlResultsHandler, string, AsyncStorageCallback, object)
Queries the store asynchronously.
Declaration
public virtual void Query(IRdfHandler rdfHandler, ISparqlResultsHandler resultsHandler, string query, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
IRdfHandler | rdfHandler | RDF Handler. |
ISparqlResultsHandler | resultsHandler | Results Handler. |
string | query | SPARQL Query. |
AsyncStorageCallback | callback | Callback. |
object | state | State to pass to the callback. |
QueryAsync(string, CancellationToken)
Queries the store asynchronously.
Declaration
public virtual Task<object> QueryAsync(string query, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | query | |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<object> |
QueryAsync(IRdfHandler, ISparqlResultsHandler, string, CancellationToken)
Queries the store asynchronously.
Declaration
public virtual Task QueryAsync(IRdfHandler rdfHandler, ISparqlResultsHandler resultsHandler, string query, 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 | query | |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
Rollback()
Rolls back the active Transaction.
Declaration
public virtual void Rollback()
Remarks
Transactions are scoped to Managed Threads.
Exceptions
Type | Condition |
---|---|
RdfStorageException | Thrown if there is not an active Transaction on the current Thread. |
Rollback(AsyncStorageCallback, object)
Rolls back a transaction asynchronously.
Declaration
public virtual void Rollback(AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
AsyncStorageCallback | callback | Callback. |
object | state | State to pass to the callback. |
RollbackAsync(CancellationToken)
Roll back the current transaction on this connector asynchronously.
Declaration
public virtual Task RollbackAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
Exceptions
Type | Condition |
---|---|
RdfStorageException | If there is no open transaction on the connector or if the Stardog server responds with an error status code. |
RollbackTransaction(string)
Rollback an open transaction.
Declaration
protected virtual void RollbackTransaction(string transactionId)
Parameters
Type | Name | Description |
---|---|---|
string | transactionId | The ID of the transaction to rollback. |
SaveGraph(IGraph)
Saves a Graph into the Store (see remarks for notes on merge/overwrite behaviour).
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's Default Graph. If the Graph has a URI then existing Graph associated with that URI will be replaced. To append to a named Graph use the UpdateGraph() method instead.
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(string, bool, IGraph, CancellationToken)
Save a graph asynchronously within the scope of an open transaction.
Declaration
protected virtual Task SaveGraphAsync(string transactionId, bool autoCommit, IGraph g, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | transactionId | The ID of the transaction. |
bool | autoCommit | Whether to commit/rollback the transaction when the operation is completed. |
IGraph | g | The graph to save. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
Exceptions
Type | Condition |
---|---|
RdfStorageException | Raised if the Stardog server responds with an error status code. |
SaveGraphAsync(string, bool, IGraph, AsyncStorageCallback, object)
Save a graph to the database asynchronously within the context of an open transaction.
Declaration
protected virtual void SaveGraphAsync(string tID, bool autoCommit, IGraph g, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
string | tID | The ID of the transaction to use for the update. |
bool | autoCommit | True to commit the transaction on completion. |
IGraph | g | The graph to write. |
AsyncStorageCallback | callback | Callback invoked on completion. |
object | state | State parameter 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 SourceSaveGraphAsync(IGraph, AsyncStorageCallback, object)
Saves a Graph to the Store asynchronously.
Declaration
protected virtual void SaveGraphAsync(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. |
SerializeConfiguration(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 in the Stardog store.
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 in the Stardog Store.
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. |
Remarks
Removals happen before additions.
UpdateGraph(IRefNode, IEnumerable<Triple>, IEnumerable<Triple>)
Updates a Graph in the Store.
Declaration
public 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, bool, string, IEnumerable<Triple>, IEnumerable<Triple>, CancellationToken)
Update a graph asynchronously within the context of a transaction.
Declaration
protected virtual Task UpdateGraphAsync(string transactionId, bool autoCommit, string graphUri, IEnumerable<Triple> additions, IEnumerable<Triple> removals, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | transactionId | The transaction to use. |
bool | autoCommit | Whether to automatically commit/rollback the transaction. |
string | graphUri | The name of the graph to be updated. |
IEnumerable<Triple> | additions | The triples to add to the graph. |
IEnumerable<Triple> | removals | The triples to remove from the graph. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
Exceptions
Type | Condition |
---|---|
RdfStorageException |
UpdateGraphAsync(string, bool, string, IEnumerable<Triple>, IEnumerable<Triple>, AsyncStorageCallback, object)
Apply an update to a graph as part of a transaction.
Declaration
protected virtual void UpdateGraphAsync(string tID, bool autoCommit, string graphUri, IEnumerable<Triple> additions, IEnumerable<Triple> removals, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
string | tID | The ID of the open transaction to use. |
bool | autoCommit | True to commit the transaction at the end of the update, false otherwise. |
string | graphUri | The URI of the graph to be updated. |
IEnumerable<Triple> | additions | The triples to inser. |
IEnumerable<Triple> | removals | The triples to remove. |
AsyncStorageCallback | callback | A callback to be invoked on completion. |
object | state | Additional state to pass to the callback. |
UpdateGraphAsync(string, IEnumerable<Triple>, IEnumerable<Triple>, CancellationToken)
Updates a graph in the store asynchronously.
Declaration
public override 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 |
Overrides
| Edit this page View SourceUpdateGraphAsync(string, IEnumerable<Triple>, IEnumerable<Triple>, AsyncStorageCallback, object)
Apply an update to a graph.
Declaration
protected virtual void UpdateGraphAsync(string graphUri, IEnumerable<Triple> additions, IEnumerable<Triple> removals, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
string | graphUri | The URI of the graph to be updated. |
IEnumerable<Triple> | additions | The triples to insert. |
IEnumerable<Triple> | removals | The triples to delete. |
AsyncStorageCallback | callback | Callback invoked on completion. |
object | state | Additional state passed to the callback. |
Remarks
If a transaction is currently in progress, the update is applied as part of that transaction. Otherwise a new transaction is started and committed by this method.