Show / Hide Table of Contents

Class ThreadSafeGraph

A Thread Safe version of the Graph class.

Inheritance
object
BaseGraph
Graph
ThreadSafeGraph
NonIndexedThreadSafeGraph
Implements
IGraph
INodeFactory
IDisposable
ITripleIndex
IEquatable<IGraph>
IEquatable<Graph>
IEquatable<ThreadSafeGraph>
Inherited Members
Graph.Equals(Graph)
Graph.GetTripleNode(Triple)
Graph.GetTriplesWithSubjectPredicate(INode, INode)
Graph.GetTriplesWithSubjectObject(INode, INode)
Graph.GetTriplesWithPredicateObject(INode, INode)
Graph.GetQuoted(INode)
Graph.GetQuotedWithObject(INode)
Graph.GetQuotedWithPredicate(INode)
Graph.GetQuotedWithSubject(INode)
Graph.GetQuotedWithSubjectPredicate(INode, INode)
Graph.GetQuotedWithSubjectObject(INode, INode)
Graph.GetQuotedWithPredicateObject(INode, INode)
BaseGraph._triples
BaseGraph.NodeFactory
BaseGraph.UriFactory
BaseGraph._name
BaseGraph._bnodemapper
BaseGraph.Triples
BaseGraph.QuotedTriples
BaseGraph.Nodes
BaseGraph.AllNodes
BaseGraph.QuotedNodes
BaseGraph.AllQuotedNodes
BaseGraph.NamespaceMap
BaseGraph.BaseUri
BaseGraph.Name
BaseGraph.IsEmpty
BaseGraph.NormalizeLiteralValues
BaseGraph.LanguageTagValidation
BaseGraph.Clear()
BaseGraph.CreateBlankNode()
BaseGraph.CreateBlankNode(string)
BaseGraph.CreateGraphLiteralNode()
BaseGraph.CreateGraphLiteralNode(IGraph)
BaseGraph.CreateLiteralNode(string, Uri)
BaseGraph.CreateLiteralNode(string)
BaseGraph.CreateLiteralNode(string, string)
BaseGraph.CreateUriNode(Uri)
BaseGraph.CreateUriNode(string)
BaseGraph.CreateUriNode()
BaseGraph.CreateVariableNode(string)
BaseGraph.CreateTripleNode(Triple)
BaseGraph.ContainsTriple(Triple)
BaseGraph.ContainsQuotedTriple(Triple)
BaseGraph.GetQuoted(Uri)
BaseGraph.GetQuotedWithObject(Uri)
BaseGraph.GetQuotedWithPredicate(Uri)
BaseGraph.GetQuotedWithSubject(Uri)
BaseGraph.Merge(IGraph)
BaseGraph.Merge(IGraph, bool)
BaseGraph.Unstar()
BaseGraph.Equals(IGraph)
BaseGraph.Equals(IGraph, out Dictionary<INode, INode>)
BaseGraph.IsSubGraphOf(IGraph)
BaseGraph.IsSubGraphOf(IGraph, out Dictionary<INode, INode>)
BaseGraph.HasSubGraph(IGraph)
BaseGraph.HasSubGraph(IGraph, out Dictionary<INode, INode>)
BaseGraph.Difference(IGraph)
BaseGraph.ResolveQName(string)
BaseGraph.TripleAsserted
BaseGraph.TripleRetracted
BaseGraph.Changed
BaseGraph.ClearRequested
BaseGraph.Cleared
BaseGraph.MergeRequested
BaseGraph.Merged
BaseGraph.OnTripleAsserted(object, TripleEventArgs)
BaseGraph.RaiseTripleAsserted(TripleEventArgs)
BaseGraph.RaiseTripleAsserted(Triple)
BaseGraph.OnTripleRetracted(object, TripleEventArgs)
BaseGraph.RaiseTripleRetracted(TripleEventArgs)
BaseGraph.RaiseTripleRetracted(Triple)
BaseGraph.RaiseGraphChanged(TripleEventArgs)
BaseGraph.RaiseGraphChanged()
BaseGraph.RaiseClearRequested()
BaseGraph.RaiseCleared()
BaseGraph.RaiseMergeRequested()
BaseGraph.RaiseMerged()
BaseGraph.AttachEventHandlers(BaseTripleCollection)
BaseGraph.DetachEventHandlers(BaseTripleCollection)
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
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

| Edit this page View Source

ThreadSafeGraph()

Creates a new Thread Safe Graph.

Declaration
public ThreadSafeGraph()
| Edit this page View Source

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.

| Edit this page View Source

ThreadSafeGraph(IRefNode)

Creates a new named thread-safe graph.

Declaration
public ThreadSafeGraph(IRefNode name)
Parameters
Type Name Description
IRefNode name

The graph name.

| Edit this page View Source

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.

| Edit this page View Source

