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

  • Literal

Constructors

  • 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: number = ClassOrder.Literal

The class order for this node

datatype: NamedNode = XSD.string

The literal's datatype as a named node

isVar: number = 0
language: string = ''

The language for the literal

termType: "Literal" = LiteralTermType

The type of node

value: string

The node's value

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

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

    Deprecated

    use {language} instead

    Returns string

  • set lang(language: string): void
  • Parameters

    • language: string

    Returns void

Methods

  • Gets whether two literals are the same

    Parameters

    • other: Term

      The other statement

    Returns boolean

  • Creates the substituted node for this one, according to the specified bindings

    Type Parameters

    Parameters

    • bindings: Bindings

      Bindings of identifiers to nodes

    Returns T

  • Creates a n-triples string representation of this node

    Returns string

  • Builds a literal node from a boolean value

    Parameters

    • value: boolean

      The value

    Returns Literal

  • Builds a literal node from an input value

    Type Parameters

    • T extends FromValueReturns<any>

    Parameters

    • value: ValueType

      The input value

    Returns T

Generated using TypeDoc