Click or drag to resize

PersistentTripleStore Class

Represents an in-memory view of a triple store provided by an IStorageProvider instance where changes to the in-memory view get reflected in the persisted view.
Inheritance Hierarchy

Namespace:  VDS.RDF
Assembly:  dotNetRDF (in dotNetRDF.dll) Version:
Syntax
public sealed class PersistentTripleStore : BaseTripleStore, 
	INativelyQueryableStore, ITripleStore, IDisposable, IUpdateableTripleStore, ITransactionalStore

The PersistentTripleStore type exposes the following members.

Constructors
  NameDescription
Public methodPersistentTripleStore
Creates a new in-memory view of some underlying store represented by the IStorageProvider instance.
Top
Properties
  NameDescription
Public propertyGraphs
Gets the Collection of Graphs that comprise this Triple Store.
(Inherited from BaseTripleStore.)
Public propertyIsEmpty
Gets whether the Triple Store is empty.
(Inherited from BaseTripleStore.)
Public propertyItem
Gets the Graph with the given URI.
(Inherited from BaseTripleStore.)
Public propertyTriples
Gets all the Triples in the Triple Store.
(Inherited from BaseTripleStore.)
Public propertyUnderlyingStore
Gets the underlying store.
Top
Methods
  NameDescription
Public methodAdd(IGraph)
Adds a Graph into the Triple Store.
(Inherited from BaseTripleStore.)
Public methodAdd(IGraph, Boolean)
Adds a Graph into the Triple Store using the chosen Merging Behaviour.
(Inherited from BaseTripleStore.)
Public methodAddFromUri(Uri)
Adds a Graph into the Triple Store which is retrieved from the given Uri.
(Inherited from BaseTripleStore.)
Public methodAddFromUri(Uri, Boolean)
Adds a Graph into the Triple Store which is retrieved from the given Uri using the chosen Merging Behaviour.
(Inherited from BaseTripleStore.)
Public methodDiscard
Discards any outstanding changes returning the in-memory view of the store to the state it was in after the last Flush/Discard operation.
Public methodDispose
Disposes of the Triple Store flushing any outstanding changes to the underlying store.
(Overrides BaseTripleStoreDispose.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodExecuteQuery(String)
Executes a SPARQL Query on the Triple Store.
Public methodExecuteQuery(IRdfHandler, ISparqlResultsHandler, String)
Executes a SPARQL Query on the Triple Store processing the results using an appropriate handler from those provided.
Public methodExecuteUpdate(String)
Executes an Update against the Triple Store.
Public methodExecuteUpdate(SparqlUpdateCommand)
Executes a single Update Command against the Triple Store.
Public methodExecuteUpdate(SparqlUpdateCommandSet)
Executes a set of Update Commands against the Triple Store.
Protected methodFinalize
Finalizer which ensures that the instance is properly disposed of thereby persisting any outstanding changes to the underlying store
(Overrides ObjectFinalize.)
Public methodFlush
Flushes any outstanding changes to the underlying store.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodHasGraph
Checks whether a Graph with the given Base Uri exists in the Triple Store.
(Inherited from BaseTripleStore.)
Public methodRemove
Removes a Graph from the Triple Store.
(Inherited from BaseTripleStore.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Events
  NameDescription
Public eventGraphAdded
Event which is raised when a Graph is added
(Inherited from BaseTripleStore.)
Public eventGraphChanged
Event which is raised when a Graphs contents changes
(Inherited from BaseTripleStore.)
Public eventGraphCleared
Event which is raised when a Graph is cleared
(Inherited from BaseTripleStore.)
Public eventGraphMerged
Event which is raised when a Graph has a merge operation performed on it
(Inherited from BaseTripleStore.)
Public eventGraphRemoved
Event which is raised when a Graph is removed
(Inherited from BaseTripleStore.)
Top
Extension Methods
  NameDescription
Public Extension MethodLoadFromEmbeddedResource(String)Overloaded.
Loads an RDF dataset from an Embedded Resource into a Triple Store.
(Defined by TripleStoreExtensions.)
Public Extension MethodLoadFromEmbeddedResource(String, IStoreReader)Overloaded.
Loads an RDF dataset from an Embedded Resource into a Triple Store.
(Defined by TripleStoreExtensions.)
Public Extension MethodLoadFromFile(String)Overloaded.
Loads an RDF dataset from a file into a Triple Store.
(Defined by TripleStoreExtensions.)
Public Extension MethodLoadFromFile(String, IStoreReader)Overloaded.
Loads an RDF dataset from a file into a Triple Store.
(Defined by TripleStoreExtensions.)
Public Extension MethodLoadFromString(String)Overloaded.
Loads an RDF dataset from a String into a Triple Store.
(Defined by TripleStoreExtensions.)
Public Extension MethodLoadFromString(String, IStoreReader)Overloaded.
Loads an RDF dataset from a String into a Triple Store.
(Defined by TripleStoreExtensions.)
Public Extension MethodLoadFromUri(Uri)Overloaded.
Loads an RDF dataset from a URI into a Triple Store.
(Defined by TripleStoreExtensions.)
Public Extension MethodLoadFromUri(Uri, IStoreReader)Overloaded.
Loads an RDF dataset from a URI into a Triple Store.
(Defined by TripleStoreExtensions.)
Public Extension MethodSaveToFile(String)Overloaded.
Saves a Triple Store to a file.
(Defined by TripleStoreExtensions.)
Public Extension MethodSaveToFile(String, IStoreWriter)Overloaded.
Saves a Triple Store to a file.
(Defined by TripleStoreExtensions.)
Top
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() 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() 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 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.

See Also