Class WikibaseItemSnak

Class for the WikibaseItemSnak.

Most used property of this type is P2860 (cites work).

Hierarchy (View Summary)

  • Snak
    • WikibaseItemSnak

Constructors

Properties

datatype: string = 'wikibase-item'
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 id(): undefined | string
  • Returns undefined | string

    The value of the snak.

    id

  • set id(value: undefined | string): void
  • Parameters

    • value: undefined | string

      The value of the snak.

    Returns void

    id

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

    Returns string

    The ID.

  • get numericID(): undefined | number
  • Returns undefined | number

    The value of the snak.

    numericID

  • set numericID(value: undefined | number): void
  • Parameters

    • value: undefined | number

      The value of the snak.

    Returns void

    numericID

Methods

  • Create a snak from some basic data.

    Parameters

    • property: `P${number}`

      The property of the snak in 'P-form'.

    • id: `Q${number}`

      The Wikibase item id in the Q-form.

    Returns WikibaseItemSnak

    A snak with the given properties.

    const snak = WikibaseItemSnak.fromID('P2860', 'Q42');