Class PersistentTripleStore
Implements
Inherited Members
Namespace: VDS.RDF
Assembly: dotNetRDF.dll
Syntax
public sealed class PersistentTripleStore : BaseTripleStore, INativelyQueryableStore, IUpdateableTripleStore, ITransactionalStore, ITripleStore, IDisposable
Remarks
Persistence Behaviour
Note: This is a transactional implementation - this means that changes made are not persisted until you either call Flush() or you dispose of the instance. Alternatively you may invoke the Discard() method to throw away changes made to the in-memory state.
The actual level of persistence provided will vary according to the IStorageProvider instance you use. For example if the DeleteGraph(Uri) method is not supported then Graph removals won't persist in the underlying store. Similarily an instance which is read-only will allow you to pull out existing graphs from the store but won't persist any changes.
The Contains() method of the underlying BaseGraphCollection has been overridden so that invoking Contains causes the Graph from the underlying store to be loaded if it exists, this means that operations like HasGraph(Uri) may be slower than expected or cause applications to stop while they wait to load data from the store.
SPARQL Query Behaviour
The exact SPARQL Query behaviour will depend on the capabilities of the underlying IStorageProvider instance. If it also implements the IQueryableStorage interface then its own SPARQL implementation will be used, note that if you try and make a SPARQL query but the in-memory view has not been synced (via a Flush() or Discard() call) prior to the query then an RdfQueryException will be thrown. If you want to make the query regardless you can do so by invoking the query method on the underlying store directly by accessing it via the UnderlyingStore property.
If the underlying store does not support SPARQL itself then SPARQL queries cannot be applied and a System.NotSupportedException will be thrown.
SPARQL Update Behaviour
Similarly to SPARQL Query support the SPARQL Update behaviour depends on whether the underlying IStorageProvider instance also implements the IUpdateableStorage interface. If it does then its own SPARQL implementation is used, otherwise a GenericUpdateProcessor will be used to approximate the SPARQL Update.
Please be aware that as with SPARQL Query if the in-memory view is not synced with the underlying store a SparqlUpdateException will be thrown.
Other Notes
It is possible for the in-memory view of the triple store to get out of sync with the underlying store if that store is being modified by other processes or other code not utilising the PersistentTripleStore instance that you have created. Currently there is no means to resync the in-memory view with the underlying view so you should be careful of using this class in scenarios where your underlying store may be modified.
Constructors
| Improve this Doc View SourcePersistentTripleStore(IStorageProvider)
Declaration
public PersistentTripleStore(IStorageProvider manager)
Parameters
Type | Name | Description |
---|---|---|
IStorageProvider | manager | IO Manager. |
Remarks
Properties
| Improve this Doc View SourceUnderlyingStore
Declaration
public IStorageProvider UnderlyingStore { get; }
Property Value
Type | Description |
---|---|
IStorageProvider |
Methods
| Improve this Doc View SourceDiscard()
Declaration
public void Discard()
Dispose()
Declaration
public override void Dispose()
Overrides
Remarks
ExecuteQuery(String)
Declaration
public object ExecuteQuery(string query)
Parameters
Type | Name | Description |
---|---|---|
System.String | query | Sparql Query as unparsed String. |
Returns
Type | Description |
---|---|
System.Object |
ExecuteQuery(IRdfHandler, ISparqlResultsHandler, String)
Declaration
public void ExecuteQuery(IRdfHandler rdfHandler, ISparqlResultsHandler resultsHandler, string query)
Parameters
Type | Name | Description |
---|---|---|
IRdfHandler | rdfHandler | RDF Handler. |
ISparqlResultsHandler | resultsHandler | Results Handler. |
System.String | query | SPARQL Query as unparsed String. |
ExecuteUpdate(String)
Declaration
public void ExecuteUpdate(string update)
Parameters
Type | Name | Description |
---|---|---|
System.String | update | SPARQL Update Command(s). |
Remarks
ExecuteUpdate(SparqlUpdateCommand)
Declaration
public void ExecuteUpdate(SparqlUpdateCommand update)
Parameters
Type | Name | Description |
---|---|---|
SparqlUpdateCommand | update | SPARQL Update Command. |
ExecuteUpdate(SparqlUpdateCommandSet)
Declaration
public void ExecuteUpdate(SparqlUpdateCommandSet updates)
Parameters
Type | Name | Description |
---|---|---|
SparqlUpdateCommandSet | updates | SPARQL Update Command Set. |
Finalize()
Declaration
protected void Finalize()
Remarks
Flush()
Declaration
public void Flush()