Class SnakAbstract

Represents a Snak in the Wikidata model.

Hierarchy (View Summary)

Constructors

Properties

Accessors

Methods

Constructors

  • Creates an instance of Snak.

    Parameters

    • snak: Snaks

      The snak in a JSON format.

    Returns Snak

    const snak = new Snak(json);
    

Properties

datatype: string
hash: undefined | string
property: `P${number}`
snaktype: SnakType

Accessors

  • get hasValue(): boolean
  • Checks if the snak has a value.

    Returns boolean

    True if the snak has a value.

  • get internalID(): string
  • Creates a unique ID for the Snak.

    Returns string

    The ID.

Methods

  • Checks if this Snak is equal to another Snak.

    Parameters

    • other: Snak

      The other Snak to compare with.

    Returns boolean

    True if the Snaks are equal.

  • Converts the Snak to a JSON object.

    Returns Snaks

    The JSON representation of the Snak.