Class InMemoryManager
Provides a wrapper around an in-memory store.
Implements
Inherited Members
Namespace: VDS.RDF.Storage
Assembly: dotNetRdf.dll
Syntax
public class InMemoryManager : BaseAsyncSafeConnector, IUpdateableStorage, IQueryableStorage, IStorageProvider, IAsyncUpdateableStorage, IAsyncQueryableStorage, IAsyncStorageProvider, IStorageCapabilities, IDisposable, IConfigurationSerializable
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
Constructors
| Improve this Doc View SourceInMemoryManager()
Creates a new In-Memory Manager which is a wrapper around a new empty in-memory store.
Declaration
public InMemoryManager()
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
InMemoryManager(IInMemoryQueryableStore)
Creates a new In-Memory Manager which is a wrapper around an in-memory store.
Declaration
public InMemoryManager(IInMemoryQueryableStore store)
Parameters
| Type | Name | Description |
|---|---|---|
| IInMemoryQueryableStore | store | Triple Store. |
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
InMemoryManager(ISparqlDataset)
Creates a new In-Memory Manager which is a wrapper around a SPARQL Dataset.
Declaration
public InMemoryManager(ISparqlDataset dataset)
Parameters
| Type | Name | Description |
|---|---|---|
| ISparqlDataset | dataset | Dataset. |
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
Properties
| Improve this Doc View SourceDeleteSupported
Returns that Graph Deletion is supported.
Declaration
public override bool DeleteSupported { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Overrides
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
IOBehaviour
Gets the IO Behaviour for In-Memory stores.
Declaration
public override IOBehaviour IOBehaviour { get; }
Property Value
| Type | Description |
|---|---|
| IOBehaviour |
Overrides
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
IsReadOnly
Returns that the Store is not read-only.
Declaration
public override bool IsReadOnly { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Overrides
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
IsReady
Returns that the Store is ready.
Declaration
public override bool IsReady { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Overrides
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
ListGraphsSupported
Returns that listing graphs is supported.
Declaration
public override bool ListGraphsSupported { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Overrides
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
UpdateSupported
Returns that Triple level updates are supported.
Declaration
public override bool UpdateSupported { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Overrides
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
Methods
| Improve this Doc View SourceDeleteGraph(string)
Deletes a Graph from the Store.
Declaration
public override void DeleteGraph(string graphUri)
Parameters
| Type | Name | Description |
|---|---|---|
| string | graphUri | URI of the Graph to delete. |
Overrides
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
DeleteGraph(Uri)
Deletes a Graph from the Store.
Declaration
public override void DeleteGraph(Uri graphUri)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Uri | graphUri | URI of the Graph to delete. |
Overrides
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
Dispose()
Disposes of the Manager.
Declaration
public override void Dispose()
Overrides
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
ListGraphNames()
Gets an enumeration of the names of the graphs in the store.
Declaration
public override IEnumerable<string> ListGraphNames()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><string> |
Overrides
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 URIs of Graphs in the Store.
Declaration
[Obsolete("Replaced by ListGraphNames")]
public override IEnumerable<Uri> ListGraphs()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><System.Uri> |
Overrides
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
LoadGraph(IGraph, string)
Loads a Graph from the Store.
Declaration
public override void LoadGraph(IGraph g, string graphUri)
Parameters
| Type | Name | Description |
|---|---|---|
| IGraph | g | Graph to load into. |
| string | graphUri | Graph URI to load. |
Overrides
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
LoadGraph(IGraph, Uri)
Loads a Graph from the Store.
Declaration
public override void LoadGraph(IGraph g, Uri graphUri)
Parameters
| Type | Name | Description |
|---|---|---|
| IGraph | g | Graph to load into. |
| System.Uri | graphUri | Graph URI to load. |
Overrides
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
LoadGraph(IRdfHandler, string)
Loads a Graph from the Store.
Declaration
public override void LoadGraph(IRdfHandler handler, string graphUri)
Parameters
| Type | Name | Description |
|---|---|---|
| IRdfHandler | handler | RDF Handler. |
| string | graphUri | Graph URI to load. |
Overrides
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
LoadGraph(IRdfHandler, Uri)
Loads a Graph from the Store.
Declaration
public override void LoadGraph(IRdfHandler handler, Uri graphUri)
Parameters
| Type | Name | Description |
|---|---|---|
| IRdfHandler | handler | RDF Handler. |
| System.Uri | graphUri | Graph URI to load. |
Overrides
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
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. |
| System.Object | state | State to pass to the callback. |
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
Query(string)
Makes a SPARQL Query against the Store.
Declaration
public object Query(string sparqlQuery)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sparqlQuery | SPARQL Query. |
Returns
| Type | Description |
|---|---|
| System.Object |
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
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. |
| System.Object | state | State to pass to the callback. |
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
Query(IRdfHandler, ISparqlResultsHandler, string)
Makes a SPARQL Query against the Store processing the results with the appropriate processor from those given.
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. |
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
QueryAsync(string, CancellationToken)
Queries the store asynchronously.
Declaration
public Task<object> QueryAsync(string sparqlQuery, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sparqlQuery | SPARQL Query. |
| System.Threading.CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<TResult><System.Object> |
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
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. |
| System.Threading.CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task |
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
SaveGraph(IGraph)
Saves a Graph to the Store.
Declaration
public override void SaveGraph(IGraph g)
Parameters
| Type | Name | Description |
|---|---|---|
| IGraph | g | Graph. |
Overrides
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
SerializeConfiguration(ConfigurationSerializationContext)
Serializes the Configuration of the Manager.
Declaration
public void SerializeConfiguration(ConfigurationSerializationContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| ConfigurationSerializationContext | context | Configuration Serialization Context. |
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
ToString()
Gets a String representation of the Manager.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |
Overrides
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
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. |
| System.Object | state | State to pass to the callback. |
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
Update(string)
Applies SPARQL Updates to the Store.
Declaration
public void Update(string sparqlUpdate)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sparqlUpdate | SPARQL Update. |
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
UpdateAsync(string, CancellationToken)
Updates the store asynchronously.
Declaration
public Task UpdateAsync(string sparqlUpdates, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sparqlUpdates | |
| System.Threading.CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task |
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
UpdateGraph(string, IEnumerable<Triple>, IEnumerable<Triple>)
Updates a Graph in the Store.
Declaration
public override void UpdateGraph(string graphUri, IEnumerable<Triple> additions, IEnumerable<Triple> removals)
Parameters
| Type | Name | Description |
|---|---|---|
| string | graphUri | URI of the Graph to Update. |
| System.Collections.Generic.IEnumerable<T><Triple> | additions | Triples to be added. |
| System.Collections.Generic.IEnumerable<T><Triple> | removals | Triples to be removed. |
Overrides
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
UpdateGraph(Uri, IEnumerable<Triple>, IEnumerable<Triple>)
Updates a Graph in the Store.
Declaration
public override void UpdateGraph(Uri graphUri, IEnumerable<Triple> additions, IEnumerable<Triple> removals)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Uri | graphUri | URI of the Graph to Update. |
| System.Collections.Generic.IEnumerable<T><Triple> | additions | Triples to be added. |
| System.Collections.Generic.IEnumerable<T><Triple> | removals | Triples to be removed. |
Overrides
Remarks
Useful if you want to test out some code using temporary in-memory data before you run the code against a real store or if you are using some code that requires an IStorageProvider interface but you need the results of that code to be available directly in-memory.
UpdateGraph(IRefNode, IEnumerable<Triple>, IEnumerable<Triple>)
Updates a Graph in the Store.
Declaration
public override void UpdateGraph(IRefNode graphName, IEnumerable<Triple> additions, IEnumerable<Triple> removals)
Parameters
| Type | Name | Description |
|---|---|---|
| IRefNode | graphName | Name of the Graph to update. |
| System.Collections.Generic.IEnumerable<T><Triple> | additions | Triples to be added. |
| System.Collections.Generic.IEnumerable<T><Triple> | removals | Triples to be removed. |
Overrides
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 |
|---|---|
| System.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. |