Class BaseLiteralNode
Abstract Base Class for Literal Nodes.
Implements
Inherited Members
Namespace: VDS.RDF
Assembly: dotNetRdf.dll
Syntax
[Serializable]
public abstract class BaseLiteralNode : BaseNode, ILiteralNode, 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>, IEquatable<BaseLiteralNode>, IComparable<BaseLiteralNode>
Constructors
| Improve this Doc View SourceBaseLiteralNode(string, bool)
Internal Only Constructor for Literal Nodes.
Declaration
protected BaseLiteralNode(string literal, bool normalize)
Parameters
Type | Name | Description |
---|---|---|
string | literal | String value of the Literal. |
System.Boolean | normalize | Whether to Normalize the Literal Value. |
BaseLiteralNode(string, string, bool)
Internal Only Constructor for Literal Nodes.
Declaration
protected BaseLiteralNode(string literal, string langspec, bool normalize)
Parameters
Type | Name | Description |
---|---|---|
string | literal | String value of the Literal. |
string | langspec | String value for the Language Specifier for the Literal. |
System.Boolean | normalize | Whether to Normalize the Literal Value. |
BaseLiteralNode(string, Uri, bool)
Internal Only Constructor for Literal Nodes.
Declaration
protected BaseLiteralNode(string literal, Uri datatype, bool normalize)
Parameters
Type | Name | Description |
---|---|---|
string | literal | String value of the Literal. |
System.Uri | datatype | Uri for the Literals Data Type. |
System.Boolean | normalize | Whether to Normalize the Literal Value. |
Properties
| Improve this Doc View SourceDataType
Gives the Data Type Uri for the Literal (if it exists) or a null.
Declaration
public Uri DataType { get; }
Property Value
Type | Description |
---|---|
System.Uri |
Language
Gives the Language Specifier for the Literal (if it exists) or the Empty String.
Declaration
public string Language { get; }
Property Value
Type | Description |
---|---|
string |
Value
Gives the String Value of the Literal.
Declaration
public string Value { get; }
Property Value
Type | Description |
---|---|
string |
Methods
| Improve this Doc View SourceCompareTo(BaseLiteralNode)
Returns an Integer indicating the Ordering of this Node compared to another Node.
Declaration
public int CompareTo(BaseLiteralNode other)
Parameters
Type | Name | Description |
---|---|---|
BaseLiteralNode | other | Node to test against. |
Returns
Type | Description |
---|---|
int |
CompareTo(IBlankNode)
Returns an Integer indicating the Ordering of this Node compared to another Node.
Declaration
public override int CompareTo(IBlankNode other)
Parameters
Type | Name | Description |
---|---|---|
IBlankNode | other | Node to test against. |
Returns
Type | Description |
---|---|
int |
Overrides
| Improve this Doc View SourceCompareTo(IGraphLiteralNode)
Returns an Integer indicating the Ordering of this Node compared to another Node.
Declaration
public override int CompareTo(IGraphLiteralNode other)
Parameters
Type | Name | Description |
---|---|---|
IGraphLiteralNode | other | Node to test against. |
Returns
Type | Description |
---|---|
int |
Overrides
| Improve this Doc View SourceCompareTo(ILiteralNode)
Returns an Integer indicating the Ordering of this Node compared to another Node.
Declaration
public override int CompareTo(ILiteralNode other)
Parameters
Type | Name | Description |
---|---|---|
ILiteralNode | other | Node to test against. |
Returns
Type | Description |
---|---|
int |
Overrides
| Improve this Doc View SourceCompareTo(INode)
Implementation of CompareTo for Literal Nodes.
Declaration
public override int CompareTo(INode other)
Parameters
Type | Name | Description |
---|---|---|
INode | other | Node to Compare To. |
Returns
Type | Description |
---|---|
int |
Overrides
Remarks
Literal Nodes are greater than Blank Nodes, Uri Nodes and Nulls, they are less than Graph Literal Nodes.
Two Literal Nodes are initially compared based upon Data Type, untyped literals are less than typed literals. Two untyped literals are compared purely on lexical value, Language Specifier has no effect on the ordering. This means Literal Nodes are only partially ordered, for example "hello"@en and "hello"@en-us are considered to be the same for ordering purposes though they are different for equality purposes. Data-typed Literals can only be properly ordered if they are one of a small subset of types (Integers, Booleans, Date Times, Strings and URIs). If the datatypes for two Literals are non-matching they are ordered on Datatype Uri, this ensures that each range of Literal Nodes is sorted to some degree. Again this also means that Literals are partially ordered since unknown datatypes will only be sorted based on lexical value and not on actual value.
CompareTo(IRefNode)
Returns an Integer indicating the Ordering of this Node compared to another Node.
Declaration
public override int CompareTo(IRefNode other)
Parameters
Type | Name | Description |
---|---|---|
IRefNode | other | Node to test against. |
Returns
Type | Description |
---|---|
int |
Overrides
| Improve this Doc View SourceCompareTo(ITripleNode)
Returns an Integer indicating the Ordering of this Node compared to another Node.
Declaration
public override int CompareTo(ITripleNode other)
Parameters
Type | Name | Description |
---|---|---|
ITripleNode | other | Node to test against. |
Returns
Type | Description |
---|---|
int |
Overrides
| Improve this Doc View SourceCompareTo(IUriNode)
Returns an Integer indicating the Ordering of this Node compared to another Node.
Declaration
public override int CompareTo(IUriNode other)
Parameters
Type | Name | Description |
---|---|---|
IUriNode | other | Node to test against. |
Returns
Type | Description |
---|---|
int |
Overrides
| Improve this Doc View SourceCompareTo(IVariableNode)
Returns an Integer indicating the Ordering of this Node compared to another Node.
Declaration
public override int CompareTo(IVariableNode other)
Parameters
Type | Name | Description |
---|---|---|
IVariableNode | other | Node to test against. |
Returns
Type | Description |
---|---|
int |
Overrides
| Improve this Doc View SourceEquals(object)
Implementation of the Equals method for Literal Nodes.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | Object to compare the Node with. |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Remarks
The default behaviour is for Literal Nodes to be considered equal IFF
- Their Language Specifiers are identical (or neither has a Language Specifier)
- Their Data Types are identical (or neither has a Data Type)
- Their String values are identical
Equals(BaseLiteralNode)
Determines whether this Node is equal to a Literal Node.
Declaration
public bool Equals(BaseLiteralNode other)
Parameters
Type | Name | Description |
---|---|---|
BaseLiteralNode | other | Literal Node. |
Returns
Type | Description |
---|---|
System.Boolean |
Equals(IBlankNode)
Determines whether this Node is equal to a Blank Node (should always be false).
Declaration
public override bool Equals(IBlankNode other)
Parameters
Type | Name | Description |
---|---|---|
IBlankNode | other | Blank Node. |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
| Improve this Doc View SourceEquals(IGraphLiteralNode)
Determines whether this Node is equal to a Graph Literal Node (should always be false).
Declaration
public override bool Equals(IGraphLiteralNode other)
Parameters
Type | Name | Description |
---|---|---|
IGraphLiteralNode | other | Graph Literal Node. |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
| Improve this Doc View SourceEquals(ILiteralNode)
Determines whether this Node is equal to a Literal Node.
Declaration
public override bool Equals(ILiteralNode other)
Parameters
Type | Name | Description |
---|---|---|
ILiteralNode | other | Literal Node. |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
| Improve this Doc View SourceEquals(INode)
Implementation of the Equals method for Literal Nodes.
Declaration
public override bool Equals(INode other)
Parameters
Type | Name | Description |
---|---|---|
INode | other | Object to compare the Node with. |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Remarks
The default behaviour is for Literal Nodes to be considered equal IFF
- Their Language Specifiers are identical (or neither has a Language Specifier)
- Their Data Types are identical (or neither has a Data Type)
- Their String values are identical
Equals(IRefNode)
Determines whether this Node is equal to a Ref Node (should always be false).
Declaration
public override bool Equals(IRefNode other)
Parameters
Type | Name | Description |
---|---|---|
IRefNode | other | Ref Node. |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
| Improve this Doc View SourceEquals(ITripleNode)
Determines whether this Node is equal to a Triple Node (should always be false).
Declaration
public override bool Equals(ITripleNode other)
Parameters
Type | Name | Description |
---|---|---|
ITripleNode | other | Triple Node. |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
| Improve this Doc View SourceEquals(IUriNode)
Determines whether this Node is equal to a URI Node (should always be false).
Declaration
public override bool Equals(IUriNode other)
Parameters
Type | Name | Description |
---|---|---|
IUriNode | other | URI Node. |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
| Improve this Doc View SourceEquals(IVariableNode)
Determines whether this Node is equal to a Variable Node (should always be false).
Declaration
public override bool Equals(IVariableNode other)
Parameters
Type | Name | Description |
---|---|---|
IVariableNode | other | Variable Node. |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
| Improve this Doc View SourceGetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for the current object. |
Overrides
| Improve this Doc View SourceToString()
Gets a String representation of a Literal Node.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |
Overrides
Remarks
Gives a value without quotes (as some syntaxes use) with the Data Type/Language Specifier appended using Notation 3 syntax.