Class BaseGraph
Abstract Base Implementation of the IGraph interface.
Inherited Members
Namespace: VDS.RDF
Assembly: dotNetRdf.dll
Syntax
public abstract class BaseGraph : IGraph, INodeFactory, IDisposable, ITripleIndex, IEquatable<IGraph>
Constructors
| Edit this page View SourceBaseGraph(BaseTripleCollection, IRefNode, INodeFactory, IUriFactory)
Creates a new Base Graph using the given Triple Collection.
Declaration
protected BaseGraph(BaseTripleCollection tripleCollection, IRefNode graphName = null, INodeFactory nodeFactory = null, IUriFactory uriFactory = null)
Parameters
| Type | Name | Description |
|---|---|---|
| BaseTripleCollection | tripleCollection | Triple Collection to use. If null, a new TreeIndexedTripleCollection will be used. |
| IRefNode | graphName | The name to assign to the graph. |
| INodeFactory | nodeFactory | The factory to use when creating nodes in this graph. |
| IUriFactory | uriFactory | The factory to use when creating URIs in this graph. If not specified or null, defaults to the UriFactory property of |
BaseGraph(IRefNode)
Creates a new Base Graph which uses the default TreeIndexedTripleCollection as the Triple Collection.
Declaration
protected BaseGraph(IRefNode graphName = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IRefNode | graphName | The name to assign to the new graph. |
Fields
| Edit this page View SourceNodeFactory
The factory to use when creating nodes in this graph.
Declaration
protected readonly INodeFactory NodeFactory
Field Value
| Type | Description |
|---|---|
| INodeFactory |
_bnodemapper
Blank Node ID Mapper.
Declaration
protected BlankNodeMapper _bnodemapper
Field Value
| Type | Description |
|---|---|
| BlankNodeMapper |
_name
The name of the graph.
Declaration
protected readonly IRefNode _name
Field Value
| Type | Description |
|---|---|
| IRefNode |
_triples
Collection of Triples in the Graph.
Declaration
protected BaseTripleCollection _triples
Field Value
| Type | Description |
|---|---|
| BaseTripleCollection |
Properties
| Edit this page View SourceAllNodes
Gets the unique Subject, Predicate and Object nodes of the asserted triples in the Graph.
Declaration
public virtual IEnumerable<INode> AllNodes { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<INode> |
AllQuotedNodes
Gets the unique subject, predicate and object nodes of the quoted triples in the graph.
Declaration
public virtual IEnumerable<INode> AllQuotedNodes { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<INode> |
BaseUri
Gets the current Base Uri for the Graph.
Declaration
public Uri BaseUri { get; set; }
Property Value
| Type | Description |
|---|---|
| Uri |
Remarks
This value may be changed during Graph population depending on whether the Concrete syntax allows the Base Uri to be changed and how the Parser handles this.
IsEmpty
Gets whether a Graph is Empty ie. Contains No Triples or Nodes.
Declaration
public virtual bool IsEmpty { get; }
Property Value
| Type | Description |
|---|---|
| bool |
LanguageTagValidation
Get or set the type of validation to apply to language tags when creating language-tagged literal nodes.
Declaration
public LanguageTagValidationMode LanguageTagValidation { get; set; }
Property Value
| Type | Description |
|---|---|
| LanguageTagValidationMode |
Name
Get or set the name of the graph.
Declaration
public virtual IRefNode Name { get; }
Property Value
| Type | Description |
|---|---|
| IRefNode |
NamespaceMap
Gets the Namespace Mapper for this Graph which contains all in use Namespace Prefixes and their URIs.
Declaration
public INamespaceMapper NamespaceMap { get; }
Property Value
| Type | Description |
|---|---|
| INamespaceMapper |
Nodes
Gets the unique Subject and Object nodes of the Graph.
Declaration
public virtual IEnumerable<INode> Nodes { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<INode> |
Remarks
This property returns only nodes that appear in the Subject or Object position in asserted triples. To retrieve a list of all INode instances in a graph including those in Predicate position in a triple, use the AllNodes property.
NormalizeLiteralValues
Get or set whether to normalize the value strings of literal nodes on creation.
Declaration
public virtual bool NormalizeLiteralValues { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
QuotedNodes
Gets the unique subject and object nodes of the quoted triples in the graph.
Declaration
public virtual IEnumerable<INode> QuotedNodes { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<INode> |
QuotedTriples
Gets the quoted triples in the graph.
Declaration
public virtual IEnumerable<Triple> QuotedTriples { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<Triple> |
Triples
Gets the set of Triples described in this Graph.
Declaration
public virtual BaseTripleCollection Triples { get; }
Property Value
| Type | Description |
|---|---|
| BaseTripleCollection |
UriFactory
The factory to use when creating URIs in this graph.
Declaration
public IUriFactory UriFactory { get; set; }
Property Value
| Type | Description |
|---|---|
| IUriFactory |
Remarks
This property delegates to the UriFactory property of NodeFactory.
Methods
| Edit this page View SourceAssert(IEnumerable<Triple>)
Asserts a List of Triples in the graph.
Declaration
public abstract 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 |
Assert(Triple)
Asserts a Triple in the Graph.
Declaration
public abstract bool Assert(Triple t)
Parameters
| Type | Name | Description |
|---|---|---|
| Triple | t | The Triple to add to the Graph. |
Returns
| Type | Description |
|---|---|
| bool |
AttachEventHandlers(BaseTripleCollection)
Helper method for attaching the necessary event Handlers to a Triple Collection.
Declaration
protected void AttachEventHandlers(BaseTripleCollection tripleCollection)
Parameters
| Type | Name | Description |
|---|---|---|
| BaseTripleCollection | tripleCollection | Triple Collection. |
Remarks
May be useful if you replace the Triple Collection after instantiation e.g. as done in SparqlView's.
Clear()
Clears all Triples from the Graph.
Declaration
public virtual void Clear()
Remarks
The Graph will raise the ClearRequested event at the start of the Clear operation which allows for aborting the operation if the operation is cancelled by an event handler. On completing the Clear the Cleared event will be raised.
ContainsQuotedTriple(Triple)
Gets whether a given triple is quoted in this graph.
Declaration
public virtual bool ContainsQuotedTriple(Triple t)
Parameters
| Type | Name | Description |
|---|---|---|
| Triple | t | Triple to test. |
Returns
| Type | Description |
|---|---|
| bool | True if the triple is quoted in this graph, false otherwise. |
ContainsTriple(Triple)
Gets whether a given triple is asserted in this Graph.
Declaration
public virtual bool ContainsTriple(Triple t)
Parameters
| Type | Name | Description |
|---|---|---|
| Triple | t | Triple to test. |
Returns
| Type | Description |
|---|---|
| bool | True if the triple is asserted in this graph, false otherwise. |
CreateBlankNode()
Creates a Blank Node with a new automatically generated ID.
Declaration
public virtual IBlankNode CreateBlankNode()
Returns
| Type | Description |
|---|---|
| IBlankNode |
CreateBlankNode(string)
Creates a Blank Node with the given Node ID.
Declaration
public virtual IBlankNode CreateBlankNode(string nodeId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | nodeId | Node ID. |
Returns
| Type | Description |
|---|---|
| IBlankNode |
CreateGraphLiteralNode()
Creates a Graph Literal Node which represents the empty Subgraph.
Declaration
public virtual IGraphLiteralNode CreateGraphLiteralNode()
Returns
| Type | Description |
|---|---|
| IGraphLiteralNode |
CreateGraphLiteralNode(IGraph)
Creates a Graph Literal Node which represents the given Subgraph.
Declaration
public virtual IGraphLiteralNode CreateGraphLiteralNode(IGraph subgraph)
Parameters
| Type | Name | Description |
|---|---|---|
| IGraph | subgraph | Subgraph. |
Returns
| Type | Description |
|---|---|
| IGraphLiteralNode |
CreateLiteralNode(string)
Creates a Literal Node with the given Value.
Declaration
public virtual ILiteralNode CreateLiteralNode(string literal)
Parameters
| Type | Name | Description |
|---|---|---|
| string | literal | Value of the Literal. |
Returns
| Type | Description |
|---|---|
| ILiteralNode |
CreateLiteralNode(string, string)
Creates a Literal Node with the given Value and Language.
Declaration
public virtual ILiteralNode CreateLiteralNode(string literal, string langSpec)
Parameters
| Type | Name | Description |
|---|---|---|
| string | literal | Value of the Literal. |
| string | langSpec | Language Specifier for the Literal. |
Returns
| Type | Description |
|---|---|
| ILiteralNode |
CreateLiteralNode(string, Uri)
Creates a Literal Node with the given Value and Data Type.
Declaration
public virtual ILiteralNode CreateLiteralNode(string literal, Uri datatype)
Parameters
| Type | Name | Description |
|---|---|---|
| string | literal | Value of the Literal. |
| Uri | datatype | Data Type URI of the Literal. |
Returns
| Type | Description |
|---|---|
| ILiteralNode |
CreateTripleNode(Triple)
Creates a node that quotes the given triple.
Declaration
public virtual ITripleNode CreateTripleNode(Triple triple)
Parameters
| Type | Name | Description |
|---|---|---|
| Triple | triple | The triple to be the quoted value of the created node. |
Returns
| Type | Description |
|---|---|
| ITripleNode |
CreateUriNode()
Creates a URI Node that corresponds to the current Base URI of the node factory.
Declaration
public virtual IUriNode CreateUriNode()
Returns
| Type | Description |
|---|---|
| IUriNode |
CreateUriNode(string)
Creates a URI Node for the given QName using the Graphs NamespaceMap to resolve the QName.
Declaration
public virtual IUriNode CreateUriNode(string qName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | qName | QName. |
Returns
| Type | Description |
|---|---|
| IUriNode |
CreateUriNode(Uri)
Creates a URI Node for the given URI.
Declaration
public virtual IUriNode CreateUriNode(Uri uri)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | uri | URI. |
Returns
| Type | Description |
|---|---|
| IUriNode |
CreateVariableNode(string)
Creates a Variable Node for the given Variable Name.
Declaration
public virtual IVariableNode CreateVariableNode(string varName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | varName |
Returns
| Type | Description |
|---|---|
| IVariableNode |
DetachEventHandlers(BaseTripleCollection)
Helper method for detaching the necessary event Handlers from a Triple Collection.
Declaration
protected void DetachEventHandlers(BaseTripleCollection tripleCollection)
Parameters
| Type | Name | Description |
|---|---|---|
| BaseTripleCollection | tripleCollection | Triple Collection. |
Remarks
May be useful if you replace the Triple Collection after instantiation e.g. as done in SparqlView's.
Difference(IGraph)
Computes the Difference between this Graph the given Graph.
Declaration
public 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.
Dispose()
Disposes of a Graph.
Declaration
public void Dispose()
Dispose(bool)
Disposes of the graph and any resources it owns.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing |
Equals(IGraph)
Determines whether a Graph is equal to another Object.
Declaration
public bool Equals(IGraph other)
Parameters
| Type | Name | Description |
|---|---|---|
| IGraph | other | Other graph to compare to. |
Returns
| Type | Description |
|---|---|
| bool |
Remarks
Graph Equality is determined by a somewhat complex algorithm which is explained in the remarks of the other overload for Equals.
Equals(IGraph, out Dictionary<INode, INode>)
Determines whether this Graph is equal to the given Graph.
Declaration
public virtual bool Equals(IGraph g, out Dictionary<INode, INode> mapping)
Parameters
| Type | Name | Description |
|---|---|---|
| IGraph | g | Graph to test for equality. |
| Dictionary<INode, INode> | mapping | Mapping of Blank Nodes iff the Graphs are equal and contain some Blank Nodes. |
Returns
| Type | Description |
|---|---|
| bool |
Remarks
See GraphMatcher for documentation of the equality algorithm used.
GetBlankNode(string)
Returns the Blank Node with the given Identifier.
Declaration
public abstract 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. |
GetLiteralNode(string)
Returns the LiteralNode with the given Value if it exists.
Declaration
public abstract 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. |
Remarks
The LiteralNode in the Graph must have no Language or DataType set.
GetLiteralNode(string, string)
Returns the LiteralNode with the given Value in the given Language if it exists.
Declaration
public abstract 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. |
GetLiteralNode(string, Uri)
Returns the LiteralNode with the given Value and given Data Type if it exists.
Declaration
public abstract 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. |
GetNextBlankNodeID()
Creates a new unused Blank Node ID and returns it.
Declaration
public virtual string GetNextBlankNodeID()
Returns
| Type | Description |
|---|---|
| string |
GetQuoted(Uri)
Selects all quoted triples which have a Uri Node with the given Uri.
Declaration
public virtual IEnumerable<Triple> GetQuoted(Uri uri)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | uri | Uri. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Triple> |
GetQuoted(INode)
Selects all quoted triples which contain the given Node.
Declaration
public abstract IEnumerable<Triple> GetQuoted(INode n)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | n | Node. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Triple> |
GetQuotedWithObject(Uri)
Selects all quoted triples where the Object is a Uri Node with the given Uri.
Declaration
public virtual IEnumerable<Triple> GetQuotedWithObject(Uri u)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | u | Uri. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Triple> |
GetQuotedWithObject(INode)
Selects all quoted triples where the Object is a given Node.
Declaration
public abstract IEnumerable<Triple> GetQuotedWithObject(INode n)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | n | Node. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Triple> |
GetQuotedWithPredicate(Uri)
Selects all quoted triples where the Predicate is a Uri Node with the given Uri.
Declaration
public virtual IEnumerable<Triple> GetQuotedWithPredicate(Uri u)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | u | Uri. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Triple> |
GetQuotedWithPredicate(INode)
Selects all quoted triples where the Predicate is a given Node.
Declaration
public abstract IEnumerable<Triple> GetQuotedWithPredicate(INode n)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | n | Node. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Triple> |
GetQuotedWithPredicateObject(INode, INode)
Selects all quoted triples with the given Predicate and Object.
Declaration
public abstract IEnumerable<Triple> GetQuotedWithPredicateObject(INode pred, INode obj)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | pred | Predicate. |
| INode | obj | Object. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Triple> |
GetQuotedWithSubject(Uri)
Selects all quoted triples where the Subject is a Uri Node with the given Uri.
Declaration
public virtual IEnumerable<Triple> GetQuotedWithSubject(Uri u)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | u | Uri. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Triple> |
GetQuotedWithSubject(INode)
Selects all quoted triples where the Subject is a given Node.
Declaration
public abstract IEnumerable<Triple> GetQuotedWithSubject(INode n)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | n | Node. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Triple> |
GetQuotedWithSubjectObject(INode, INode)
Selects all quoted triples with the given Subject and Object.
Declaration
public abstract IEnumerable<Triple> GetQuotedWithSubjectObject(INode subj, INode obj)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | subj | Subject. |
| INode | obj | Object. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Triple> |
GetQuotedWithSubjectPredicate(INode, INode)
Selects all quoted triples with the given Subject and Predicate.
Declaration
public abstract IEnumerable<Triple> GetQuotedWithSubjectPredicate(INode subj, INode pred)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | subj | Subject. |
| INode | pred | Predicate. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Triple> |
GetTripleNode(Triple)
Selects the Triple Node with the given Triple value if it exists in the graph.
Declaration
public abstract ITripleNode GetTripleNode(Triple triple)
Parameters
| Type | Name | Description |
|---|---|---|
| Triple | triple | Triple. |
Returns
| Type | Description |
|---|---|
| ITripleNode | The triple node if it exists in the graph or else null. |
GetTriples(Uri)
Gets all the Triples involving the given Uri.
Declaration
public abstract 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. |
GetTriples(INode)
Gets all the Triples involving the given Node.
Declaration
public abstract 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. |
GetTriplesWithObject(Uri)
Gets all the Triples with the given Uri as the Object.
Declaration
public abstract 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. |
GetTriplesWithObject(INode)
Gets all the Triples with the given Node as the Object.
Declaration
public abstract 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> |
GetTriplesWithPredicate(Uri)
Gets all the Triples with the given Uri as the Predicate.
Declaration
public abstract 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. |
GetTriplesWithPredicate(INode)
Gets all the Triples with the given Node as the Predicate.
Declaration
public abstract 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> |
GetTriplesWithPredicateObject(INode, INode)
Selects all Triples with the given Predicate and Object.
Declaration
public abstract IEnumerable<Triple> GetTriplesWithPredicateObject(INode pred, INode obj)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | pred | Predicate. |
| INode | obj | Object. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Triple> |
GetTriplesWithSubject(Uri)
Gets all the Triples with the given Uri as the Subject.
Declaration
public abstract 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. |
GetTriplesWithSubject(INode)
Gets all the Triples with the given Node as the Subject.
Declaration
public abstract 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. |
GetTriplesWithSubjectObject(INode, INode)
Selects all Triples with the given Subject and Object.
Declaration
public abstract IEnumerable<Triple> GetTriplesWithSubjectObject(INode subj, INode obj)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | subj | Subject. |
| INode | obj | Object. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Triple> |
GetTriplesWithSubjectPredicate(INode, INode)
Selects all Triples with the given Subject and Predicate.
Declaration
public abstract IEnumerable<Triple> GetTriplesWithSubjectPredicate(INode subj, INode pred)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | subj | Subject. |
| INode | pred | Predicate. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Triple> |
GetUriNode(string)
Returns the UriNode with the given QName if it exists.
Declaration
public abstract IUriNode GetUriNode(string qname)
Parameters
| Type | Name | Description |
|---|---|---|
| string | qname | The QName of the Node to select. |
Returns
| Type | Description |
|---|---|
| IUriNode |
GetUriNode(Uri)
Returns the UriNode with the given Uri if it exists.
Declaration
public abstract 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. |
HasSubGraph(IGraph)
Checks whether this Graph has the given Graph as a sub-graph.
Declaration
public bool HasSubGraph(IGraph g)
Parameters
| Type | Name | Description |
|---|---|---|
| IGraph | g | Graph. |
Returns
| Type | Description |
|---|---|
| bool |
HasSubGraph(IGraph, out Dictionary<INode, INode>)
Checks whether this Graph has the given Graph as a sub-graph.
Declaration
public bool HasSubGraph(IGraph g, out Dictionary<INode, INode> mapping)
Parameters
| Type | Name | Description |
|---|---|---|
| IGraph | g | Graph. |
| Dictionary<INode, INode> | mapping | Mapping of Blank Nodes. |
Returns
| Type | Description |
|---|---|
| bool |
IsSubGraphOf(IGraph)
Checks whether this Graph is a sub-graph of the given Graph.
Declaration
public bool IsSubGraphOf(IGraph g)
Parameters
| Type | Name | Description |
|---|---|---|
| IGraph | g | Graph. |
Returns
| Type | Description |
|---|---|
| bool |
IsSubGraphOf(IGraph, out Dictionary<INode, INode>)
Checks whether this Graph is a sub-graph of the given Graph.
Declaration
public bool IsSubGraphOf(IGraph g, out Dictionary<INode, INode> mapping)
Parameters
| Type | Name | Description |
|---|---|---|
| IGraph | g | Graph. |
| Dictionary<INode, INode> | mapping | Mapping of Blank Nodes. |
Returns
| Type | Description |
|---|---|
| bool |
Merge(IGraph)
Merges another Graph into the current Graph.
Declaration
public virtual void Merge(IGraph g)
Parameters
| Type | Name | Description |
|---|---|---|
| IGraph | g | Graph to Merge into this Graph. |
Remarks
The Graph on which you invoke this method will preserve its Blank Node IDs while the Blank Nodes from the Graph being merged in will be given new IDs as required in the scope of this Graph.
Merge(IGraph, bool)
Merges another Graph into the current Graph.
Declaration
public virtual void Merge(IGraph g, bool keepOriginalGraphUri)
Parameters
| Type | Name | Description |
|---|---|---|
| IGraph | g | Graph to Merge into this Graph. |
| bool | keepOriginalGraphUri | Indicates that the Merge should preserve the Graph URIs of Nodes so they refer to the Graph they originated in. |
Remarks
The Graph on which you invoke this method will preserve its Blank Node IDs while the Blank Nodes from the Graph being merged in will be given new IDs as required in the scope of this Graph.
The Graph will raise the MergeRequested event before the Merge operation which gives any event handlers the oppurtunity to cancel this event. When the Merge operation is completed the Merged event is raised.
OnTripleAsserted(object, TripleEventArgs)
Event Handler which handles the Triple Added event from the underlying Triple Collection by raising the Graph's TripleAsserted event.
Declaration
protected virtual void OnTripleAsserted(object sender, TripleEventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| object | sender | Sender. |
| TripleEventArgs | args | Triple Event Arguments. |
OnTripleRetracted(object, TripleEventArgs)
Event Handler which handles the Triple Removed event from the underlying Triple Collection by raising the Graph's Triple Retracted event.
Declaration
protected virtual void OnTripleRetracted(object sender, TripleEventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| object | sender | Sender. |
| TripleEventArgs | args | Triple Event Arguments. |
RaiseClearRequested()
Helper method for raising the Clear Requested event and returning whether any of the Event Handlers cancelled the operation.
Declaration
protected bool RaiseClearRequested()
Returns
| Type | Description |
|---|---|
| bool | True if the operation can continue, false if it should be aborted. |
RaiseCleared()
Helper method for raising the Cleared event.
Declaration
protected void RaiseCleared()
RaiseGraphChanged()
Helper method for raising the Changed event.
Declaration
protected void RaiseGraphChanged()
RaiseGraphChanged(TripleEventArgs)
Helper method for raising the Changed event.
Declaration
protected void RaiseGraphChanged(TripleEventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| TripleEventArgs | args | Triple Event Arguments. |
RaiseMergeRequested()
Helper method for raising the Merge Requested event and returning whether any of the Event Handlers cancelled the operation.
Declaration
protected bool RaiseMergeRequested()
Returns
| Type | Description |
|---|---|
| bool | True if the operation can continue, false if it should be aborted. |
RaiseMerged()
Helper method for raising the Merged event.
Declaration
protected void RaiseMerged()
RaiseTripleAsserted(Triple)
Helper method for raising the Triple Asserted event manually.
Declaration
protected void RaiseTripleAsserted(Triple t)
Parameters
| Type | Name | Description |
|---|---|---|
| Triple | t | Triple. |
RaiseTripleAsserted(TripleEventArgs)
Helper method for raising the Triple Asserted event manually.
Declaration
protected void RaiseTripleAsserted(TripleEventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| TripleEventArgs | args | Triple Event Arguments. |
RaiseTripleRetracted(Triple)
Helper method for raising the Triple Retracted event manually.
Declaration
protected void RaiseTripleRetracted(Triple t)
Parameters
| Type | Name | Description |
|---|---|---|
| Triple | t | Triple. |
RaiseTripleRetracted(TripleEventArgs)
Helper method for raising the Triple Retracted event manually.
Declaration
protected void RaiseTripleRetracted(TripleEventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| TripleEventArgs | args |
ResolveQName(string)
Helper function for Resolving QNames to URIs.
Declaration
public virtual Uri ResolveQName(string qname)
Parameters
| Type | Name | Description |
|---|---|---|
| string | qname | QName to resolve to a Uri. |
Returns
| Type | Description |
|---|---|
| Uri |
Retract(IEnumerable<Triple>)
Retracts a enumeration of Triples from the graph.
Declaration
public abstract bool Retract(IEnumerable<Triple> ts)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<Triple> | ts | Enumeration of Triples to retract. |
Returns
| Type | Description |
|---|---|
| bool |
Retract(Triple)
Retracts a Triple from the Graph.
Declaration
public abstract bool Retract(Triple t)
Parameters
| Type | Name | Description |
|---|---|---|
| Triple | t | Triple to Retract. |
Returns
| Type | Description |
|---|---|
| bool |
Remarks
Current implementation may have some defunct Nodes left in the Graph as only the Triple is retracted.
Unstar()
Converts an graph containing quoted triples into to a graph with no quoted triples by applying the unstar operation described in https://w3c.github.io/rdf-star/cg-spec/2021-12-17.html#mapping.
Declaration
public void Unstar()
Remarks
The unstar operation modifies the graph in-place by calls to Assert(Triple) an Retract(Triple).
Events
| Edit this page View SourceChanged
Event which is raised when the Graph contents change
Declaration
public event GraphEventHandler Changed
Event Type
| Type | Description |
|---|---|
| GraphEventHandler |
ClearRequested
Event which is raised just before the Graph is cleared of its contents
Declaration
public event CancellableGraphEventHandler ClearRequested
Event Type
| Type | Description |
|---|---|
| CancellableGraphEventHandler |
Cleared
Event which is raised after the Graph is cleared of its contents
Declaration
public event GraphEventHandler Cleared
Event Type
| Type | Description |
|---|---|
| GraphEventHandler |
MergeRequested
Event which is raised when a Merge operation is requested on the Graph
Declaration
public event CancellableGraphEventHandler MergeRequested
Event Type
| Type | Description |
|---|---|
| CancellableGraphEventHandler |
Merged
Event which is raised when a Merge operation is completed on the Graph
Declaration
public event GraphEventHandler Merged
Event Type
| Type | Description |
|---|---|
| GraphEventHandler |
TripleAsserted
Event which is raised when a Triple is asserted in the Graph
Declaration
public event TripleEventHandler TripleAsserted
Event Type
| Type | Description |
|---|---|
| TripleEventHandler |
TripleRetracted
Event which is raised when a Triple is retracted from the Graph
Declaration
public event TripleEventHandler TripleRetracted
Event Type
| Type | Description |
|---|---|
| TripleEventHandler |