Class BaseNode
Abstract Class for Nodes, implements the two basic properties of the INode Interface.
Inheritance
Implements
Inherited Members
Namespace: VDS.RDF
Assembly: dotNetRdf.dll
Syntax
public abstract class BaseNode : INode, IComparable<INode>, IComparable<IBlankNode>, IComparable<IGraphLiteralNode>, IComparable<ILiteralNode>, IComparable<IUriNode>, IComparable<IVariableNode>, IComparable<IRefNode>, IComparable<ITripleNode>, IEquatable<INode>, IEquatable<IBlankNode>, IEquatable<IGraphLiteralNode>, IEquatable<ILiteralNode>, IEquatable<IUriNode>, IEquatable<IVariableNode>, IEquatable<IRefNode>, IEquatable<ITripleNode>
Constructors
| Edit this page View SourceBaseNode(NodeType)
Base Constructor which instantiates the Graph reference, Graph Uri and Node Type of the Node.
Declaration
protected BaseNode(NodeType type)
Parameters
Type | Name | Description |
---|---|---|
NodeType | type | Node Type. |
Fields
| Edit this page View Source_nodeType
Node Type for the Node.
Declaration
protected NodeType _nodeType
Field Value
Type | Description |
---|---|
NodeType |
Properties
| Edit this page View SourceNodeType
Nodes have a Type.
Declaration
public NodeType NodeType { get; }
Property Value
Type | Description |
---|---|
NodeType |
Methods
| Edit this page View SourceCompareTo(IBlankNode)
Nodes must implement a CompareTo method to allow them to be Sorted.
Declaration
public abstract int CompareTo(IBlankNode other)
Parameters
Type | Name | Description |
---|---|---|
IBlankNode | other | Node to compare self to. |
Returns
Type | Description |
---|---|
int |
Remarks
Implementations should use the SPARQL Term Sort Order for ordering nodes (as opposed to value sort order). Standard implementations of Node type specific comparisons can be found in ComparisonHelper.
CompareTo(IGraphLiteralNode)
Nodes must implement a CompareTo method to allow them to be Sorted.
Declaration
public abstract int CompareTo(IGraphLiteralNode other)
Parameters
Type | Name | Description |
---|---|---|
IGraphLiteralNode | other | Node to compare self to. |
Returns
Type | Description |
---|---|
int |
Remarks
Implementations should use the SPARQL Term Sort Order for ordering nodes (as opposed to value sort order). Standard implementations of Node type specific comparisons can be found in ComparisonHelper.
CompareTo(ILiteralNode)
Nodes must implement a CompareTo method to allow them to be Sorted.
Declaration
public abstract int CompareTo(ILiteralNode other)
Parameters
Type | Name | Description |
---|---|---|
ILiteralNode | other | Node to compare self to. |
Returns
Type | Description |
---|---|
int |
Remarks
Implementations should use the SPARQL Term Sort Order for ordering nodes (as opposed to value sort order). Standard implementations of Node type specific comparisons can be found in ComparisonHelper.
CompareTo(INode)
Nodes must implement a CompareTo method to allow them to be Sorted.
Declaration
public abstract int CompareTo(INode other)
Parameters
Type | Name | Description |
---|---|---|
INode | other | Node to compare self to. |
Returns
Type | Description |
---|---|
int |
Remarks
Implementations should use the SPARQL Term Sort Order for ordering nodes (as opposed to value sort order). Standard implementations of Node type specific comparisons can be found in ComparisonHelper.
CompareTo(IRefNode)
Nodes must implement a CompareTo method to allow them to be Sorted.
Declaration
public abstract int CompareTo(IRefNode other)
Parameters
Type | Name | Description |
---|---|---|
IRefNode | other | Node to compare self to. |
Returns
Type | Description |
---|---|
int |
Remarks
Implementations should use the SPARQL Term Sort Order for ordering nodes (as opposed to value sort order). Standard implementations of Node type specific comparisons can be found in ComparisonHelper.
CompareTo(ITripleNode)
Nodes must implement a CompareTo method to allow them to be Sorted.
Declaration
public abstract int CompareTo(ITripleNode other)
Parameters
Type | Name | Description |
---|---|---|
ITripleNode | other | Node to compare self to. |
Returns
Type | Description |
---|---|
int |
Remarks
Implementations should use the SPARQL Term Sort Order for ordering nodes (as opposed to value sort order). Standard implementations of Node type specific comparisons can be found in ComparisonHelper.
CompareTo(IUriNode)
Nodes must implement a CompareTo method to allow them to be Sorted.
Declaration
public abstract int CompareTo(IUriNode other)
Parameters
Type | Name | Description |
---|---|---|
IUriNode | other | Node to compare self to. |
Returns
Type | Description |
---|---|
int |
Remarks
Implementations should use the SPARQL Term Sort Order for ordering nodes (as opposed to value sort order). Standard implementations of Node type specific comparisons can be found in ComparisonHelper.
CompareTo(IVariableNode)
Nodes must implement a CompareTo method to allow them to be Sorted.
Declaration
public abstract int CompareTo(IVariableNode other)
Parameters
Type | Name | Description |
---|---|---|
IVariableNode | other | Node to compare self to. |
Returns
Type | Description |
---|---|
int |
Remarks
Implementations should use the SPARQL Term Sort Order for ordering nodes (as opposed to value sort order). Standard implementations of Node type specific comparisons can be found in ComparisonHelper.
Equals(object)
Nodes must implement an Equals method.
Declaration
public override abstract bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | Object to compare against. |
Returns
Type | Description |
---|---|
bool |
Overrides
| Edit this page View SourceEquals(IBlankNode)
Nodes must implement an Equals method so we can do type specific equality.
Declaration
public abstract bool Equals(IBlankNode other)
Parameters
Type | Name | Description |
---|---|---|
IBlankNode | other | Node to check for equality. |
Returns
Type | Description |
---|---|
bool |
Remarks
Nodes implementations are also required to implement an override of the non-generic Equals method. Standard implementations of some equality comparisons can be found in EqualityHelper.
Equals(IGraphLiteralNode)
Nodes must implement an Equals method so we can do type specific equality.
Declaration
public abstract bool Equals(IGraphLiteralNode other)
Parameters
Type | Name | Description |
---|---|---|
IGraphLiteralNode | other | Node to check for equality. |
Returns
Type | Description |
---|---|
bool |
Remarks
Nodes implementations are also required to implement an override of the non-generic Equals method. Standard implementations of some equality comparisons can be found in EqualityHelper.
Equals(ILiteralNode)
Nodes must implement an Equals method so we can do type specific equality.
Declaration
public abstract bool Equals(ILiteralNode other)
Parameters
Type | Name | Description |
---|---|---|
ILiteralNode | other | Node to check for equality. |
Returns
Type | Description |
---|---|
bool |
Remarks
Nodes implementations are also required to implement an override of the non-generic Equals method. Standard implementations of some equality comparisons can be found in EqualityHelper.
Equals(INode)
Nodes must implement an Equals method so we can do type specific equality.
Declaration
public abstract bool Equals(INode other)
Parameters
Type | Name | Description |
---|---|---|
INode | other | Node to check for equality. |
Returns
Type | Description |
---|---|
bool |
Remarks
Nodes implementations are also required to implement an override of the non-generic Equals method. Standard implementations of some equality comparisons can be found in EqualityHelper.
Equals(IRefNode)
Nodes must implement an Equals method so we can do type specific equality.
Declaration
public abstract bool Equals(IRefNode other)
Parameters
Type | Name | Description |
---|---|---|
IRefNode | other | Node to check for equality. |
Returns
Type | Description |
---|---|
bool |
Remarks
Nodes implementations are also required to implement an override of the non-generic Equals method. Standard implementations of some equality comparisons can be found in EqualityHelper.
Equals(ITripleNode)
Nodes must implement an Equals method so we can do type specific equality.
Declaration
public abstract bool Equals(ITripleNode other)
Parameters
Type | Name | Description |
---|---|---|
ITripleNode | other | Node to check for equality. |
Returns
Type | Description |
---|---|
bool |
Remarks
Nodes implementations are also required to implement an override of the non-generic Equals method. Standard implementations of some equality comparisons can be found in EqualityHelper.
Equals(IUriNode)
Nodes must implement an Equals method so we can do type specific equality.
Declaration
public abstract bool Equals(IUriNode other)
Parameters
Type | Name | Description |
---|---|---|
IUriNode | other | Node to check for equality. |
Returns
Type | Description |
---|---|
bool |
Remarks
Nodes implementations are also required to implement an override of the non-generic Equals method. Standard implementations of some equality comparisons can be found in EqualityHelper.
Equals(IVariableNode)
Nodes must implement an Equals method so we can do type specific equality.
Declaration
public abstract bool Equals(IVariableNode other)
Parameters
Type | Name | Description |
---|---|---|
IVariableNode | other | Node to check for equality. |
Returns
Type | Description |
---|---|
bool |
Remarks
Nodes implementations are also required to implement an override of the non-generic Equals method. Standard implementations of some equality comparisons can be found in EqualityHelper.
GetHashCode()
Serves as the default hash function.
Declaration
public override abstract int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for the current object. |
Overrides
| Edit this page View SourceToString()
Nodes must implement a ToString method.
Declaration
public override abstract string ToString()
Returns
Type | Description |
---|---|
string |
Overrides
Remarks
Essential for the implementation of GetHashCode to work correctly, Nodes should generate a String representation that is 'unique' as far as that is possible.
Any two Nodes which match via the Equals method (based on strict RDF Specification Equality) should produce the same String representation since Hash Codes are generated by calling GetHashCode on this String.
ToString(INodeFormatter)
Gets the String representation of the Node formatted with the given Node formatter.
Declaration
public virtual string ToString(INodeFormatter formatter)
Parameters
Type | Name | Description |
---|---|---|
INodeFormatter | formatter | Formatter. |
Returns
Type | Description |
---|---|
string |
ToString(INodeFormatter, TripleSegment)
Gets the String representation of the Node formatted with the given Node formatter.
Declaration
public virtual string ToString(INodeFormatter formatter, TripleSegment segment)
Parameters
Type | Name | Description |
---|---|---|
INodeFormatter | formatter | Formatter. |
TripleSegment | segment | Triple Segment. |
Returns
Type | Description |
---|---|
string |
Operators
| Edit this page View Sourceoperator ==(BaseNode, BaseNode)
The Equality operator is defined for Nodes.
Declaration
public static bool operator ==(BaseNode a, BaseNode b)
Parameters
Type | Name | Description |
---|---|---|
BaseNode | a | First Node. |
BaseNode | b | Second Node. |
Returns
Type | Description |
---|---|
bool | Whether the two Nodes are equal. |
Remarks
Uses the Equals method to evaluate the result.
operator !=(BaseNode, BaseNode)
The Non-Equality operator is defined for Nodes.
Declaration
public static bool operator !=(BaseNode a, BaseNode b)
Parameters
Type | Name | Description |
---|---|---|
BaseNode | a | First Node. |
BaseNode | b | Second Node. |
Returns
Type | Description |
---|---|
bool | Whether the two Nodes are non-equal. |
Remarks
Uses the Equals method to evaluate the result.