ThreadSafeGraph(IRefNode, INodeFactory, IUriFactory, BaseTripleCollection, bool)

Creates a new Thread Safe graph using the given name, factories and triple collection.

Declaration
public ThreadSafeGraph(IRefNode name, INodeFactory nodeFactory = null, IUriFactory uriFactory = null, BaseTripleCollection tripleCollection = null, bool emptyNamespaceMap = false)
Parameters
Type Name Description
IRefNode name
INodeFactory nodeFactory
IUriFactory uriFactory
BaseTripleCollection tripleCollection
bool emptyNamespaceMap
Remarks

If tripleCollection is not an instance of ThreadSafeTripleCollection, it will be wrapped in a ThreadSafeTripleCollection. This constructor is used by the GraphFactory class in the Configuration namespace.

| Edit this page View Source

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.

| Edit this page View Source

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.

Fields

| Edit this page View Source

_lockManager

Locking Manager for the Graph.

Declaration
protected ReaderWriterLockSlim _lockManager
Field Value
Type Description
ReaderWriterLockSlim

Methods

| Edit this page View Source

Assert(IEnumerable<Triple>)

Asserts a List of Triples in the graph.

Declaration
public override bool Assert(IEnumerable<Triple> ts)
Parameters
Type Name Description
IEnumerable<Triple> ts

List of Triples in the form of an IEnumerable.

Returns
Type Description
bool
Overrides
Graph.Assert(IEnumerable<Triple>)
| Edit this page View Source

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
bool
Overrides
Graph.Assert(Triple)
| Edit this page View Source

Dispose()

Disposes of a Graph.

Declaration
public override void Dispose()
Overrides
BaseGraph.Dispose()
| Edit this page View Source

Equals(ThreadSafeGraph)

Implements equality testing between ThreadSafeGraph instances.

Declaration
public bool Equals(ThreadSafeGraph other)
Parameters
Type Name Description
ThreadSafeGraph other
Returns
Type Description
bool
| Edit this page View Source

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
Graph.GetBlankNode(string)
| Edit this page View Source

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
Graph.GetLiteralNode(string)
Remarks

The LiteralNode in the Graph must have no Language or DataType set.

| Edit this page View Source

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
Graph.GetLiteralNode(string, string)
| Edit this page View Source

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.

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
Graph.GetLiteralNode(string, Uri)
| Edit this page View Source

GetNextBlankNodeID()

Creates a new Blank Node ID and returns it.

Declaration
public override string GetNextBlankNodeID()
Returns
Type Description
string
Overrides
BaseGraph.GetNextBlankNodeID()
| Edit this page View Source

GetTriples(Uri)

Gets all the Triples involving the given Uri.

Declaration
public override IEnumerable<Triple> GetTriples(Uri uri)
Parameters
Type Name Description
Uri uri

The Uri to find Triples involving.

Returns
Type Description
IEnumerable<Triple>

Zero/More Triples.

Overrides
Graph.GetTriples(Uri)
| Edit this page View Source

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
IEnumerable<Triple>

Zero/More Triples.

Overrides
Graph.GetTriples(INode)
| Edit this page View Source

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
Uri u

The Uri to find Triples with it as the Object.

Returns
Type Description
IEnumerable<Triple>

Zero/More Triples.

Overrides
Graph.GetTriplesWithObject(Uri)
| Edit this page View Source

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
IEnumerable<Triple>
Overrides
Graph.GetTriplesWithObject(INode)
| Edit this page View Source

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
Uri u

The Uri to find Triples with it as the Predicate.

Returns
Type Description
IEnumerable<Triple>

Zero/More Triples.

Overrides
Graph.GetTriplesWithPredicate(Uri)
| Edit this page View Source

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
IEnumerable<Triple>
Overrides
Graph.GetTriplesWithPredicate(INode)
| Edit this page View Source

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
Uri u

The Uri to find Triples with it as the Subject.

Returns
Type Description
IEnumerable<Triple>

Zero/More Triples.

Overrides
Graph.GetTriplesWithSubject(Uri)
| Edit this page View Source

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
IEnumerable<Triple>

Zero/More Triples.

Overrides
Graph.GetTriplesWithSubject(INode)
| Edit this page View Source

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
Graph.GetUriNode(string)
| Edit this page View Source

GetUriNode(Uri)

Returns the UriNode with the given Uri if it exists.

Declaration
public override IUriNode GetUriNode(Uri uri)
Parameters
Type Name Description
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
Graph.GetUriNode(Uri)
| Edit this page View Source

Retract(IEnumerable<Triple>)

Retracts a enumeration of Triples from the graph.

Declaration
public override bool Retract(IEnumerable<Triple> ts)
Parameters
Type Name Description
IEnumerable<Triple> ts

Enumeration of Triples to retract.

