Class ExternalIdentifierSnak

Class for the ExternalIdentifierSnak.

Most used property of this type is P698 (PubMed ID).

Hierarchy (View Summary)

  • Snak
    • ExternalIdentifierSnak

Constructors

Properties

datatype: string = dataType
hash: undefined | string
id: null | 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

  • Converts the snak to JSON format.

    Returns ExternalIdentifierSnak

    The snak as JSON.

    const json = wikidataExtIDSnak.toJSON();
    
  • Creates a snak from a property and an ID string.

    Parameters

    • property: `P${number}`

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

    • id: string

      The external identifier.

    Returns ExternalIdentifierSnak

    A snak with the given properties.

    const snak = ExternalIdentifierSnak.fromID('P698', '12345678');