Class ThreadSafeGraph
A Thread Safe version of the Graph class.
Implements
Inherited Members
Namespace: VDS.RDF
Assembly: dotNetRdf.dll
Syntax
public class ThreadSafeGraph : Graph, IGraph, INodeFactory, IDisposable, ITripleIndex, IEquatable<IGraph>, IEquatable<Graph>, IEquatable<ThreadSafeGraph>
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
Constructors
| Improve this Doc View SourceThreadSafeGraph()
Creates a new Thread Safe Graph.
Declaration
public ThreadSafeGraph()
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
ThreadSafeGraph(BaseTripleCollection)
Creates a new Thread Safe graph using the given Triple Collection.
Declaration
public ThreadSafeGraph(BaseTripleCollection tripleCollection)
Parameters
Type | Name | Description |
---|---|---|
BaseTripleCollection | tripleCollection | Triple Collection. |
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
ThreadSafeGraph(IRefNode, BaseTripleCollection)
Creates a new named thread-safe graph using the given triple collection.
Declaration
public ThreadSafeGraph(IRefNode name, BaseTripleCollection tripleCollection)
Parameters
Type | Name | Description |
---|---|---|
IRefNode | name | The graph name. |
BaseTripleCollection | tripleCollection | The triple collection that the graph contains. |
Remarks
tripleCollection
will be wrapped as a ThreadSafeTripleCollection by this constructor.
ThreadSafeGraph(IRefNode, ThreadSafeTripleCollection)
Creates a new named thread-safe graph using a thread-safe triple collection.
Declaration
public ThreadSafeGraph(IRefNode name, ThreadSafeTripleCollection tripleCollection)
Parameters
Type | Name | Description |
---|---|---|
IRefNode | name | The graph name. |
ThreadSafeTripleCollection | tripleCollection | The thread-safe triple collection that the graph contains. |
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
ThreadSafeGraph(IRefNode)
Creates a new named thread-safe graph.
Declaration
public ThreadSafeGraph(IRefNode name)
Parameters
Type | Name | Description |
---|---|---|
IRefNode | name | The graph name. |
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
ThreadSafeGraph(ThreadSafeTripleCollection)
Creates a new Thread Safe graph using a Thread Safe triple collection.
Declaration
public ThreadSafeGraph(ThreadSafeTripleCollection tripleCollection)
Parameters
Type | Name | Description |
---|---|---|
ThreadSafeTripleCollection | tripleCollection | Thread Safe triple collection. |
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
Fields
| Improve this Doc View Source_lockManager
Locking Manager for the Graph.
Declaration
protected ReaderWriterLockSlim _lockManager
Field Value
Type | Description |
---|---|
System.Threading.ReaderWriterLockSlim |
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
Methods
| Improve this Doc View SourceAssert(IEnumerable<Triple>)
Asserts a List of Triples in the graph.
Declaration
public override bool Assert(IEnumerable<Triple> ts)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T><Triple> | ts | List of Triples in the form of an IEnumerable. |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
Assert(Triple)
Asserts a Triple in the Graph.
Declaration
public override bool Assert(Triple t)
Parameters
Type | Name | Description |
---|---|---|
Triple | t | The Triple to add to the Graph. |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
Dispose()
Disposes of a Graph.
Declaration
public override void Dispose()
Overrides
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
Equals(ThreadSafeGraph)
Implements equality testing between ThreadSafeGraph instances.
Declaration
public bool Equals(ThreadSafeGraph other)
Parameters
Type | Name | Description |
---|---|---|
ThreadSafeGraph | other |
Returns
Type | Description |
---|---|
System.Boolean |
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
GetBlankNode(string)
Returns the Blank Node with the given Identifier.
Declaration
public override IBlankNode GetBlankNode(string nodeId)
Parameters
Type | Name | Description |
---|---|---|
string | nodeId | The Identifier of the Blank Node to select. |
Returns
Type | Description |
---|---|
IBlankNode | Either the Blank Node or null if no Node with the given Identifier exists. |
Overrides
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
GetLiteralNode(string, string)
Returns the LiteralNode with the given Value in the given Language if it exists.
Declaration
public override ILiteralNode GetLiteralNode(string literal, string langspec)
Parameters
Type | Name | Description |
---|---|---|
string | literal | The literal value of the Node to select. |
string | langspec | The Language Specifier for the Node to select. |
Returns
Type | Description |
---|---|
ILiteralNode | Either the LiteralNode Or null if no Node with the given Value and Language Specifier exists. |
Overrides
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
GetLiteralNode(string, Uri)
Returns the LiteralNode with the given Value and given Data Type if it exists.
Declaration
public override ILiteralNode GetLiteralNode(string literal, Uri datatype)
Parameters
Type | Name | Description |
---|---|---|
string | literal | The literal value of the Node to select. |
System.Uri | datatype | The Uri for the Data Type of the Literal to select. |
Returns
Type | Description |
---|---|
ILiteralNode | Either the LiteralNode Or null if no Node with the given Value and Data Type exists. |
Overrides
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
GetLiteralNode(string)
Returns the LiteralNode with the given Value if it exists.
Declaration
public override ILiteralNode GetLiteralNode(string literal)
Parameters
Type | Name | Description |
---|---|---|
string | literal | The literal value of the Node to select. |
Returns
Type | Description |
---|---|
ILiteralNode | Either the LiteralNode Or null if no Node with the given Value exists. |
Overrides
Remarks
The LiteralNode in the Graph must have no Language or DataType set.
GetNextBlankNodeID()
Creates a new Blank Node ID and returns it.
Declaration
public override string GetNextBlankNodeID()
Returns
Type | Description |
---|---|
string |
Overrides
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
GetTriples(Uri)
Gets all the Triples involving the given Uri.
Declaration
public override IEnumerable<Triple> GetTriples(Uri uri)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | uri | The Uri to find Triples involving. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><Triple> | Zero/More Triples. |
Overrides
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
GetTriples(INode)
Gets all the Triples involving the given Node.
Declaration
public override IEnumerable<Triple> GetTriples(INode n)
Parameters
Type | Name | Description |
---|---|---|
INode | n | The Node to find Triples involving. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><Triple> | Zero/More Triples. |
Overrides
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
GetTriplesWithObject(Uri)
Gets all the Triples with the given Uri as the Object.
Declaration
public override IEnumerable<Triple> GetTriplesWithObject(Uri u)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | u | The Uri to find Triples with it as the Object. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><Triple> | Zero/More Triples. |
Overrides
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
GetTriplesWithObject(INode)
Gets all the Triples with the given Node as the Object.
Declaration
public override IEnumerable<Triple> GetTriplesWithObject(INode n)
Parameters
Type | Name | Description |
---|---|---|
INode | n | The Node to find Triples with it as the Object. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><Triple> |
Overrides
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
GetTriplesWithPredicate(Uri)
Gets all the Triples with the given Uri as the Predicate.
Declaration
public override IEnumerable<Triple> GetTriplesWithPredicate(Uri u)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | u | The Uri to find Triples with it as the Predicate. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><Triple> | Zero/More Triples. |
Overrides
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
GetTriplesWithPredicate(INode)
Gets all the Triples with the given Node as the Predicate.
Declaration
public override IEnumerable<Triple> GetTriplesWithPredicate(INode n)
Parameters
Type | Name | Description |
---|---|---|
INode | n | The Node to find Triples with it as the Predicate. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><Triple> |
Overrides
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
GetTriplesWithSubject(Uri)
Gets all the Triples with the given Uri as the Subject.
Declaration
public override IEnumerable<Triple> GetTriplesWithSubject(Uri u)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | u | The Uri to find Triples with it as the Subject. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><Triple> | Zero/More Triples. |
Overrides
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
GetTriplesWithSubject(INode)
Gets all the Triples with the given Node as the Subject.
Declaration
public override IEnumerable<Triple> GetTriplesWithSubject(INode n)
Parameters
Type | Name | Description |
---|---|---|
INode | n | The Node to find Triples with it as the Subject. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><Triple> | Zero/More Triples. |
Overrides
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
GetUriNode(string)
Returns the UriNode with the given QName if it exists.
Declaration
public override IUriNode GetUriNode(string qname)
Parameters
Type | Name | Description |
---|---|---|
string | qname | The QName of the Node to select. |
Returns
Type | Description |
---|---|
IUriNode |
Overrides
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
GetUriNode(Uri)
Returns the UriNode with the given Uri if it exists.
Declaration
public override IUriNode GetUriNode(Uri uri)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | uri | The Uri of the Node to select. |
Returns
Type | Description |
---|---|
IUriNode | Either the UriNode Or null if no Node with the given Uri exists. |
Overrides
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
Retract(IEnumerable<Triple>)
Retracts a enumeration of Triples from the graph.
Declaration
public override bool Retract(IEnumerable<Triple> ts)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T><Triple> | ts | Enumeration of Triples to retract. |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Remarks
Performance will be marginally worse than a normal Graph but in multi-threaded scenarios this will likely be offset by the benefits of multi-threading.
Retract(Triple)
Retracts a Triple from the Graph.
Declaration
public override bool Retract(Triple t)
Parameters
Type | Name | Description |
---|---|---|
Triple | t | Triple to Retract. |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Remarks
Current implementation may have some defunct Nodes left in the Graph as only the Triple is retracted.