Click or drag to resize

GraphPersistenceWrapper Class

The Graph Persistence Wrapper is a wrapper around another Graph that can be used to batch persistence actions with the ability to Flush/Discard changes as desired.
Inheritance Hierarchy

Namespace:  VDS.RDF
Assembly:  dotNetRDF (in dotNetRDF.dll) Version:
Syntax
[SerializableAttribute]
public class GraphPersistenceWrapper : IGraph, 
	INodeFactory, IDisposable, IXmlSerializable, ITransactionalGraph

The GraphPersistenceWrapper type exposes the following members.

Constructors
  NameDescription
Public methodGraphPersistenceWrapper
Creates a new Graph Persistence Wrapper around a new Graph.
Public methodGraphPersistenceWrapper(Boolean)
Creates a new Graph Persistence Wrapper around a new Graph with the given always queue setting.
Public methodGraphPersistenceWrapper(IGraph)
Creates a new Graph Persistence Wrapper around the given Graph.
Protected methodGraphPersistenceWrapper(SerializationInfo, StreamingContext)
Deserialization Constructor.
Public methodGraphPersistenceWrapper(IGraph, Boolean)
Creates a new Graph Persistence Wrapper around the given Graph with the given always queue setting.
Top
Properties
  NameDescription
Public propertyAllNodes
Gets the unique Subject, Predicate and Object nodes of the Graph.
Public propertyBaseUri
Gets/Sets the Base URI of the Graph.
Public propertyIsEmpty
Gets whether the Graph is empty.
Public propertyNamespaceMap
Gets the Namespace Map for the Graph.
Public propertyNodes
Gets the unique Subject and Object nodes of the Graph.
Protected propertySupportsTriplePersistence
Used to indicate whether the persistence mechansim can persist batches of Triples.
Public propertyTriples
Gets the Triple Collection for the Graph.
Top
Methods
  NameDescription
