Show / Hide Table of Contents

Class LiteralExtensions

Provides extension methods for converting primitive types into appropriately typed Literal Nodes.

Inheritance
object
LiteralExtensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: VDS.RDF
Assembly: dotNetRdf.dll
Syntax
public static class LiteralExtensions

Methods

| Edit this page View Source

ToLiteral(bool, INodeFactory)

Creates a new Boolean typed literal.

Declaration
public static ILiteralNode ToLiteral(this bool b, INodeFactory factory)
Parameters
Type Name Description
bool b

Boolean.

INodeFactory factory

Node Factory to use for Node creation.

Returns
Type Description
ILiteralNode

Literal representing the boolean.

Exceptions
Type Condition
ArgumentNullException

Thrown if the Factory argument is null.

| Edit this page View Source

ToLiteral(byte, INodeFactory)

Creates a new Byte typed literal.

Declaration
public static ILiteralNode ToLiteral(this byte b, INodeFactory factory)
Parameters
Type Name Description
byte b

Byte.

INodeFactory factory

Node Factory to use for Node creation.

Returns
Type Description
ILiteralNode

Literal representing the byte.

Remarks

Byte in .Net is actually equivalent to Unsigned Byte in XML Schema so depending on the value of the Byte the type will either be xsd:byte if it fits or xsd:usignedByte.

| Edit this page View Source

ToLiteral(DateTime, INodeFactory)

Creates a new Date Time typed literal.

Declaration
public static ILiteralNode ToLiteral(this DateTime dt, INodeFactory factory)
Parameters
Type Name Description
DateTime dt

Date Time.

INodeFactory factory

Node Factory to use for Node creation.

Returns
Type Description
ILiteralNode

Literal representing the date time.

Exceptions
Type Condition
ArgumentNullException

Thrown if the Factory argument is null.

| Edit this page View Source

ToLiteral(DateTime, INodeFactory, bool)

Creates a new Date Time typed literal.

Declaration
public static ILiteralNode ToLiteral(this DateTime dt, INodeFactory factory, bool precise)
Parameters
Type Name Description
DateTime dt

Date Time.

INodeFactory factory

Node Factory to use for Node creation.

bool precise

Whether to preserve precisely i.e. include fractional seconds.

Returns
Type Description
ILiteralNode

Literal representing the date time.

Exceptions
Type Condition
ArgumentNullException

Thrown if the Factory argument is null.

| Edit this page View Source

ToLiteral(DateTimeOffset, INodeFactory)

Creates a new Date Time typed literal.

Declaration
public static ILiteralNode ToLiteral(this DateTimeOffset dt, INodeFactory factory)
Parameters
Type Name Description
DateTimeOffset dt

Date Time.

INodeFactory factory

Node Factory to use for Node creation.

Returns
Type Description
ILiteralNode

Literal representing the date time.

Exceptions
Type Condition
ArgumentNullException

Thrown if the Factory argument is null.

| Edit this page View Source

ToLiteral(DateTimeOffset, INodeFactory, bool)

Creates a new Date Time typed literal.

Declaration
public static ILiteralNode ToLiteral(this DateTimeOffset dt, INodeFactory factory, bool precise)
Parameters
Type Name Description
DateTimeOffset dt

Date Time.

INodeFactory factory

Node Factory to use for Node creation.

bool precise

Whether to preserve precisely i.e. include fractional seconds.

Returns
Type Description
ILiteralNode

Literal representing the date time.

Exceptions
Type Condition
ArgumentNullException

Thrown if the Factory argument is null.

| Edit this page View Source

ToLiteral(decimal, INodeFactory)

Creates a new Decimal typed literal.

Declaration
public static ILiteralNode ToLiteral(this decimal d, INodeFactory factory)
Parameters
Type Name Description
decimal d

Decimal.

INodeFactory factory

Node Factory to use for Node creation.

Returns
Type Description
ILiteralNode

Literal representing the decimal.

Exceptions
Type Condition
ArgumentNullException

Thrown if the Factory argument is null.

| Edit this page View Source

ToLiteral(double, INodeFactory)

Creates a new Double typed literal.

Declaration
public static ILiteralNode ToLiteral(this double d, INodeFactory factory)
Parameters
Type Name Description
double d

