Statement

WikidataPain. Statement

Parameters:
Name Type Description
id string
loaded boolean
isNew boolean

Members

# id :string

Type:
  • string

# mainsnak :WikidataPain.Snak

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

Type:

# qualifiersOrder :Array.<string>

Type:
  • Array.<string>

# rank :string

Type:
  • string

# references :Array.<WikidataPain.Reference>

Type:

# type :string

Type:
  • string

Methods

# (static) collapseApiDictionary(dictionary) → {Array.<WikidataPain.Statement>}

Collapses a dictionary of properties and statements to a simple list of statements.
Parameters:
Name Type Description
dictionary Object.<string, Array.<WikidataPain.Statement>>
Returns:
Type
Array.<WikidataPain.Statement>

# (static) filterCollapsed(claims, predicate) → {Promise.<Array.<WikidataPain.Statement>>}

Parameters:
Name Type Description
claims Array.<WikidataPain.Statement> | Object.<string, Array.<WikidataPain.Statement>>
predicate function
Returns:
Type
Promise.<Array.<WikidataPain.Statement>>

# (async, static) filterStatementsByMainsnak(claimsToFilter, snak) → {Promise.<Array.<WikidataPain.Statement>>}

Parameters:
Name Type Description
claimsToFilter Array.<WikidataPain.Statement>
snak WikidataPain.Snak
Returns:
Type
Promise.<Array.<WikidataPain.Statement>>

# (async, static) filterStatementsByQualifier(claimsToFilter, qualifier) → {Promise.<Array.<WikidataPain.Statement>>}

Parameters:
Name Type Description
claimsToFilter Array.<WikidataPain.Statement>
qualifier WikidataPain.Snak
Returns:
Type
Promise.<Array.<WikidataPain.Statement>>

# (async, static) filterStatementsByQualifiersSubset(claimsToFilter, whole, ignoredQualifierProperties) → {Promise.<Array.<WikidataPain.Statement>>}

Parameters:
Name Type Default Description
claimsToFilter Array.<WikidataPain.Statement>
whole WikidataPain.Statement
ignoredQualifierProperties Array.<string> null
Returns:
Type
Promise.<Array.<WikidataPain.Statement>>

# (async, static) filterStatementsByRefinable(claimsToFilter, whole, configopt) → {Promise.<Array.<WikidataPain.Statement>>}

Parameters:
Name Type Attributes Description
claimsToFilter Array.<WikidataPain.Statement>
whole WikidataPain.Statement
config Object <optional>
Properties
Name Type Attributes Description
ignoredQualifierProperties Array.<string> <optional>
qualifierFilterCriterium WikidataPain.QualifierMatchingCriterium <optional>
Returns:
Type
Promise.<Array.<WikidataPain.Statement>>

# (static) fromBlank(entity, mainsnak, rankopt) → {WikidataPain.Statement}

Parameters:
Name Type Attributes Default Description
entity string Wikidata Q-ID.
mainsnak WikidataPain.Snak Mainsnak.
rank WikidataPain.Rank <optional>
WikidataPain.Rank.Normal
Returns:
Type
WikidataPain.Statement

# (static) fromClaimId(claimId) → {WikidataPain.Statement}

Returns an instance of WikidataPain.Statement by its Claim-ID. Implicitly normalises claimId using WikidataPain.normaliseClaimId.
Parameters:
Name Type Description
claimId string Wikidata Claim-ID.
Returns:
Type
WikidataPain.Statement

# (async, static) fromEntity(entity, propertyopt, loadReferencesopt) → {Promise.<Object.<string, Array.<WikidataPain.Statement>>>}

Parameters:
Name Type Attributes Default Description
entity string Wikidata Q-ID.
property string <optional>
null Wikidata P-ID.
loadReferences boolean <optional>
false Whether to load references.
Returns:
Type
Promise.<Object.<string, Array.<WikidataPain.Statement>>>

# (async, static) fromEntityCollapsed(entity, property, loadReferencesopt) → {Promise.<Array.<WikidataPain.Statement>>}

Parameters:
Name Type Attributes Default Description
entity string Wikidata Q-ID.
property string Wikidata P-ID.
loadReferences boolean <optional>
false Whether to load references.
Returns:
Type
Promise.<Array.<WikidataPain.Statement>>

# (static) fromRaw(raw, referencesLoadedopt) → {WikidataPain.Statement}

Parameters:
Name Type Attributes Default Description
raw Object
referencesLoaded boolean <optional>
false Set references as loaded.
Returns:
Type
WikidataPain.Statement