Public methodAssert(IEnumerableTriple)
Asserts Triples in the Graph.
Public methodAssert(Triple)
Asserts a Triple in the Graph.
Protected methodAttachEventHandlers
Helper method for attaching the necessary event Handlers to a Triple Collection.
Public methodClear
Clears the Graph.
Public methodContainsTriple
Gets whether a given Triple exists in this Graph.
Public methodCreateBlankNode
Creates a new Blank Node.
Public methodCreateBlankNode(String)
Creates a new Blank Node with the given Node ID.
Public methodCreateGraphLiteralNode
Creates a new Graph Literal Node.
Public methodCreateGraphLiteralNode(IGraph)
Creates a new Graph Literal Node with the given sub-graph.
Public methodCreateLiteralNode(String)
Creates a new Literal Node.
Public methodCreateLiteralNode(String, String)
Creates a new Literal Node with the given Language.
Public methodCreateLiteralNode(String, Uri)
Creates a new Literal Node with the given Datatype.
Public methodCreateUriNode
Creates a new URI Node that references the Graphs Base URI.
Public methodCreateUriNode(String)
Creates a new URI Node from a QName.
Public methodCreateUriNode(Uri)
Creates a new URI Node.
Public methodCreateVariableNode
Creates a new Variable Node.
Protected methodDetachEventHandlers
Helper method for detaching the necessary event Handlers from a Triple Collection.
Public methodDifference
Computes the Difference between this Graph the given Graph.
Public methodDiscard
Discards all changes which have yet to be persisted so that they are not persisted to the underlying storage.
Public methodDispose
Disposes of the persistence wrapper and in doing so persists any changes to the underlying storage.
Protected methodDispose(Boolean)
Disposes of the persistence wrapper and in doing so persists any changes to the underlying storage.
Public methodEquals(Object)
Determines whether a Graph is equal to another Object.
(Overrides ObjectEquals(Object).)
Public methodEquals(IGraph, DictionaryINode, INode)
Determines whether this Graph is equal to the given Graph.
Protected methodFinalize
Destructor for the wrapper to ensure that Dispose() is called and thus that persistence happens
(Overrides ObjectFinalize.)
Public methodFlush
Flushes all changes which have yet to be persisted to the underlying storage.
Public methodGetBlankNode
Attempts to get the Blank Node with the given ID.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetLiteralNode(String)
Attempts to get the Literal Node with the given Value.
Public methodGetLiteralNode(String, String)
Attempts to get the Literal Node with the given Value and Language.
Public methodGetLiteralNode(String, Uri)
Attempts to get the Literal Node with the given Value and Datatype.
Public methodGetNextBlankNodeID
Gets the next available Blank Node ID.
Public methodGetObjectData
Gets the Serialization Information.
Public methodGetSchema
Gets the Schema for XML serialization.
Public methodGetTriples(Uri)
Gets all the Triples involving the given URI.
Public methodGetTriples(INode)
Gets all the Triples involving the given Node.
Public methodGetTriplesWithObject(Uri)
Gets all the Triples with the given URI as the Object.
Public methodGetTriplesWithObject(INode)
Gets all the Triples with the given Node as the Object.
Public methodGetTriplesWithPredicate(Uri)
Gets all the Triples with the given Uri as the Predicate.
Public methodGetTriplesWithPredicate(INode)
Gets all the Triples with the given Node as the Predicate.
Public methodGetTriplesWithPredicateObject
Selects all Triples with the given Predicate and Object.
Public methodGetTriplesWithSubject(Uri)
Gets all the Triples with the given Uri as the Subject.
Public methodGetTriplesWithSubject(INode)
Gets all the Triples with the given Node as the Subject.
Public methodGetTriplesWithSubjectObject
Selects all Triples with the given Subject and Object.
Public methodGetTriplesWithSubjectPredicate
Selects all Triples with the given Subject and Predicate.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetUriNode(String)
Returns the UriNode with the given QName if it exists.
Public methodGetUriNode(Uri)
Returns the UriNode with the given Uri if it exists.
Public methodHasSubGraph(IGraph)
Checks whether this Graph has the given Graph as a sub-graph.
Public methodHasSubGraph(IGraph, DictionaryINode, INode)
Checks whether this Graph has the given Graph as a sub-graph.
Public methodIsSubGraphOf(IGraph)
Checks whether this Graph is a sub-graph of the given Graph.
Public methodIsSubGraphOf(IGraph, DictionaryINode, INode)
Checks whether this Graph is a sub-graph of the given Graph.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodMerge(IGraph)
Merges another Graph into the current Graph.
Public methodMerge(IGraph, Boolean)
Merges another Graph into the current Graph.
Protected methodOnTripleAsserted
Event Handler which handles the Triple Added event from the underlying Triple Collection by raising the Graph's TripleAsserted event.
Protected methodOnTripleRetracted
Event Handler which handles the Triple Removed event from the underlying Triple Collection by raising the Graph's Triple Retracted event.
Protected methodPersistDeletedTriples
Persists deleted Triples to the underlying Storage.
Protected methodPersistGraph
Persists the entire Graph to the underlying Storage.
Protected methodPersistInsertedTriples
Persists inserted Triples to the underlying Storage.
Protected methodRaiseCleared
Helper method for raising the Cleared event.
Protected methodRaiseClearRequested
Helper method for raising the Clear Requested event and returning whether any of the Event Handlers cancelled the operation.
Protected methodRaiseGraphChanged
Helper method for raising the Changed event.
Protected methodRaiseGraphChanged(TripleEventArgs)
Helper method for raising the Changed event.
Protected methodRaiseMerged
Helper method for raising the Merged event.
Protected methodRaiseMergeRequested
Helper method for raising the Merge Requested event and returning whether any of the Event Handlers cancelled the operation.
Protected methodRaiseTripleAsserted(Triple)
Helper method for raising the Triple Asserted event manually.
Protected methodRaiseTripleAsserted(TripleEventArgs)
Helper method for raising the Triple Asserted event manually.
Protected methodRaiseTripleRetracted(Triple)
Helper method for raising the Triple Retracted event manually.
Protected methodRaiseTripleRetracted(TripleEventArgs)
Helper method for raising the Triple Retracted event manually.
Public methodReadXml
Reads the data for XML deserialization.
Public methodResolveQName
Helper function for Resolving QNames to URIs.
Public methodRetract(IEnumerableTriple)
Retracts Triples from the Graph.
Public methodRetract(Triple)
Retracts a Triple from the Graph.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodWriteXml
Writes the data for XML serialization.
Top
Events
  NameDescription
