Wikibase
MediaWiki Wikibase extension
|
Validates the uniqueness of changing parts in a ChangeOpFingerprintResult across entities in store. More...
Public Member Functions | |
__construct (TermsCollisionDetector $termsCollisionDetector, TermLookup $termLookup) | |
setOptions (array $options) | |
validate ( $value) | |
Private Member Functions | |
validateProperty (ChangeOpFingerprintResult $fingerprintChangeOpResult) | |
validateItem (ChangeOpFingerprintResult $fingerprintChangeOpResult) | |
getChangedLabelsPerLanguage (ChangeOpFingerprintResult $changeOpsResult) | |
getChangedLabelsAndDescriptionsPerLanguage (ChangeOpFingerprintResult $changeOpsResult) | |
collectNewAndOldTerms (ChangeOpFingerprintResult $changeOpsResult) | |
generateLabelDescriptionPairs (array $newTerms, array $oldTerms, EntityId $entityId) | |
In order to check label and decsription uniqueness, this validator need to know both the label and the description in a language, where one or both of them are going to change. More... | |
getEntityTerm (EntityId $entityId, $lang, $termType) | |
collisionToError ( $code, $collidingEntityId, $lang, $label) | |
Private Attributes | |
$termsCollisionDetector | |
$termLookup | |
Validates the uniqueness of changing parts in a ChangeOpFingerprintResult across entities in store.
Business logic in here is as following: Given an item Q1 in language L When L label or description of Q1 are being modified Then there should be no other Q2 in the store with L label and/or description Items are unique on their label and description in a language. This means, given a language, no two items should have same label and same description in that language.
Properties are unique on their label alone in a language. This means, given a language, no two properties should have same label in that language.
Wikibase\Repo\Validators\FingerprintUniquenessValidator::__construct | ( | TermsCollisionDetector | $termsCollisionDetector, |
TermLookup | $termLookup | ||
) |
|
private |
old terms might not contain complementary data to those entries in new terms, as that depends on whether the ChangeOpsResult contains results of things that are not being changed or not (which in turn depends on ChangeOpFingerprint that produced the ChangeOpFingerprintResult). Example scenario is an api call that is sending to server only the terms that need to change. Counter example scenario is a frontend (e.g. termbox) sending back to server all terms, whether changed or not.
|
private |
|
private |
In order to check label and decsription uniqueness, this validator need to know both the label and the description in a language, where one or both of them are going to change.
This method purpose is take those terms that are about to change ($newTerms) and make sure to yield pairs of label and description, filling in those missing labels or descriptions from either $oldTerms or from term store directly.
|
private |
|
private |
|
private |
Wikibase\Repo\Validators\FingerprintUniquenessValidator::setOptions | ( | array | $options | ) |
Wikibase\Repo\Validators\FingerprintUniquenessValidator::validate | ( | $value | ) |
|
private |
|
private |
|
private |
|
private |