# (static) fromRawNew(entity, raw) → {WikidataPain.Statement}

Parameters:
Name Type Description
entity string
raw Object
Returns:
Type
WikidataPain.Statement

# (async) addReference(reference) → {Promise.<void>}

Parameters:
Name Type Description
reference WikidataPain.Reference
Returns:
Type
Promise.<void>

# (async) addReferenceInstant(reference, optionsopt, nullable) → {Promise.<void>}

Is committed instantly and may not be chained.
Parameters:
Name Type Attributes Description
reference WikidataPain.Reference
options Object <optional>
<nullable>
Returns:
Type
Promise.<void>

# (async) commit(config) → {Promise.<Object>}

Parameters:
Name Type Description
config Object
Properties
Name Type Attributes Description
editgroup string <optional>
summary string <optional>
Returns:
Type
Promise.<Object>

# (async) deleteInstant(optionsopt, nullable) → {Promise.<void>}

Deletes the statement using `wbremoveclaims`. Is committed instantly and may not be chained.
Parameters:
Name Type Attributes Description
options Object <optional>
<nullable>
Returns:
Type
Promise.<void>

# extendFromRaw(raw) → {WikidataPain.Statement}

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

# (async) filterAnd(predicates) → {Promise.<boolean>}

Parameters:
Name Type Description
predicates Array.<function(WikidataPain.Statement): Promise.<boolean>>
Returns:
Type
Promise.<boolean>

# (async) filterByMainsnakDataValue(predicate) → {Promise.<boolean>}

Parameters:
Name Type Description
predicate function
Returns:
Type
Promise.<boolean>

# (async) filterByNoQualifierSnaks(property) → {Promise.<boolean>}

Parameters:
Name Type Description
property string
Returns:
Type
Promise.<boolean>

# (async) filterByQualifier(property, predicate) → {Promise.<boolean>}

Parameters:
Name Type Description
property string
predicate function
Returns:
Type
Promise.<boolean>

# (async) filterByQualifiers(predicate) → {Promise.<boolean>}

Parameters:
Name Type Description
predicate function
Returns:
Type
Promise.<boolean>

# (async) filterOr(predicates) → {Promise.<boolean>}

Parameters:
Name Type Description
predicates Array.<function(WikidataPain.Statement): Promise.<boolean>>
Returns:
Type
Promise.<boolean>

# (async) findPotentiallyRefinable(configopt) → {Promise.<Array.<WikidataPain.Statement>>}

Parameters:
Name Type Attributes Description
config Object <optional>
Properties
Name Type Attributes Description
qualifierFilterCriterium WikidataPain.QualifierMatchingCriterium <optional>
Returns:
Type
Promise.<Array.<WikidataPain.Statement>>

# (async) getMainsnak() → {Promise.<WikidataPain.Snak>}

Returns:
Type
Promise.<WikidataPain.Snak>

# (async) getObject(requestReferencesopt) → {Promise.<Object>}

Parameters:
Name Type Attributes Default Description
requestReferences boolean <optional>
true Whether to load references
Returns:
Type
Promise.<Object>

# (async) getQualifiers() → {Promise.<Object.<string, Array.<WikidataPain.Snak>>>}

Returns:
Type
Promise.<Object.<string, Array.<WikidataPain.Snak>>>

# (async) getQualifierSnaks(property) → {Promise.<Array.<WikidataPain.Snak>>}

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

# (async) getReferences() → {Promise.<Array.<WikidataPain.Reference>>}

Returns:
Type
Promise.<Array.<WikidataPain.Reference>>

# (async) load(requestReferencesopt) → {Promise.<void>}

Explicitly loads the statement. Typically, this method doesn't need to be called, but can be used to improve the efficiency of scripts.
Parameters:
Name Type Attributes Default Description
requestReferences boolean <optional>
false
Returns:
Type
Promise.<void>

# (async) mergeFrom(other, configopt) → {Promise.<boolean>}

Parameters:
Name Type Attributes Description
other WikidataPain.Statement
config Object <optional>
Properties
Name Type Attributes Description
referenceRefinableCriterium WikidataPain.ReferenceMatchingCriterium <optional>
Returns:
Whether a change occured.
Type
Promise.<boolean>

# (async) mergeQualifierSnak(qualifier, newSnak) → {Promise.<boolean>}

Parameters:
Name Type Description
qualifier string
newSnak WikidataPain.Snak
Returns:
Whether a change occured.
Type
Promise.<boolean>

# (async) mergeReference(newReference, configopt) → {Promise.<boolean>}

