Click or drag to resize

BaseLiteralNodeCompareTo Method (INode)

Implementation of CompareTo for Literal Nodes.

Namespace:  VDS.RDF
Assembly:  dotNetRDF (in dotNetRDF.dll) Version:
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. Datatyped 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.
See Also