Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ToDateTimeLiteral.cs
1
using
System;
2
using
System.Numerics;
3
using
Waher.Content
;
4
using
Waher.Content.Semantic.Model.Literals
;
5
using
Waher.Content.Xml
;
6
using
Waher.Script.Abstraction.Elements
;
7
using
Waher.Script.Model
;
8
9
namespace
Waher.Script.Persistence.SPARQL.Functions.TypeConversion
10
{
14
public
class
ToDateTimeLiteral
:
SemanticConversionFunction
15
{
19
public
ToDateTimeLiteral
()
20
: base()
21
{
22
}
23
31
public
ToDateTimeLiteral
(
ScriptNode
Argument
,
int
Start
,
int
Length
,
Expression
Expression
)
32
: base(
Argument
,
Start
,
Length
,
Expression
)
33
{
34
}
35
44
public
override
ScriptNode
CreateFunction
(
ScriptNode
Argument
,
int
Start
,
int
Length
,
Expression
Expression
)
45
{
46
return
new
ToDateTimeLiteral
(
Argument
,
Start
,
Length
,
Expression
);
47
}
48
52
public
override
string
FunctionName
=>
DateTimeLiteral
.
TypeUri
;
53
59
public
override
IElement
Convert
(
object
Value)
60
{
61
if
(Value is DateTime d)
62
return
new
DateTimeLiteral
(d);
63
else
if
(Value is DateTimeOffset DTO)
64
return
new
DateTimeLiteral
(DTO.DateTime);
65
else
if
(Value is
string
s)
66
{
67
if
(
XML
.
TryParse
(s, out d))
68
return
new
DateTimeLiteral
(d);
69
}
70
71
d = System.Convert.ToDateTime(Value);
72
return
new
DateTimeLiteral
(d);
73
}
74
}
75
}
Waher.Content.Semantic.Model.Literals.DateTimeLiteral
Represents a dateTime literal.
Definition:
DateTimeLiteral.cs:12
Waher.Content.Semantic.Model.Literals.DateTimeLiteral.TypeUri
const string TypeUri
http://www.w3.org/2001/XMLSchema#boolean
Definition:
DateTimeLiteral.cs:43
Waher.Content.Xml.XML
Helps with common XML-related tasks.
Definition:
XML.cs:19
Waher.Content.Xml.XML.TryParse
static bool TryParse(string s, out DateTime Value)
Tries to decode a string encoded DateTime.
Definition:
XML.cs:744
Waher.Script.Expression
Class managing a script expression.
Definition:
Expression.cs:39
Waher.Script.Model.FunctionOneVariable.Argument
ScriptNode Argument
Function argument.
Definition:
FunctionOneVariable.cs:33
Waher.Script.Model.ScriptNode
Base class for all nodes in a parsed script tree.
Definition:
ScriptNode.cs:69
Waher.Script.Model.ScriptNode.Length
int Length
Length of expression covered by node.
Definition:
ScriptNode.cs:101
Waher.Script.Model.ScriptNode.Start
int Start
Start position in script expression.
Definition:
ScriptNode.cs:92
Waher.Script.Persistence.SPARQL.Functions.TypeConversion.SemanticConversionFunction
Abstract base class for semantic conversion functions.
Definition:
SemanticConversionFunction.cs:12
Waher.Script.Persistence.SPARQL.Functions.TypeConversion.ToDateTimeLiteral
Converts a value to a DateTime literal.
Definition:
ToDateTimeLiteral.cs:15
Waher.Script.Persistence.SPARQL.Functions.TypeConversion.ToDateTimeLiteral.FunctionName
override string FunctionName
Name of the function
Definition:
ToDateTimeLiteral.cs:52
Waher.Script.Persistence.SPARQL.Functions.TypeConversion.ToDateTimeLiteral.ToDateTimeLiteral
ToDateTimeLiteral()
Converts a value to a DateTime literal.
Definition:
ToDateTimeLiteral.cs:19
Waher.Script.Persistence.SPARQL.Functions.TypeConversion.ToDateTimeLiteral.CreateFunction
override ScriptNode CreateFunction(ScriptNode Argument, int Start, int Length, Expression Expression)
Creates a function node.
Definition:
ToDateTimeLiteral.cs:44
Waher.Script.Persistence.SPARQL.Functions.TypeConversion.ToDateTimeLiteral.ToDateTimeLiteral
ToDateTimeLiteral(ScriptNode Argument, int Start, int Length, Expression Expression)
Converts a value to a DateTime literal.
Definition:
ToDateTimeLiteral.cs:31
Waher.Script.Persistence.SPARQL.Functions.TypeConversion.ToDateTimeLiteral.Convert
override IElement Convert(object Value)
Converts an object to the desired type.
Definition:
ToDateTimeLiteral.cs:59
Waher.Script.Abstraction.Elements.IElement
Basic interface for all types of elements.
Definition:
IElement.cs:20
Waher.Content.Semantic.Model.Literals
Definition:
Base64Literal.cs:6
Waher.Content.Xml
Definition:
XmlCodec.cs:11
Waher.Content
Definition:
Array.cs:6
Waher.Script.Abstraction.Elements
Definition:
AbelianGroupElement.cs:5
Waher.Script.Model
Definition:
BinaryBooleanOperator.cs:8
Waher.Script.Persistence.SPARQL.Functions.TypeConversion
Definition:
SemanticConversionFunction.cs:7
IoTGateway
Script
Waher.Script.Persistence
SPARQL
Functions
TypeConversion
ToDateTimeLiteral.cs
Generated by
1.9.5