Class URLSnak

Class for the URLSnak.

Most used property of this type is P854 (reference URL).

Hierarchy (View Summary)

Constructors

Properties

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

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.

  • get value(): undefined | string
  • The value will be URL encoded.

    Returns undefined | string

    The value of the snak.

    url

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

    • value: undefined | string

      The value of the snak.

    Returns void

    url

Methods

  • This function checks if two snaks are equal.

    Parameters

    Returns boolean

    True if the snaks are equal.

    if (urlSnak.equals(other)) {
    // do something
    }
  • Parameters

    • property: `P${number}`

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

    • url: string

      The URL.

    Returns URLSnak

    A snak with the given properties.

    const snak = URLSnak.fromURL('P854', 'https://example.com');