Returns
Type Description
bool
Overrides
Graph.Retract(IEnumerable<Triple>)
| Edit this page View Source

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
bool
Overrides
Graph.Retract(Triple)
Remarks

Current implementation may have some defunct Nodes left in the Graph as only the Triple is retracted.

Implements

IGraph
INodeFactory
IDisposable
ITripleIndex
IEquatable<T>
IEquatable<T>
IEquatable<T>

Extension Methods

Extensions.ToSafeString(object)
GraphExtensions.ToDataTable(IGraph)
DynamicExtensions.AsDynamic(IGraph, Uri, Uri)
Extensions.AddToList(IGraph, INode, IEnumerable<INode>)
Extensions.AddToList<T>(IGraph, INode, IEnumerable<T>, Func<T, INode>)
Extensions.Assert(IGraph, INode, INode, INode)
Extensions.AssertList(IGraph, IEnumerable<INode>)
Extensions.AssertList(IGraph, INode, IEnumerable<INode>)
Extensions.AssertList<T>(IGraph, IEnumerable<T>, Func<T, INode>)
Extensions.AssertList<T>(IGraph, INode, IEnumerable<T>, Func<T, INode>)
Extensions.GetListAsTriples(IGraph, INode)
Extensions.GetListItems(IGraph, INode)
Extensions.GetListNodes(IGraph, INode)
Extensions.RemoveFromList(IGraph, INode, IEnumerable<INode>)
Extensions.RemoveFromList<T>(IGraph, INode, IEnumerable<T>, Func<T, INode>)
Extensions.Retract(IGraph, INode, INode, INode)
Extensions.RetractList(IGraph, INode)
GraphExtensions.GetETag(IGraph)
GraphExtensions.LoadFromEmbeddedResource(IGraph, string)
GraphExtensions.LoadFromEmbeddedResource(IGraph, string, IRdfReader)
GraphExtensions.LoadFromFile(IGraph, string)
GraphExtensions.LoadFromFile(IGraph, string, IRdfReader)
GraphExtensions.LoadFromString(IGraph, string)
GraphExtensions.LoadFromString(IGraph, string, IRdfReader)
GraphExtensions.LoadFromUri(IGraph, Uri, IRdfReader, Loader)
GraphExtensions.LoadFromUri(IGraph, Uri, Loader)
GraphExtensions.SaveToFile(IGraph, string)
GraphExtensions.SaveToFile(IGraph, string, IRdfWriter)
GraphExtensions.SaveToFile(IGraph, string, IStoreWriter)
GraphExtensions.SaveToStream(IGraph, TextWriter, IRdfWriter)
GraphExtensions.SaveToStream(IGraph, TextWriter, IStoreWriter)
GraphExtensions.SaveToStream(IGraph, string, TextWriter)
InMemoryExtensions.ExecuteQuery(IGraph, string)
InMemoryExtensions.ExecuteQuery(IGraph, IRdfHandler, ISparqlResultsHandler, string)
InMemoryExtensions.ExecuteQuery(IGraph, IRdfHandler, ISparqlResultsHandler, SparqlParameterizedString)
InMemoryExtensions.ExecuteQuery(IGraph, IRdfHandler, ISparqlResultsHandler, SparqlQuery)
InMemoryExtensions.ExecuteQuery(IGraph, SparqlParameterizedString)
InMemoryExtensions.ExecuteQuery(IGraph, SparqlQuery)
Extensions.AsEnumerable<T>(T)
  • Edit this page
  • View Source
In this article
  • Constructors
    • ThreadSafeGraph()
    • ThreadSafeGraph(BaseTripleCollection)
    • ThreadSafeGraph(IRefNode)
    • ThreadSafeGraph(IRefNode, BaseTripleCollection)
    • ThreadSafeGraph(IRefNode, INodeFactory, IUriFactory, BaseTripleCollection, bool)
    • ThreadSafeGraph(IRefNode, ThreadSafeTripleCollection)
    • ThreadSafeGraph(ThreadSafeTripleCollection)
  • Fields
    • _lockManager
  • Methods
    • Assert(IEnumerable<Triple>)
    • Assert(Triple)
    • Dispose()
    • Equals(ThreadSafeGraph)
    • GetBlankNode(string)
    • GetLiteralNode(string)
    • GetLiteralNode(string, string)
    • GetLiteralNode(string, Uri)
    • GetNextBlankNodeID()
    • GetTriples(Uri)
    • GetTriples(INode)
    • GetTriplesWithObject(Uri)
    • GetTriplesWithObject(INode)
    • GetTriplesWithPredicate(Uri)
    • GetTriplesWithPredicate(INode)
    • GetTriplesWithSubject(Uri)
    • GetTriplesWithSubject(INode)
    • GetUriNode(string)
    • GetUriNode(Uri)
    • Retract(IEnumerable<Triple>)
    • Retract(Triple)
  • Implements
  • Extension Methods
Back to top Generated by DocFX