Class FourStoreConnector
Class for connecting to 4store.
Implements
Inherited Members
Namespace: VDS.RDF.Storage
Assembly: dotNetRdf.Client.dll
Syntax
public class FourStoreConnector : BaseAsyncHttpConnector, IAsyncUpdateableStorage, IAsyncQueryableStorage, IAsyncStorageProvider, IConfigurationSerializable, IUpdateableStorage, IQueryableStorage, IStorageProvider, IStorageCapabilities, IDisposable
Remarks
Depending on the version of RASQAL used for your 4store instance and the options it was built with some kinds of queries may not suceed or return unexpected results.
Prior to the 1.x releases 4store did not permit the saving of unamed Graphs to the Store or Triple level updates. There was a branch of 4store that supports Triple level updates and you could tell the connector if your 4store instance supports this when you instantiate it. From the 0.4.0 release of the library onwards this support was enabled by default since the 1.x builds of 4store have this feature integrated into them by default.
Constructors
| Edit this page View SourceFourStoreConnector(string)
Creates a new 4store connector which manages access to the services provided by a 4store server.
Declaration
public FourStoreConnector(string baseUri)
Parameters
Type | Name | Description |
---|---|---|
string | baseUri | Base Uri of the 4store. |
Remarks
Note: As of the 0.4.0 release 4store support defaults to Triple Level updates enabled as all recent 4store releases have supported this. You can still optionally disable this with the two argument version of the constructor.
FourStoreConnector(string, bool)
Creates a new 4store connector which manages access to the services provided by a 4store server.
Declaration
public FourStoreConnector(string baseUri, bool enableUpdateSupport)
Parameters
Type | Name | Description |
---|---|---|
string | baseUri | Base Uri of the 4store. |
bool | enableUpdateSupport | Indicates to the connector that you are using a 4store instance that supports Triple level updates. |
Remarks
If you enable Update support but are using a 4store instance that does not support Triple level updates then you will almost certainly experience errors while using the connector.
FourStoreConnector(string, bool, IWebProxy)
Creates a new 4store connector which manages access to the services provided by a 4store server.
Declaration
public FourStoreConnector(string baseUri, bool enableUpdateSupport, IWebProxy proxy)
Parameters
Type | Name | Description |
---|---|---|
string | baseUri | Base Uri of the 4store. |
bool | enableUpdateSupport | Indicates to the connector that you are using a 4store instance that supports Triple level updates. |
IWebProxy | proxy | Proxy Server. |
Remarks
If you enable Update support but are using a 4store instance that does not support Triple level updates then you will almost certainly experience errors while using the connector.
FourStoreConnector(string, IWebProxy)
Creates a new 4store connector which manages access to the services provided by a 4store server.
Declaration
public FourStoreConnector(string baseUri, IWebProxy proxy)
Parameters
Type | Name | Description |
---|---|---|
string | baseUri | Base Uri of the 4store. |
IWebProxy | proxy | Proxy Server. |
Remarks
Note: As of the 0.4.0 release 4store support defaults to Triple Level updates enabled as all recent 4store releases have supported this. You can still optionally disable this with the two argument version of the constructor.
Properties
| Edit this page View SourceDeleteSupported
Returns that deleting Graph is supported.
Declaration
public override bool DeleteSupported { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
| Edit this page View SourceIOBehaviour
Gets the IO Behaviour of 4store.
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 SourceUpdateSupported
Returns whether this connector has been instantiated with update support or not.
Declaration
public override bool UpdateSupported { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
Remarks
If this property returns true it does not guarantee that the 4store instance actually supports updates it simply indicates that the user has enabled updates on the connector. If Updates are enabled and the 4store server being connected to does not support updates then errors will occur.
Methods
| Edit this page View SourceDeleteGraph(string)
Deletes a Graph from the 4store server.
Declaration
public void DeleteGraph(string graphUri)
Parameters
Type | Name | Description |
---|---|---|
string | graphUri | Uri of 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 4store server.
Declaration
public void DeleteGraph(Uri graphUri)
Parameters
Type | Name | Description |
---|---|---|
Uri | graphUri | Uri of 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 SourceListGraphNames()
Gets an enumeration of the names of the graphs in the store.
Declaration
public 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()
Lists the Graphs in the Store.
Declaration
public IEnumerable<Uri> ListGraphs()
Returns
Type | Description |
---|---|
IEnumerable<Uri> |
LoadGraph(IGraph, string)
Loads a Graph from the 4store instance.
Declaration
public void LoadGraph(IGraph g, string graphUri)
Parameters
Type | Name | Description |
---|---|---|
IGraph | g | Graph to load into. |
string | graphUri | URI of the Graph to load. |
LoadGraph(IGraph, Uri)
Loads a Graph from the 4store instance.
Declaration
public void LoadGraph(IGraph g, Uri graphUri)
Parameters
Type | Name | Description |
---|---|---|
IGraph | g | Graph to load into. |
Uri | graphUri | Uri of the Graph to load. |
LoadGraph(IRdfHandler, string)
Loads a Graph from the 4store instance.
Declaration
public void LoadGraph(IRdfHandler handler, string graphUri)
Parameters
Type | Name | Description |
---|---|---|
IRdfHandler | handler | RDF Handler. |
string | graphUri | URI of the Graph to load. |
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 4store instance using an RDF Handler.
Declaration
public void LoadGraph(IRdfHandler handler, Uri graphUri)
Parameters
Type | Name | Description |
---|---|---|
IRdfHandler | handler | RDF Handler. |
Uri | graphUri | URI of the Graph to load. |
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 4store Instance.
Declaration
public object Query(string sparqlQuery)
Parameters
Type | Name | Description |
---|---|---|
string | sparqlQuery | SPARQL Query. |
Returns
Type | Description |
---|---|
object | A Graph or a SparqlResultSet. |
Remarks
Depending on the version of RASQAL used and the options it was built with some kinds of queries may not suceed or return unexpected results.
Query(string, AsyncStorageCallback, object)
Queries the store asynchronously.
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 4store Instance processing the results with the appropriate handler from those provided.
Declaration
public 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)
Queries the store asynchronously.
Declaration
public void Query(IRdfHandler rdfHandler, ISparqlResultsHandler resultsHandler, string sparqlQuery, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
IRdfHandler | rdfHandler | RDF Handler. |
ISparqlResultsHandler | resultsHandler | 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 to a 4store instance (Warning: Completely replaces any existing Graph with the same URI).
Declaration
public void SaveGraph(IGraph g)
Parameters
Type | Name | Description |
---|---|---|
IGraph | g | Graph to save. |
Remarks
Completely replaces any existing Graph with the same Uri in the store.
Attempting to save a Graph which doesn't have a Base Uri will result in an error.
Exceptions
Type | Condition |
---|---|
RdfStorageException | Thrown if you try and save a Graph without a Base Uri or if there is an error communicating with the 4store instance. |
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(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 void SerializeConfiguration(ConfigurationSerializationContext context)
Parameters
Type | Name | Description |
---|---|---|
ConfigurationSerializationContext | 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 SourceUpdate(string)
Applies a SPARQL Update against 4store.
Declaration
public void Update(string sparqlUpdate)
Parameters
Type | Name | Description |
---|---|---|
string | sparqlUpdate | SPARQL Update. |
Remarks
Note: Please be aware that some valid SPARQL Updates may not be accepted by 4store since the SPARQL parser used by 4store does not support some of the latest editors draft syntax changes.
Update(string, AsyncStorageCallback, object)
Updates the store asynchronously.
Declaration
public void Update(string sparqlUpdates, AsyncStorageCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
string | sparqlUpdates | SPARQL Update. |
AsyncStorageCallback | callback | Callback. |
object | state | State to pass to the callback. |
UpdateAsync(string, CancellationToken)
Updates the store asynchronously.
Declaration
public Task UpdateAsync(string sparqlUpdates, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | sparqlUpdates | |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
UpdateGraph(string, IEnumerable<Triple>, IEnumerable<Triple>)
Updates a Graph in the store.
Declaration
public 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. |
Remarks
May throw an error since the default builds of 4store don't support Triple level updates. There are builds that do support this and the user can instantiate the connector with support for this enabled if they wish, if they do so and the underlying 4store doesn't support updates errors will occur when updates are attempted.
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 store.
Declaration
public 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
May throw an error since the default builds of 4store don't support Triple level updates. There are builds that do support this and the user can instantiate the connector with support for this enabled if they wish, if they do so and the underlying 4store doesn't support updates errors will occur when updates are attempted.
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 be added. |
IEnumerable<Triple> | removals | Triples to be removed. |
Remarks
May throw an error since the default builds of 4store don't support Triple level updates. There are builds that do support this and the user can instantiate the connector with support for this enabled if they wish, if they do so and the underlying 4store doesn't support updates errors will occur when updates are attempted.
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 |