Parameters:
Name Type Attributes Description
newReference WikidataPain.Reference
config Object <optional>
Properties
Name Type Attributes Description
referenceRefinableCriterium WikidataPain.ReferenceMatchingCriterium <optional>
Returns:
Whether changes occured.
Type
Promise.<boolean>

# (async) moveToPropertyInstant(targetProperty, valueTransformeropt, nullable, optionsopt, nullable) → {Promise.<void>}

Creates a new statement with a different property based on this one and deletes this statement. Is committed instantly and may not be chained.
Parameters:
Name Type Attributes Description
targetProperty string New property to move the claim to.
valueTransformer ValueTransformer <optional>
<nullable>
Function to apply to the claim's value which's result will be used as value for the newly created statement's claim.
options Object <optional>
<nullable>
Returns:
Type
Promise.<void>

# (async) qualifierAddOrRefine(newQualifier, configopt) → {Promise.<void>}

Parameters:
Name Type Attributes Description
newQualifier WikidataPain.Snak
config Object <optional>
Properties
Name Type Attributes Description
onAdditionalQualifierValues 'delete' | 'fail' <optional>
Returns:
Type
Promise.<void>

# (async) qualifierAppend(snak) → {Promise.<void>}

Parameters:
Name Type Description
snak WikidataPain.Snak
Returns:
Type
Promise.<void>

# (async) qualifierRemove(propertyOrSnak, snak) → {Promise.<number>}

Parameters:
Name Type Default Description
propertyOrSnak string (1) Name or the qualifier's property to remove. (2) Snak to remove.
snak WikidataPain.Snak null (1) Snak of the qualifier to remove. Set to `null` to delete regardless of snak. (2) Leave `null`.
Returns:
Number of qualifiers that have been removed-
Type
Promise.<number>

# (async) refine(allowCreate, configopt) → {Promise.<Object>}

Loads the original statement and adds qualifiers and references of this statement to it.
Parameters:
Name Type Attributes Description
allowCreate boolean
config Object <optional>
Properties
Name Type Attributes Default Description
editgroup string <optional>
null
qualifierFilterCriterium WikidataPain.QualifierMatchingCriterium <optional>
referenceRefinableCriterium WikidataPain.ReferenceMatchingCriterium <optional>
summary string <optional>
null
Returns:
Type
Promise.<Object>

# (async) removeReferenceByHash(hash) → {Promise.<boolean>}

Parameters:
Name Type Description
hash string
Returns:
Whether a reference has been removed.
Type
Promise.<boolean>

# (async) setClaim(configopt) → {Promise.<Object>}

Parameters:
Name Type Attributes Description
config Object <optional>
Properties
Name Type Attributes Description
editgroup string <optional>
summary string <optional>
Returns:
Type
Promise.<Object>

# (async) setRank(newRanknon-null, oldRankopt, nullable) → {Promise.<void>}

Parameters:
Name Type Attributes Default Description
newRank WikidataPain.Rank
oldRank WikidataPain.Rank <optional>
<nullable>
null
Returns:
Type
Promise.<void>

# (async) setValue(newValue) → {Promise.<void>}

Sets this statement's value. Must be committed by calling WikidataPain.Statement#commit.
Parameters:
Name Type Description
newValue any New value
Returns:
Type
Promise.<void>

# (async) setValueInstant(newValue, snaktypeopt, nullable, optionsopt, nullable) → {Promise.<void>}

Sets this statement's value using `wbsetclaimvalue`. Is committed instantly and may not be chained.
Parameters:
Name Type Attributes Description
newValue any
snaktype WikidataPain.Snak.ValueType <optional>
<nullable>
options Object <optional>
<nullable>
Returns:
Type
Promise.<void>

# (async) transformValue(valueTransformer) → {Promise.<void>}

Applies `valueTransformer` to the statement's claim's value and sets it's output as the claim's new value. Must be committed by calling WikidataPain.Statement.commit.
Parameters:
Name Type Description
valueTransformer ValueTransformer Function to apply to the claim's value which's result with replace the claim's current value.
Returns:
Type
Promise.<void>

# (async) transformValueInstant(valueTransformer, optionsopt, nullable) → {Promise.<void>}

Applies `valueTransformer` to the statement's claim's value and sets it's output as the claim's new value by using `wbsetclaimvalue`. Is committed instantly and may not be chained.
Parameters:
Name Type Attributes Description
valueTransformer ValueTransformer
options Object <optional>
<nullable>
Returns:
Type
Promise.<void>