Reference

WikidataPain. Reference

Parameters:
Name Type Description
snaks Object.<string, Array.<WikidataPain.Snak>>
snakOrder Array.<string>

Members

# hash :string

Type:
  • string

# snaks :Object.<string, Array.<WikidataPain.Snak>>

Type:

# snaksOrder :Array.<string>

Type:
  • Array.<string>

Methods

# (async, static) fromHash(hash) → {Promise.<WikidataPain.Reference>}

Parameters:
Name Type Description
hash string
Returns:
Type
Promise.<WikidataPain.Reference>

# (static) fromRaw(raw) → {WikidataPain.Reference}

Parameters:
Name Type Description
raw Object
Returns:
Type
WikidataPain.Reference

# (static) fromSnaks(snaks, snaksOrderopt) → {WikidataPain.Reference}

Parameters:
Name Type Attributes Default Description
snaks Array.<WikidataPain.Snak> List of snaks.
snaksOrder Array.<string> <optional>
null Order of snaks, if not set than order of snaks in {@ref snaks} is used.
Returns:
Type
WikidataPain.Reference

# (static) statementsByReferenceHash(referenceHash) → {Promise.<Array.<WikidataPain.Statement>>}

Returns a set of statements that have at least one reference with the given hash. The lookup is done using the Wikidata Query Service.
Parameters:
Name Type Description
referenceHash string
Returns:
Type
Promise.<Array.<WikidataPain.Statement>>

# addSnak(snak) → {WikidataPain.Reference}

Adds a snak to the reference.
Parameters:
Name Type Description
snak WikidataPain.Snak
Returns:
Type
WikidataPain.Reference

# comparePrecision(other) → {WikidataPain.PrecisionComparison}

Parameters:
Name Type Description
other WikidataPain.Reference

# filterSnaksByRefinable(property, otherSnak) → {Array.<WikidataPain.Snak>}

Parameters:
Name Type Description
property string
otherSnak WikidataPain.Snak
Returns:
Type
Array.<WikidataPain.Snak>

# merge(other) → {boolean}

Parameters:
Name Type Description
other WikidataPain.Reference
Returns:
Type
boolean

# overlaps(other) → {boolean}

Parameters:
Name Type Description
other WikidataPain.Reference
Returns:
Whether there is at least one Snak that is shared by both references.
Type
boolean

# (async) replaceHashInstant(hash) → {Promise.<void>}

Replaces all references that have the given hash across all statements. Querying of statements that contain a reference with the given hash is done via the Wikidata Query Service. This means, that there is a delay after which newly added references are detected.
Parameters:
Name Type Description
hash string Hash of the references to replace.
Returns:
Type
Promise.<void>

# toJSON() → {Object}

Returns:
Type
Object