1using System.Collections.Generic;
15 private static readonly Dictionary<Type, ISemanticLiteral> literalPerType =
new Dictionary<Type, ISemanticLiteral>();
16 private static readonly Dictionary<string, ISemanticLiteral> dataTypes =
new Dictionary<string, ISemanticLiteral>();
20 Types.OnInvalidated += (Sender, e) =>
24 literalPerType.Clear();
59 public override int?
Size =>
null;
74 if (!dataTypes.TryGetValue(DataType, out LiteralType))
79 dataTypes[DataType] = LiteralType;
83 return LiteralType.
Parse(Value, DataType, Language);
97 return new UriNode(Uri, Uri.OriginalString);
112 Type T = Value?.GetType() ?? typeof(
object);
115 lock (literalPerType)
117 if (!literalPerType.TryGetValue(T, out Literal))
122 literalPerType[T] = Literal;
149 if (x is IComparable Left)
150 return Left.CompareTo(y);
Represents a custom literal.
Represents an undefined literal.
Set of semantic elements.
override bool Contains(IElement Element)
Checks if the set contains an element.
static ISemanticLiteral EncapsulateLiteral(object Value)
Encapsulates an object as a semantic literal.
override int GetHashCode()
Calculates a hash code of the element. Hash code.
int Compare(IElement x, IElement y)
Compares two elements.
SemanticElements()
Set of semantic elements.
static readonly SemanticElements Instance
Instance reference to the set of semantic elements.
override bool Equals(object obj)
Compares the element to another. If elements are equal.
override? int Size
Size of set, if finite and known, otherwise null is returned.
static ISemanticElement Encapsulate(object Value)
Encapsulates an object as a semantic element.
static ISemanticElement Parse(string Value, string DataType, string Language)
Parses a string literal value.
Static class that dynamically manages types and interfaces available in the runtime environment.
Base class for all types of elements.
Element()
Base class for all types of elements.
Base class for all types of sets.
Interface for semantic nodes.
Interface for semantic literals.
ISemanticLiteral Encapsulate(object Value)
Encapsulates an object value as a semantic literal value.
ISemanticLiteral Parse(string Value, string DataType, string Language)
Tries to parse a string value of the type supported by the class..
Basic interface for all types of elements.
Basic interface for ordered sets.