iwf
    Preparing search index...

    Class WikibaseItemSnak

    Class for the WikibaseItemSnak.

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

    Hierarchy (View Summary)

    • Snak
      • WikibaseItemSnak
    Index
    • Parameters

      • snak: {
            datatype?: "wikibase-item";
            datavalue?: {
                type: "wikibase-entityid";
                value: { "entity-type": "item"; id: string; "numeric-id": number };
            };
            hash?: string;
            property: string;
            snaktype: "value"
            | "somevalue"
            | "novalue";
        }

        The snak for this class in JSON format.

      Returns WikibaseItemSnak

      If the input does not match this datatype's Wikidata schema.

      const snak = new WikibaseItemSnak(snak);
      
    datatype: string = 'wikibase-item'
    hash: string | undefined
    property: `P${number}`
    snaktype: "value" | "somevalue" | "novalue"
    • 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 numericID(): number | undefined

      Returns number | undefined

      The value of the snak.

      numericID

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

      Parameters

      • value: number | undefined

        The value of the snak.

      Returns void

      numericID

    • Returns {
          datatype?: "wikibase-item";
          datavalue?: {
              type: "wikibase-entityid";
              value: { "entity-type": "item"; id: string; "numeric-id": number };
          };
          hash?: string;
          property: string;
          snaktype: "value"
          | "somevalue"
          | "novalue";
      }

      The snak as JSON.

      const json = itemSnak.toJSON();
      
    • 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');