Double.

INodeFactory factory

Node Factory to use for Node creation.

Returns
Type Description
ILiteralNode

Literal representing the double.

Exceptions
Type Condition
ArgumentNullException

Thrown if the Factory argument is null.

| Edit this page View Source

ToLiteral(short, INodeFactory)

Creates a new Integer typed literal.

Declaration
public static ILiteralNode ToLiteral(this short i, INodeFactory factory)
Parameters
Type Name Description
short i

Integer.

INodeFactory factory

Node Factory to use for Node creation.

Returns
Type Description
ILiteralNode

Literal representing the short.

Exceptions
Type Condition
ArgumentNullException

Thrown if the Factory argument is null.

| Edit this page View Source

ToLiteral(int, INodeFactory)

Creates a new Integer typed literal.

Declaration
public static ILiteralNode ToLiteral(this int i, INodeFactory factory)
Parameters
Type Name Description
int i

Integer.

INodeFactory factory

Node Factory to use for Node creation.

Returns
Type Description
ILiteralNode

Literal representing the integer.

Exceptions
Type Condition
ArgumentNullException

Thrown if the Factory argument is null.

| Edit this page View Source

ToLiteral(long, INodeFactory)

Creates a new Integer typed literal.

Declaration
public static ILiteralNode ToLiteral(this long l, INodeFactory factory)
Parameters
Type Name Description
long l

Integer.

INodeFactory factory

Node Factory to use for Node creation.

Returns
Type Description
ILiteralNode

Literal representing the integer.

Exceptions
Type Condition
ArgumentNullException

Thrown if the Factory argument is null.

| Edit this page View Source

ToLiteral(sbyte, INodeFactory)

Creates a new Byte typed literal.

Declaration
public static ILiteralNode ToLiteral(this sbyte b, INodeFactory factory)
Parameters
Type Name Description
sbyte b

Byte.

INodeFactory factory

Node Factory to use for Node creation.

Returns
Type Description
ILiteralNode

Literal representing the signed bytes.

Remarks

SByte in .Net is directly equivalent to Byte in XML Schema so the type will always be xsd:byte.

| Edit this page View Source

ToLiteral(float, INodeFactory)

Creates a new Float typed literal.

Declaration
public static ILiteralNode ToLiteral(this float f, INodeFactory factory)
Parameters
Type Name Description
float f

Float.

INodeFactory factory

Node Factory to use for Node creation.

Returns
Type Description
ILiteralNode

Literal representing the float.

Exceptions
Type Condition
ArgumentNullException

Thrown if the Factory argument is null.

| Edit this page View Source

ToLiteral(string, INodeFactory)

Creates a new String typed literal.

Declaration
public static ILiteralNode ToLiteral(this string s, INodeFactory factory)
Parameters
Type Name Description
string s

String.

INodeFactory factory

Node Factory to use for Node creation.

Returns
Type Description
ILiteralNode

Literal representing the string.

Exceptions
Type Condition
ArgumentNullException

Thrown if the Graph/String argument is null.

| Edit this page View Source

ToLiteral(TimeSpan, INodeFactory)

Creates a new duration typed literal.

Declaration
public static ILiteralNode ToLiteral(this TimeSpan t, INodeFactory factory)
Parameters
Type Name Description
TimeSpan t

Time Span.

INodeFactory factory

Node Factory to use for Node creation.

Returns
Type Description
ILiteralNode

Literal representing the time span.

| Edit this page View Source

ToLiteralDate(DateTime, INodeFactory)

Creates a new Date typed literal.

Declaration
public static ILiteralNode ToLiteralDate(this DateTime dt, INodeFactory factory)
Parameters
Type Name Description
DateTime dt

Date Time.

INodeFactory factory

Node Factory to use for Node creation.

Returns
Type Description
ILiteralNode
Exceptions
Type Condition
ArgumentNullException

Thrown if the Factory argument is null.

| Edit this page View Source

ToLiteralDate(DateTimeOffset, INodeFactory)

Creates a new Date typed literal.

Declaration
public static ILiteralNode ToLiteralDate(this DateTimeOffset dt, INodeFactory factory)
Parameters
Type Name Description
DateTimeOffset dt

Date Time.

INodeFactory factory

