Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector Class Reference

Queries db term store for collisions on terms. More...

+ Inheritance diagram for Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector:
+ Collaboration diagram for Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector:

Public Member Functions

 __construct (string $entityType, RepoDomainDb $db, TypeIdsLookup $typeIdsLookup)
 
 detectLabelCollision (string $lang, string $label)
 Returns an entity id that collides with given label in given language, if any.
 
 detectLabelAndDescriptionCollision (string $lang, string $label, string $description)
 Returns an entity id that collides with given label and description in given languages, if any.
 
 detectLabelsCollision (TermList $termList)
 Returns entity ids that collides with given labels in given languages.
 

Private Member Functions

 makeEntityId ( $numericEntityId)
 
 composeEntityId ( $numericEntityId)
 
 findEntityIdsWithTermInLang (string $lang, string $text, int $termTypeId, bool $firstMatchOnly=false, array $filterOnEntityIds=[])
 
 findEntityIdsWithTermsInLangs (array $lang, array $text, int $termTypeId)
 
 newSelectQueryBuilder ()
 

Private Attributes

string $entityType
 
RepoDomainDb $db
 
TypeIdsLookup $typeIdsLookup
 

Detailed Description

Queries db term store for collisions on terms.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector::__construct ( string $entityType,
RepoDomainDb $db,
TypeIdsLookup $typeIdsLookup )
Parameters
string$entityTypeone of the two supported types: Item::ENTITY_TYPE or Property::ENTITY_TYPE
RepoDomainDb$db
TypeIdsLookup$typeIdsLookup
Exceptions
InvalidArgumentExceptionwhen non supported entity type is given

Member Function Documentation

◆ composeEntityId()

Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector::composeEntityId ( $numericEntityId)
private

◆ detectLabelAndDescriptionCollision()

Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector::detectLabelAndDescriptionCollision ( string $lang,
string $label,
string $description )

Returns an entity id that collides with given label and description in given languages, if any.

Implements Wikibase\Repo\Store\TermsCollisionDetector.

◆ detectLabelCollision()

Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector::detectLabelCollision ( string $lang,
string $label )

Returns an entity id that collides with given label in given language, if any.

Implements Wikibase\Repo\Store\TermsCollisionDetector.

◆ detectLabelsCollision()

Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector::detectLabelsCollision ( TermList $labels)

Returns entity ids that collides with given labels in given languages.

Parameters
TermList$labels

// example return array [ 'P1' => [ Term('en', 'label'), Term('de', 'label') ] ]

Returns
array

Implements Wikibase\Repo\Store\TermsCollisionDetector.

◆ findEntityIdsWithTermInLang()

Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector::findEntityIdsWithTermInLang ( string $lang,
string $text,
int $termTypeId,
bool $firstMatchOnly = false,
array $filterOnEntityIds = [] )
private

◆ findEntityIdsWithTermsInLangs()

Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector::findEntityIdsWithTermsInLangs ( array $lang,
array $text,
int $termTypeId )
private

◆ makeEntityId()

Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector::makeEntityId ( $numericEntityId)
private
Parameters
mixed | null$numericEntityId
Returns
EntityId|null

◆ newSelectQueryBuilder()

Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector::newSelectQueryBuilder ( )
private

Member Data Documentation

◆ $db

RepoDomainDb Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector::$db
private

◆ $entityType

string Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector::$entityType
private

◆ $typeIdsLookup

TypeIdsLookup Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector::$typeIdsLookup
private

The documentation for this class was generated from the following file: