WikidataPain.Statement

Members

id :string

mainsnak :WikidataPain.Snak

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

qualifiersOrder :Array.<string>

rank :string

references :Array.<Object>

type :string

Methods

static collapsedApiDictionary(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:
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:
Promise.<Array.<WikidataPain.Statement>>

static filterStatementsByPropertiesSubset(claims, property, entity, ignoredQualifierProperties) → {Promise.<Array.<any>>}

Parameters:
Name Type Default Description
claims Object.<string, Array.<WikidataPain.Statement>>
property string
entity any
ignoredQualifierProperties Array.<string> null
Returns:
Promise.<Array.<any>>

static fromClaimId(claimId) → {WikidataPain.Statement}

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

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

Parameters:
Name Type Attributes Default Description
entity string Wikidata Q-ID.
property string <optional>
null Wikidata P-ID.
Returns:
Promise.<Object.<string, Array.<WikidataPain.Statement>>>

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

Parameters:
Name Type Description
entity string Wikidata Q-ID.
property string Wikidata P-ID.
Returns:
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.

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:
Promise.<void>

commit() → {Promise.<void>}

Returns:
Promise.<void>

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:
Promise.<void>

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

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

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

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

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

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

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

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

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

Returns:
Promise.<WikidataPain.Snak>

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

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

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

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

moveToPropertyInstant(targetProperty, valueTransformeropt, nullable, optionsopt, nullable) → {Promise.<WikidataPain.Statement>}

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:
Promise.<WikidataPain.Statement>

qualifierAddOrRefine(property, newQualifier, config) → {Promise.<WikidataPain.Statement>}

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

setValue(newValue) → {Promise.<WikidataPain.Statement>}

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

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.Type <optional>
<nullable>
options Object <optional>
<nullable>
Returns:
Promise.<void>

transformValue(valueTransformer) → {Promise.<WikidataPain.Statement>}

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:
Promise.<WikidataPain.Statement> - This object for chaining.

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:
Promise.<void>