Node Factory to use for Node creation.

Returns
Type Description
ILiteralNode
Exceptions
Type Condition
ArgumentNullException

Thrown if the Factory argument is null.

| Edit this page View Source

ToLiteralTime(DateTime, INodeFactory)

Creates a new Time typed literal.

Declaration
public static ILiteralNode ToLiteralTime(this DateTime dt, INodeFactory factory)
Parameters
Type Name Description
DateTime dt

Date Time.

INodeFactory factory

Node Factory to use for Node creation.

Returns
Type Description
ILiteralNode

Literal representing the time.

Exceptions
Type Condition
ArgumentNullException

Thrown if the Factory argument is null.

| Edit this page View Source

ToLiteralTime(DateTime, INodeFactory, bool)

Creates a new Time typed literal.

Declaration
public static ILiteralNode ToLiteralTime(this DateTime dt, INodeFactory factory, bool precise)
Parameters
Type Name Description
DateTime dt

Date Time.

INodeFactory factory

Node Factory to use for Node creation.

bool precise

Whether to preserve precisely i.e. include fractional seconds.

Returns
Type Description
ILiteralNode

Literal representing the time.

Exceptions
Type Condition
ArgumentNullException

Thrown if the Factory argument is null.

| Edit this page View Source

ToLiteralTime(DateTimeOffset, INodeFactory)

Creates a new Time typed literal.

Declaration
public static ILiteralNode ToLiteralTime(this DateTimeOffset dt, INodeFactory factory)
Parameters
Type Name Description
DateTimeOffset dt

Date Time.

INodeFactory factory

Node Factory to use for Node creation.

Returns
Type Description
ILiteralNode

Literal representing the time.

Exceptions
Type Condition
ArgumentNullException

Thrown if the Factory argument is null.

| Edit this page View Source

ToLiteralTime(DateTimeOffset, INodeFactory, bool)

Creates a new Time typed literal.

Declaration
public static ILiteralNode ToLiteralTime(this DateTimeOffset dt, INodeFactory factory, bool precise)
Parameters
Type Name Description
DateTimeOffset dt

Date Time.

INodeFactory factory

Node Factory to use for Node creation.

bool precise

Whether to preserve precisely i.e. include fractional seconds.

Returns
Type Description
ILiteralNode

Literal representing the time.

Exceptions
Type Condition
ArgumentNullException

Thrown if the Factory argument is null.

| Edit this page View Source

ToTripleCollection(IEnumerable<Triple>, bool)

Creates BaseTripleCollection from an enumeration of triples.

Declaration
public static BaseTripleCollection ToTripleCollection(this IEnumerable<Triple> triples, bool indexed = true)
Parameters
Type Name Description
IEnumerable<Triple> triples

The triples to add to the collection.

bool indexed

True to create an indexed collection, false to create an un-indexed collection.

Returns
Type Description
BaseTripleCollection
  • Edit this page
  • View Source
In this article
  • Methods
    • ToLiteral(bool, INodeFactory)
    • ToLiteral(byte, INodeFactory)
    • ToLiteral(DateTime, INodeFactory)
    • ToLiteral(DateTime, INodeFactory, bool)
    • ToLiteral(DateTimeOffset, INodeFactory)
    • ToLiteral(DateTimeOffset, INodeFactory, bool)
    • ToLiteral(decimal, INodeFactory)
    • ToLiteral(double, INodeFactory)
    • ToLiteral(short, INodeFactory)
    • ToLiteral(int, INodeFactory)
    • ToLiteral(long, INodeFactory)
    • ToLiteral(sbyte, INodeFactory)
    • ToLiteral(float, INodeFactory)
    • ToLiteral(string, INodeFactory)
    • ToLiteral(TimeSpan, INodeFactory)
    • ToLiteralDate(DateTime, INodeFactory)
    • ToLiteralDate(DateTimeOffset, INodeFactory)
    • ToLiteralTime(DateTime, INodeFactory)
    • ToLiteralTime(DateTime, INodeFactory, bool)
    • ToLiteralTime(DateTimeOffset, INodeFactory)
    • ToLiteralTime(DateTimeOffset, INodeFactory, bool)
    • ToTripleCollection(IEnumerable<Triple>, bool)
Back to top Generated by DocFX