Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Literal

An RDF literal, containing some value which isn't expressed as an IRI.

link

https://rdf.js.org/data-model-spec/#literal-interface

Hierarchy

Implements

  • TFLiteral

Index

Constructors

constructor

  • new Literal(value: string, language?: null | string, datatype?: any): Literal
  • Initializes a literal

    Parameters

    • value: string

      The literal's lexical value

    • Optional language: null | string

      The language for the literal. Defaults to ''.

    • Optional datatype: any

      The literal's datatype as a named node. Defaults to xsd:string.

    Returns Literal

Properties

classOrder

classOrder: number = ClassOrder.Literal

The class order for this node

datatype

datatype: NamedNode = XSD.string

The literal's datatype as a named node

isVar

isVar: number = 0

language

language: string = ''

The language for the literal

termType

termType: "Literal" = LiteralTermType

The type of node

value

value: string

The node's value

Static toJS

toJS: (term: any) => string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]

Type declaration

    • (term: any): string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]
    • Parameters

      • term: any

      Returns string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]

Accessors

lang

  • get lang(): string
  • set lang(language: string): void
  • The language for the literal

    deprecated

    use {language} instead

    Returns string

  • The language for the literal

    deprecated

    use {language} instead

    Parameters

    • language: string

    Returns void

Methods

compareTerm

  • compareTerm(other: Node): number

copy

equals

  • equals(other: Term): boolean
  • Gets whether two literals are the same

    Parameters

    • other: Term

      The other statement

    Returns boolean

hashString

  • hashString(): string

sameTerm

  • sameTerm(other: Node): boolean

substitute

  • substitute<T>(bindings: Bindings): T
  • Creates the substituted node for this one, according to the specified bindings

    Type parameters

    Parameters

    • bindings: Bindings

      Bindings of identifiers to nodes

    Returns T

toCanonical

  • toCanonical(): string

toNQ

  • toNQ(): string

toNT

  • toNT(): string

toString

  • toString(): string

Static fromBoolean

  • fromBoolean(value: boolean): Literal

Static fromDate

Static fromNumber

Static fromValue

  • fromValue<T>(value: ValueType): T
  • Builds a literal node from an input value

    Type parameters

    • T: FromValueReturns<any>

    Parameters

    • value: ValueType

      The input value

    Returns T

Static toNT

Generated using TypeDoc