Options
All
  • Public
  • Public/Protected
  • All
Menu

Module rdf

RDF related utilities

Index

Functions

RDF

  • RDF(suffix: string): string

SEF

  • SEF(suffix: string): string

SES

  • SES(suffix: string): string

XSD

  • XSD(suffix: string): string

asJS

  • asJS(value: string, type: string | null): any

countVariables

  • countVariables(triple: TripleObject): number
  • Count the number of variables in a Triple Pattern

    Parameters

    • triple: TripleObject

      Triple Pattern to process

    Returns number

    The number of variables in the Triple Pattern

createBNode

  • createBNode(value?: undefined | string): BlankNode
  • Creates a Blank Node in RDFJS format

    Parameters

    • Optional value: undefined | string

      Blank node value

    Returns BlankNode

    A new Blank Node in RDFJS format

createBoolean

  • createBoolean(value: boolean): Literal
  • Creates a Literal from a boolean, in RDFJS format

    Parameters

    • value: boolean

      Boolean

    Returns Literal

    A new boolean in RDFJS format

createDate

  • createDate(date: Moment): Literal
  • Creates a Literal from a Moment.js date, in RDFJS format

    Parameters

    • date: Moment

      Date, in Moment.js format

    Returns Literal

    A new date literal in RDFJS format

createFalse

  • createFalse(): Literal
  • Creates a False boolean, in RDFJS format

    Returns Literal

    A new boolean in RDFJS format

createFloat

  • createFloat(value: number): Literal
  • Creates an float Literal in RDFJS format

    Parameters

    • value: number

      Float

    Returns Literal

    A new float in RDFJS format

createIRI

  • createIRI(value: string): NamedNode
  • Creates an IRI in RDFJS format

    Parameters

    • value: string

      IRI value

    Returns NamedNode

    A new IRI in RDFJS format

createInteger

  • createInteger(value: number): Literal
  • Creates an integer Literal in RDFJS format

    Parameters

    • value: number

      Integer

    Returns Literal

    A new integer in RDFJS format

createLangLiteral

  • createLangLiteral(value: string, language: string): Literal
  • Creates a Literal with a language tag in RDFJS format

    Parameters

    • value: string

      Literal value

    • language: string

      Language tag (en, fr, it, ...)

    Returns Literal

    A new Literal with a language tag in RDFJS format

createLiteral

  • createLiteral(value: string): Literal
  • Creates a Literal in RDFJS format, without any datatype or language tag

    Parameters

    • value: string

      Literal value

    Returns Literal

    A new literal in RDFJS format

createTrue

  • createTrue(): Literal
  • Creates a True boolean, in RDFJS format

    Returns Literal

    A new boolean in RDFJS format

createTypedLiteral

  • createTypedLiteral(value: any, type: string): Literal
  • Creates an typed Literal in RDFJS format

    Parameters

    • value: any

      Literal value

    • type: string

      Literal type (integer, float, dateTime, ...)

    Returns Literal

    A new typed Literal in RDFJS format

createUnbound

  • createUnbound(): Literal
  • Creates an unbounded literal, used when a variable is not bounded in a set of bindings

    Returns Literal

    A new literal in RDFJS format

fromN3

  • fromN3(term: string): Term

getLiteralValue

  • getLiteralValue(literal: string): string
  • Get the value (excluding datatype & language tags) of a RDF literal

    Parameters

    • literal: string

      RDF Literal

    Returns string

    The literal's value

hashTriple

  • hashTriple(triple: TripleObject): string
  • Hash Triple (pattern) to assign it an unique ID

    Parameters

    • triple: TripleObject

      Triple (pattern) to hash

    Returns string

    An unique ID to identify the Triple (pattern)

isIRI

  • isIRI(str: string): boolean
  • Return True if a string is a RDF IRI/URI

    Parameters

    • str: string

      String to test

    Returns boolean

    True if the string is a RDF IRI/URI, False otherwise

isLiteral

  • isLiteral(str: string): boolean
  • Return True if a string is a RDF Literal

    Parameters

    • str: string

      String to test

    Returns boolean

    True if the string is a RDF Literal, False otherwise

isVariable

  • isVariable(str: string): boolean
  • Return True if a string is a SPARQL variable

    Parameters

    • str: string

      String to test

    Returns boolean

    True if the string is a SPARQL variable, False otherwise

literalIsBoolean

  • literalIsBoolean(literal: Literal): boolean
  • Test if a RDFJS Literal is a boolean

    Parameters

    • literal: Literal

    Returns boolean

    True of the Literal is a boolean, False otherwise

literalIsDate

  • literalIsDate(literal: Literal): boolean
  • Test if a RDFJS Literal is a date

    Parameters

    • literal: Literal

      RDFJS Literal

    Returns boolean

    True of the Literal is a date, False otherwise

literalIsNumeric

  • literalIsNumeric(literal: Literal): boolean
  • Test if a RDFJS Literal is a number

    Parameters

    • literal: Literal

      RDFJS Literal

    Returns boolean

    True of the Literal is a number, False otherwise

shallowCloneTerm

  • shallowCloneTerm(term: Term, newValue: string): Term
  • Clone a literal and replace its value with another one

    Parameters

    • term: Term
    • newValue: string

      New literal value

    Returns Term

    The literal with its new value

termEquals

  • termEquals(a: Term, b: Term): boolean
  • Test if two RDFJS Terms are equals

    Parameters

    • a: Term

      First Term

    • b: Term

      Second Term

    Returns boolean

    True if the two RDFJS Terms are equals, False

termIsBNode

  • termIsBNode(term: Term): term is BlankNode
  • Test if a RDFJS Term is a Blank Node

    Parameters

    • term: Term

      RDFJS Term

    Returns term is BlankNode

    True of the term is a Blank Node, False otherwise

termIsIRI

  • termIsIRI(term: Term): term is NamedNode
  • Test if a RDFJS Term is an IRI, i.e., a NamedNode

    Parameters

    • term: Term

      RDFJS Term

    Returns term is NamedNode

    True of the term is an IRI, False otherwise

termIsLiteral

  • termIsLiteral(term: Term): term is Literal
  • Test if a RDFJS Term is a Literal

    Parameters

    • term: Term

      RDFJS Term

    Returns term is Literal

    True of the term is a Literal, False otherwise

toN3

  • toN3(term: Term): string

triple

  • triple(subj: string, pred: string, obj: string): TripleObject
  • Create a RDF triple in Object representation

    Parameters

    • subj: string

      Triple's subject

    • pred: string

      Triple's predicate

    • obj: string

      Triple's object

    Returns TripleObject

    A RDF triple in Object representation

tripleEquals

  • tripleEquals(a: TripleObject, b: TripleObject): boolean
  • Test if two triple (patterns) are equals

    Parameters

    • a: TripleObject

      First triple (pattern)

    • b: TripleObject

      Second triple (pattern)

    Returns boolean

    True if the two triple (patterns) are equals, False otherwise

Generated using TypeDoc