Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Literal

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

link

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

link

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

Hierarchy

Implements

  • Literal

Index

Constructors

constructor

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

    Parameters

    • value: string

      The literal's lexical value

    • Optional language: string | null

      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

datatype

datatype: NamedNode = XSD.string

The literal's datatype as a named node A NamedNode whose IRI represents the datatype of the literal.

isVar

isVar: number = 0

language

language: string = ""

The language for the literal The language as lowercase BCP-47 [BCP47] string (examples: "en", "en-gb") or an empty string if the literal has no language.

termType

termType: typeof LiteralTermType = LiteralTermType

Contains the constant "Literal".

value

value: string

The node's value The text value, unescaped, without language or type (example: "Brad Pitt")

Static toJS

toJS: (term: any) => Date | Number | string | boolean | object | Array<Date | Number | string | boolean | object>

Type declaration

    • (term: any): Date | Number | string | boolean | object | Array<Date | Number | string | boolean | object>
    • Parameters

      • term: any

      Returns Date | Number | string | boolean | object | Array<Date | Number | string | boolean | object>

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

hashString

  • hashString(): string

sameTerm

  • sameTerm(other: Node): boolean

substitute

toCanonical

  • toCanonical(): string

toNQ

  • toNQ(): string

toNT

  • toNT(): string

toString

  • toString(): string

Static fromBoolean

  • fromBoolean(value: boolean): Literal
  • Builds a literal node from a boolean value

    Parameters

    • value: boolean

      The value

    Returns Literal

Static fromDate

Static fromNumber

  • fromNumber(value: number): Literal

Static fromValue

Static toNT