Show / Hide Table of Contents

Interface IGraph

Interface for RDF Graphs.
Inherited Members
INodeFactory.CreateBlankNode()
INodeFactory.CreateBlankNode(String)
INodeFactory.CreateGraphLiteralNode()
INodeFactory.CreateGraphLiteralNode(IGraph)
INodeFactory.CreateLiteralNode(String, Uri)
INodeFactory.CreateLiteralNode(String)
INodeFactory.CreateLiteralNode(String, String)
INodeFactory.CreateUriNode(Uri)
INodeFactory.CreateVariableNode(String)
INodeFactory.GetNextBlankNodeID()
System.IDisposable.Dispose()
System.Xml.Serialization.IXmlSerializable.GetSchema()
System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader)
System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter)
Namespace: VDS.RDF
Assembly: dotNetRDF.dll
Syntax
public interface IGraph : INodeFactory, IDisposable, IXmlSerializable
Remarks

Most implementations will probably want to inherit from the abstract class BaseGraph since it contains reference implementations of various algorithms (Graph Equality/Graph Difference/Sub-Graph testing etc) which will save considerable work in implementation and ensure consistent behaviour of some methods across implementations.

Properties

| Improve this Doc View Source

AllNodes

Gets the unique Subject, Predicate and Object nodes of the Graph.
Declaration
IEnumerable<INode> AllNodes { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<INode>
| Improve this Doc View Source

BaseUri

Gets/Sets the Base Uri for the Graph.
Declaration
Uri BaseUri { get; set; }
Property Value
Type Description
System.Uri
| Improve this Doc View Source

IsEmpty

Gets whether a Graph is Empty.
Declaration
bool IsEmpty { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

NamespaceMap

Gets the Namespace Map for the Graph.
Declaration
INamespaceMapper NamespaceMap { get; }
Property Value
Type Description
INamespaceMapper
| Improve this Doc View Source

Nodes

Gets the unique Subject and Object nodes of the Graph.
Declaration
IEnumerable<INode> Nodes { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<INode>
Remarks
This property returns only nodes that appear in the Subject or Object position in triples. To retrieve a list of all INode instances in a graph including those in Predicate position in a triple, use the AllNodes property.
| Improve this Doc View Source

Triples

Gets the Triple Collection for the Graph.
Declaration
BaseTripleCollection Triples { get; }
Property Value
Type Description
BaseTripleCollection

Methods

| Improve this Doc View Source

Assert(IEnumerable<Triple>)

Asserts an Enumerable of Triples in the Graph.
Declaration
bool Assert(IEnumerable<Triple> ts)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<Triple> ts An Enumerable of Triples.
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Assert(Triple)

Asserts a Triple in the Graph.
Declaration
bool Assert(Triple t)
Parameters
Type Name Description
Triple t A Triple.
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Clear()

Retracts all Triples from the Graph.
Declaration
void Clear()
Remarks

The Graph should raise the ClearRequested event at the start of the Clear operation and abort the operation if the operation is cancelled by an event handler. On completing the Clear the Cleared event should be raised.

| Improve this Doc View Source

ContainsTriple(Triple)

Gets whether a given Triple is in this Graph.
Declaration
bool ContainsTriple(Triple t)
Parameters
Type Name Description
Triple t Triple to test.
Returns
Type Description
System.Boolean
| Improve this Doc View Source

CreateUriNode()

Creates a URI Node that corresponds to the Base URI of the Graph.
Declaration
IUriNode CreateUriNode()
Returns
Type Description
IUriNode
| Improve this Doc View Source

CreateUriNode(String)

Creates a URI Node for the given QName using the Graphs NamespaceMap to resolve the QName.
Declaration
IUriNode CreateUriNode(string qname)
Parameters
Type Name Description
System.String qname QName.
Returns
Type Description
IUriNode
| Improve this Doc View Source

Difference(IGraph)

Calculates the difference between this Graph and the given Graph.
Declaration
GraphDiffReport Difference(IGraph g)
Parameters
Type Name Description
IGraph g Graph.
Returns
Type Description
GraphDiffReport
Remarks

Produces a report which shows the changes that must be made to this Graph to produce the given Graph.

| Improve this Doc View Source

Equals(IGraph, out Dictionary<INode, INode>)

Checks whether a Graph is equal to another Graph and if so returns the mapping of Blank Nodes.
Declaration
bool Equals(IGraph g, out Dictionary<INode, INode> mapping)
Parameters
Type Name Description
IGraph g Graph to compare with.
System.Collections.Generic.Dictionary<INode, INode> mapping Mapping of Blank Nodes.
Returns
Type Description
System.Boolean
| Improve this Doc View Source

GetBlankNode(String)

Selects the Blank Node with the given ID if it exists in the Graph, returns null otherwise.
Declaration
IBlankNode GetBlankNode(string nodeId)
Parameters
Type Name Description
System.String nodeId Node ID.
Returns
Type Description
IBlankNode The Node if it exists in the Graph or null.
| Improve this Doc View Source

GetLiteralNode(String)

Selects the Literal Node with the given Value if it exists in the Graph, returns null otherwise.
Declaration
ILiteralNode GetLiteralNode(string literal)
Parameters
Type Name Description
System.String literal Value of the Literal.
Returns
Type Description
ILiteralNode The Node if it exists in the Graph or null.
| Improve this Doc View Source

GetLiteralNode(String, String)

Selects the Literal Node with the given Value and Language if it exists in the Graph, returns null otherwise.
Declaration
ILiteralNode GetLiteralNode(string literal, string langspec)
Parameters
Type Name Description
System.String literal Value of the Literal.
System.String langspec Language Specifier of the Literal.
Returns
Type Description
ILiteralNode The Node if it exists in the Graph or null.
| Improve this Doc View Source

GetLiteralNode(String, Uri)

Selects the Literal Node with the given Value and DataType if it exists in the Graph, returns otherwise.
Declaration
ILiteralNode GetLiteralNode(string literal, Uri datatype)
Parameters
Type Name Description
System.String literal Value of the Literal.
System.Uri datatype Data Type of the Literal.
Returns
Type Description
ILiteralNode The Node if it exists in the Graph or null.
| Improve this Doc View Source

GetTriples(Uri)

Selects all Triples which have a Uri Node with the given Uri.
Declaration
IEnumerable<Triple> GetTriples(Uri uri)
Parameters
Type Name Description
System.Uri uri Uri.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriples(INode)

Selects all Triples which contain the given Node.
Declaration
IEnumerable<Triple> GetTriples(INode n)
Parameters
Type Name Description
INode n Node.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriplesWithObject(Uri)

Selects all Triples where the Object is a Uri Node with the given Uri.
Declaration
IEnumerable<Triple> GetTriplesWithObject(Uri u)
Parameters
Type Name Description
System.Uri u Uri.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriplesWithObject(INode)

Selects all Triples where the Object is a given Node.
Declaration
IEnumerable<Triple> GetTriplesWithObject(INode n)
Parameters
Type Name Description
INode n Node.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriplesWithPredicate(Uri)

Selects all Triples where the Predicate is a Uri Node with the given Uri.
Declaration
IEnumerable<Triple> GetTriplesWithPredicate(Uri u)
Parameters
Type Name Description
System.Uri u Uri.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriplesWithPredicate(INode)

Selects all Triples where the Predicate is a given Node.
Declaration
IEnumerable<Triple> GetTriplesWithPredicate(INode n)
Parameters
Type Name Description
INode n Node.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriplesWithPredicateObject(INode, INode)

Selects all Triples with the given Predicate and Object.
Declaration
IEnumerable<Triple> GetTriplesWithPredicateObject(INode pred, INode obj)
Parameters
Type Name Description
INode pred Predicate.
INode obj Object.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriplesWithSubject(Uri)

Selects all Triples where the Subject is a Uri Node with the given Uri.
Declaration
IEnumerable<Triple> GetTriplesWithSubject(Uri u)
Parameters
Type Name Description
System.Uri u Uri.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriplesWithSubject(INode)

Selects all Triples where the Subject is a given Node.
Declaration
IEnumerable<Triple> GetTriplesWithSubject(INode n)
Parameters
Type Name Description
INode n Node.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriplesWithSubjectObject(INode, INode)

Selects all Triples with the given Subject and Object.
Declaration
IEnumerable<Triple> GetTriplesWithSubjectObject(INode subj, INode obj)
Parameters
Type Name Description
INode subj Subject.
INode obj Object.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriplesWithSubjectPredicate(INode, INode)

Selects all Triples with the given Subject and Predicate.
Declaration
IEnumerable<Triple> GetTriplesWithSubjectPredicate(INode subj, INode pred)
Parameters
Type Name Description
INode subj Subject.
INode pred Predicate.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetUriNode(String)

Selects the Uri Node with the given QName if it exists in the Graph, returns null otherwise.
Declaration
IUriNode GetUriNode(string qname)
Parameters
Type Name Description
System.String qname QName.
Returns
Type Description
IUriNode The Node if it exists in the Graph or null.
| Improve this Doc View Source

GetUriNode(Uri)

Selects the Uri Node with the given Uri if it exists in the Graph, returns null otherwise.
Declaration
IUriNode GetUriNode(Uri uri)
Parameters
Type Name Description
System.Uri uri Uri.
Returns
Type Description
IUriNode The Node if it exists in the Graph or null.
| Improve this Doc View Source

HasSubGraph(IGraph)

Checks whether this Graph has the given Graph as a sub-graph.
Declaration
bool HasSubGraph(IGraph g)
Parameters
Type Name Description
IGraph g Graph.
Returns
Type Description
System.Boolean
| Improve this Doc View Source

HasSubGraph(IGraph, out Dictionary<INode, INode>)

Checks whether this Graph has the given Graph as a sub-graph.
Declaration
bool HasSubGraph(IGraph g, out Dictionary<INode, INode> mapping)
Parameters
Type Name Description
IGraph g Graph.
System.Collections.Generic.Dictionary<INode, INode> mapping Mapping of Blank Nodes.
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsSubGraphOf(IGraph)

Checks whether this Graph is a sub-graph of the given Graph.
Declaration
bool IsSubGraphOf(IGraph g)
Parameters
Type Name Description
IGraph g Graph.
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsSubGraphOf(IGraph, out Dictionary<INode, INode>)

Checks whether this Graph is a sub-graph of the given Graph.
Declaration
bool IsSubGraphOf(IGraph g, out Dictionary<INode, INode> mapping)
Parameters
Type Name Description
IGraph g Graph.
System.Collections.Generic.Dictionary<INode, INode> mapping Mapping of Blank Nodes.
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Merge(IGraph)

Merges the given Graph into this Graph.
Declaration
void Merge(IGraph g)
Parameters
Type Name Description
IGraph g Graph to merge.
Remarks

The Graph should raise the MergeRequested event at the start of the Merge operation and abort the operation if the operation is cancelled by an event handler. On completing the Merge the Merged event should be raised.

| Improve this Doc View Source

Merge(IGraph, Boolean)

Merges the given Graph into this Graph.
Declaration
void Merge(IGraph g, bool keepOriginalGraphUri)
Parameters
Type Name Description
IGraph g Graph to merge.
System.Boolean keepOriginalGraphUri Indicates that the Merge should preserve the Graph URIs of Nodes.
Remarks

The Graph should raise the MergeRequested event at the start of the Merge operation and abort the operation if the operation is cancelled by an event handler. On completing the Merge the Merged event should be raised.

| Improve this Doc View Source

ResolveQName(String)

Resolves a QName into a URI using the Namespace Map and Base URI of this Graph.
Declaration
Uri ResolveQName(string qname)
Parameters
Type Name Description
System.String qname QName.
Returns
Type Description
System.Uri
| Improve this Doc View Source

Retract(IEnumerable<Triple>)

Retracts an Enumerable of Triples from the Graph.
Declaration
bool Retract(IEnumerable<Triple> ts)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<Triple> ts Enumerable of Triples.
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Retract(Triple)

Retracts a Triple from the Graph.
Declaration
bool Retract(Triple t)
Parameters
Type Name Description
Triple t A Triple.
Returns
Type Description
System.Boolean

Events

| Improve this Doc View Source

Changed

Event which is raised when the Graph contents change
Declaration
event GraphEventHandler Changed
Event Type
Type Description
GraphEventHandler
| Improve this Doc View Source

Cleared

Event which is raised after the Graph is cleared of its contents
Declaration
event GraphEventHandler Cleared
Event Type
Type Description
GraphEventHandler
| Improve this Doc View Source

ClearRequested

Event which is raised just before the Graph is cleared of its contents
Declaration
event CancellableGraphEventHandler ClearRequested
Event Type
Type Description
CancellableGraphEventHandler
| Improve this Doc View Source

Merged

Event which is raised when a Merge operation is completed on the Graph
Declaration
event GraphEventHandler Merged
Event Type
Type Description
GraphEventHandler
| Improve this Doc View Source

MergeRequested

Event which is raised just before a Merge operation begins on the Graph
Declaration
event CancellableGraphEventHandler MergeRequested
Event Type
Type Description
CancellableGraphEventHandler
| Improve this Doc View Source

TripleAsserted

Event which is raised when a Triple is asserted in the Graph
Declaration
event TripleEventHandler TripleAsserted
Event Type
Type Description
TripleEventHandler
Remarks
Whenever this event is raised the Changed event should also be raised
| Improve this Doc View Source

TripleRetracted

Event which is raised when a Triple is retracted from the Graph
Declaration
event TripleEventHandler TripleRetracted
Event Type
Type Description
TripleEventHandler
Remarks
Whenever this event is raised the Changed event should also be raised

Extension Methods

HandlerHelper.GetETag(IGraph)
GraphExtensions.ToDataTable(IGraph)
Extensions.AsEnumerable<T>(T)
Extensions.Assert(IGraph, INode, INode, INode)
Extensions.Retract(IGraph, INode, INode, INode)
Extensions.AssertList<T>(IGraph, IEnumerable<T>, Func<T, INode>)
Extensions.AssertList<T>(IGraph, INode, IEnumerable<T>, Func<T, INode>)
Extensions.AssertList(IGraph, IEnumerable<INode>)
Extensions.AssertList(IGraph, INode, IEnumerable<INode>)
Extensions.GetListAsTriples(IGraph, INode)
Extensions.GetListItems(IGraph, INode)
Extensions.GetListNodes(IGraph, INode)
Extensions.RetractList(IGraph, INode)
Extensions.AddToList<T>(IGraph, INode, IEnumerable<T>, Func<T, INode>)
Extensions.AddToList(IGraph, INode, IEnumerable<INode>)
Extensions.RemoveFromList<T>(IGraph, INode, IEnumerable<T>, Func<T, INode>)
Extensions.RemoveFromList(IGraph, INode, IEnumerable<INode>)
GraphExtensions.ExecuteQuery(IGraph, String)
GraphExtensions.ExecuteQuery(IGraph, IRdfHandler, ISparqlResultsHandler, String)
GraphExtensions.ExecuteQuery(IGraph, SparqlParameterizedString)
GraphExtensions.ExecuteQuery(IGraph, IRdfHandler, ISparqlResultsHandler, SparqlParameterizedString)
GraphExtensions.ExecuteQuery(IGraph, SparqlQuery)
GraphExtensions.ExecuteQuery(IGraph, IRdfHandler, ISparqlResultsHandler, SparqlQuery)
GraphExtensions.LoadFromFile(IGraph, String, IRdfReader)
GraphExtensions.LoadFromFile(IGraph, String)
GraphExtensions.LoadFromUri(IGraph, Uri, IRdfReader)
GraphExtensions.LoadFromUri(IGraph, Uri)
GraphExtensions.LoadFromString(IGraph, String, IRdfReader)
GraphExtensions.LoadFromString(IGraph, String)
GraphExtensions.LoadFromEmbeddedResource(IGraph, String)
GraphExtensions.LoadFromEmbeddedResource(IGraph, String, IRdfReader)
GraphExtensions.SaveToFile(IGraph, String, IRdfWriter)
GraphExtensions.SaveToFile(IGraph, String, IStoreWriter)
GraphExtensions.SaveToFile(IGraph, String)
GraphExtensions.SaveToStream(IGraph, TextWriter, IRdfWriter)
GraphExtensions.SaveToStream(IGraph, TextWriter, IStoreWriter)
GraphExtensions.SaveToStream(IGraph, String, TextWriter)
DynamicExtensions.AsDynamic(IGraph, Uri, Uri)
  • Improve this Doc
  • View Source
In This Article
  • Properties
    • AllNodes
    • BaseUri
    • IsEmpty
    • NamespaceMap
    • Nodes
    • Triples
  • Methods
    • Assert(IEnumerable<Triple>)
    • Assert(Triple)
    • Clear()
    • ContainsTriple(Triple)
    • CreateUriNode()
    • CreateUriNode(String)
    • Difference(IGraph)
    • Equals(IGraph, out Dictionary<INode, INode>)
    • GetBlankNode(String)
    • GetLiteralNode(String)
    • GetLiteralNode(String, String)
    • GetLiteralNode(String, Uri)
    • GetTriples(Uri)
    • GetTriples(INode)
    • GetTriplesWithObject(Uri)
    • GetTriplesWithObject(INode)
    • GetTriplesWithPredicate(Uri)
    • GetTriplesWithPredicate(INode)
    • GetTriplesWithPredicateObject(INode, INode)
    • GetTriplesWithSubject(Uri)
    • GetTriplesWithSubject(INode)
    • GetTriplesWithSubjectObject(INode, INode)
    • GetTriplesWithSubjectPredicate(INode, INode)
    • GetUriNode(String)
    • GetUriNode(Uri)
    • HasSubGraph(IGraph)
    • HasSubGraph(IGraph, out Dictionary<INode, INode>)
    • IsSubGraphOf(IGraph)
    • IsSubGraphOf(IGraph, out Dictionary<INode, INode>)
    • Merge(IGraph)
    • Merge(IGraph, Boolean)
    • ResolveQName(String)
    • Retract(IEnumerable<Triple>)
    • Retract(Triple)
  • Events
    • Changed
    • Cleared
    • ClearRequested
    • Merged
    • MergeRequested
    • TripleAsserted
    • TripleRetracted
  • Extension Methods
Back to top Generated by DocFX