Public eventChanged
Event which is raised when the Graph contents change
Public eventCleared
Event which is raised after the Graph is cleared of its contents
Public eventClearRequested
Event which is raised just before the Graph is cleared of its contents
Public eventMerged
Event which is raised when a Merge operation is completed on the Graph
Public eventMergeRequested
Event which is raised when a Merge operation is requested on the Graph
Public eventTripleAsserted
Event which is raised when a Triple is asserted in the Graph
Public eventTripleRetracted
Event which is raised when a Triple is retracted from the Graph
Top
Fields
  NameDescription
Protected field_g
Underlying Graph this is a wrapper around.
Top
Extension Methods
  NameDescription
Public Extension MethodAddToList(INode, IEnumerableINode)Overloaded.
Adds new items to the end of a list (aka a RDF collection).
(Defined by Extensions.)
Public Extension MethodAddToListT(INode, IEnumerableT, FuncT, INode)Overloaded.
Adds new items to the end of a list (aka a RDF collection).
(Defined by Extensions.)
Public Extension MethodAsDynamic
Dynamically wraps a graph.
(Defined by DynamicExtensions.)
Public Extension MethodAssert
Asserts a new Triple in the Graph.
(Defined by Extensions.)
Public Extension MethodAssertList(IEnumerableINode)Overloaded.
Asserts a list as a RDF collection and returns the node that represents the root of the RDF collection.
(Defined by Extensions.)
Public Extension MethodAssertList(INode, IEnumerableINode)Overloaded.
Asserts a list as a RDF collection using an existing node as the list root.
(Defined by Extensions.)
Public Extension MethodAssertListT(IEnumerableT, FuncT, INode)Overloaded.
Asserts a list as a RDF collection and returns the node that represents the root of the RDF collection.
(Defined by Extensions.)
Public Extension MethodAssertListT(INode, IEnumerableT, FuncT, INode)Overloaded.
Asserts a list as a RDF collection using an existing node as the list root.
(Defined by Extensions.)
Public Extension MethodExecuteQuery(String)Overloaded.
Executes a SPARQL Query on a Graph.
(Defined by GraphExtensions.)
Public Extension MethodExecuteQuery(SparqlParameterizedString)Overloaded.
Executes a SPARQL Query on a Graph.
(Defined by GraphExtensions.)
Public Extension MethodExecuteQuery(SparqlQuery)Overloaded.
Executes a SPARQL Query on a Graph.
(Defined by GraphExtensions.)
Public Extension MethodExecuteQuery(IRdfHandler, ISparqlResultsHandler, String)Overloaded.
Executes a SPARQL Query on a Graph handling the results using the handlers provided.
(Defined by GraphExtensions.)
Public Extension MethodExecuteQuery(IRdfHandler, ISparqlResultsHandler, SparqlParameterizedString)Overloaded.
Executes a SPARQL Query on a Graph handling the results using the handlers provided.
(Defined by GraphExtensions.)
Public Extension MethodExecuteQuery(IRdfHandler, ISparqlResultsHandler, SparqlQuery)Overloaded.
Executes a SPARQL Query on a Graph handling the results using the handlers provided.
(Defined by GraphExtensions.)
Public Extension MethodGetListAsTriples
Gets all the Triples that make up a list (aka a RDF collection).
(Defined by Extensions.)
Public Extension MethodGetListItems
Gets all the Nodes which are the items of the list (aka the RDF collection).
(Defined by Extensions.)
Public Extension MethodGetListNodes
Gets all the Nodes which are the intermediate nodes in the list (aka the RDF collection). These represents the nodes used to link the actual items of the list together rather than the actual items of the list.
(Defined by Extensions.)
Public Extension MethodLoadFromEmbeddedResource(String)Overloaded.
Loads RDF data from an Embedded Resource into a Graph.
(Defined by GraphExtensions.)
Public Extension MethodLoadFromEmbeddedResource(String, IRdfReader)Overloaded.
Loads RDF data from an Embedded Resource into a Graph.
(Defined by GraphExtensions.)
Public Extension MethodLoadFromFile(String)Overloaded.
Loads RDF data from a file into a Graph.
(Defined by GraphExtensions.)
Public Extension MethodLoadFromFile(String, IRdfReader)Overloaded.
Loads RDF data from a file into a Graph.
(Defined by GraphExtensions.)
Public Extension MethodLoadFromString(String)Overloaded.
Loads RDF data from a String into a Graph.
(Defined by GraphExtensions.)
Public Extension MethodLoadFromString(String, IRdfReader)Overloaded.
Loads RDF data from a String into a Graph.
(Defined by GraphExtensions.)
Public Extension MethodLoadFromUri(Uri)Overloaded.
Loads RDF data from a URI into a Graph.
(Defined by GraphExtensions.)
Public Extension MethodLoadFromUri(Uri, IRdfReader)Overloaded.
Loads RDF data from a URI into a Graph.
(Defined by GraphExtensions.)
Public Extension MethodRemoveFromList(INode, IEnumerableINode)Overloaded.
Removes the given items from a list (aka a RDF collection), if an item occurs multiple times in the list all occurrences will be removed.
(Defined by Extensions.)
Public Extension MethodRemoveFromListT(INode, IEnumerableT, FuncT, INode)Overloaded.
Removes the given items from a list (aka a RDF collection), if an item occurs multiple times in the list all occurrences will be removed.
(Defined by Extensions.)
Public Extension MethodRetract
Retracts a Triple from the Graph.
(Defined by Extensions.)
Public Extension MethodRetractList
Retracts a List (aka a RDF collection).
(Defined by Extensions.)
Public Extension MethodSaveToFile(String)Overloaded.
Saves a Graph to a File.
(Defined by GraphExtensions.)
Public Extension MethodSaveToFile(String, IRdfWriter)Overloaded.
Saves a Graph to a File.
(Defined by GraphExtensions.)
Public Extension MethodSaveToFile(String, IStoreWriter)Overloaded.
Saves a Graph to a File.
(Defined by GraphExtensions.)
Public Extension MethodSaveToStream(TextWriter, IRdfWriter)Overloaded.
Saves a Graph to a stream.
(Defined by GraphExtensions.)
Public Extension MethodSaveToStream(TextWriter, IStoreWriter)Overloaded.
Saves a Graph to a stream.
(Defined by GraphExtensions.)
Public Extension MethodSaveToStream(String, TextWriter)Overloaded.
Save a graph to a stream, determining the type of writer to use by the output file name.
(Defined by GraphExtensions.)
Top
Remarks

When disposed any outstanding changes are always flushed so if you make changes which you don't want to persist be sure to call the Discard() method before disposing of the Graph.

Implementors who wish to make persistent graphs should extend this class and override the SupportsTriplePersistence property and the PersistInsertedTriples(), PersistDeletedTriples() and PersistGraph() methods. If you return true for the property then the PersistInsertedTriples() and PersistDeletedTriples() methods will be invoked to do persistence on batches of Triples. If your persistence mechanism requires persisting the entire graph at once return false for the property and override the PersistGraph() method appropriately.

Warning

Note that the wrapper does not automatically dispose of the wrapped graph when the wrapper is Dispose, this is by design since disposing of the wrapped Graph can have unintended consequences.

See Also