Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Lib\Store\Sql\Terms\DatabaseTermInLangIdsResolver Class Reference

Term in lang ID resolver using the normalized database schema. More...

+ Inheritance diagram for Wikibase\Lib\Store\Sql\Terms\DatabaseTermInLangIdsResolver:
+ Collaboration diagram for Wikibase\Lib\Store\Sql\Terms\DatabaseTermInLangIdsResolver:

Public Member Functions

 __construct (TypeIdsResolver $typeIdsResolver, TypeIdsLookup $typeIdsLookup, RepoDomainDb $db, ?LoggerInterface $logger=null)
 
 resolveTermInLangIds (array $termInLangIds, array $types=null, array $languages=null)
 Resolves terms for the given term in lang IDs.
 
 resolveGroupedTermInLangIds (array $groupedTermInLangIds, array $types=null, array $languages=null)
 Resolves terms for the given groups of term in lang IDs.
 
 resolveTermsViaJoin ( $joinTable, $joinColumn, $groupColumn, array $conditions, array $types=null, array $languages=null)
 Resolves terms by joining internal term ids table against another external table to allow maximum optimization to the user over how many queries would be performed.
 

Private Member Functions

 newSelectQueryBuilder (array $types=null, array $languages=null)
 
 preloadTypes (IResultWrapper $result)
 
 addResultTerms (array &$terms, stdClass $row)
 
 lookupTypeName ( $typeId)
 
 lookupTypeIds (array $typeNames)
 
 getDbr ()
 

Private Attributes

 $typeIdsResolver
 
 $typeIdsLookup
 
 $db
 
 $logger
 
 $typeNames = []
 

Detailed Description

Term in lang ID resolver using the normalized database schema.

See also
Item & Property Terms

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Store\Sql\Terms\DatabaseTermInLangIdsResolver::__construct ( TypeIdsResolver $typeIdsResolver,
TypeIdsLookup $typeIdsLookup,
RepoDomainDb $db,
?LoggerInterface $logger = null )

Member Function Documentation

◆ addResultTerms()

Wikibase\Lib\Store\Sql\Terms\DatabaseTermInLangIdsResolver::addResultTerms ( array & $terms,
stdClass $row )
private

◆ getDbr()

Wikibase\Lib\Store\Sql\Terms\DatabaseTermInLangIdsResolver::getDbr ( )
private

◆ lookupTypeIds()

Wikibase\Lib\Store\Sql\Terms\DatabaseTermInLangIdsResolver::lookupTypeIds ( array $typeNames)
private

◆ lookupTypeName()

Wikibase\Lib\Store\Sql\Terms\DatabaseTermInLangIdsResolver::lookupTypeName ( $typeId)
private

◆ newSelectQueryBuilder()

Wikibase\Lib\Store\Sql\Terms\DatabaseTermInLangIdsResolver::newSelectQueryBuilder ( array $types = null,
array $languages = null )
private

◆ preloadTypes()

Wikibase\Lib\Store\Sql\Terms\DatabaseTermInLangIdsResolver::preloadTypes ( IResultWrapper $result)
private

◆ resolveGroupedTermInLangIds()

Wikibase\Lib\Store\Sql\Terms\DatabaseTermInLangIdsResolver::resolveGroupedTermInLangIds ( array $groupedTermInLangIds,
array $types = null,
array $languages = null )

Resolves terms for the given groups of term in lang IDs.

The input is an array of term in lang ID arrays, with arbitrary keys. The return value is an array of terms structures, with the same keys, where the values belong to the term in lang IDs corresponding to that key. One call to this method is effectively equivalent to multiple calls to resolveTermInLangIds with the individual term in lang ID arrays, but may be more efficient than that, e.g. resolving all the term in lang IDs in one batch and then grouping them correctly afterwards.

Parameters
int[][]$groupedTermInLangIds
null | string[]$typesIf not null, only include results of these types
null | string[]$languagesIf not null, only include results in these languages
Returns
array[]

Implements Wikibase\Lib\Store\Sql\Terms\TermInLangIdsResolver.

◆ resolveTermInLangIds()

Wikibase\Lib\Store\Sql\Terms\DatabaseTermInLangIdsResolver::resolveTermInLangIds ( array $termInLangIds,
array $types = null,
array $languages = null )

Resolves terms for the given term in lang IDs.

Note that the information whether the leaf nodes were single strings or arrays of strings is lost: while TermInLangIdsAcquirer::acquireTermInLangIds accepts both, this method always returns arrays of strings.

Parameters
int[]$termInLangIds
null | string[]$typesIf not null, only include results of these types
null | string[]$languagesIf not null, only include results in these languages
Returns
array containing terms per type per language. Example: [ 'label' => [ 'en' => [ 'some label' ], 'de' => [ 'another label' ], ... ], 'alias' => [ 'en' => [ 'alias', 'another alias', ...], 'de' => [ 'de alias' ], ... ], ... ]

Implements Wikibase\Lib\Store\Sql\Terms\TermInLangIdsResolver.

◆ resolveTermsViaJoin()

Wikibase\Lib\Store\Sql\Terms\DatabaseTermInLangIdsResolver::resolveTermsViaJoin ( $joinTable,
$joinColumn,
$groupColumn,
array $conditions,
array $types = null,
array $languages = null )

Resolves terms by joining internal term ids table against another external table to allow maximum optimization to the user over how many queries would be performed.

Parameters
string$joinTable
string$joinColumnColumn name in $joinTable that stores term ids to join on
string$groupColumnResolved terms will be grouped by values of this column in $joinTable.
array$conditions
array | null$types
array | null$languages
Returns
array[] keys of returned array are the distinct values of $groupColumn, and values will be term arrays containing terms per type per language. Example, given group column contains 1, 2 and 3 as distinct values: [ 1 => [ 'label' => [ 'en' => [ 'some label' ], ... ], 'alias' => [ 'en' => [ 'alias', 'another alias', ... ], ... ], ... ], 2 => [ 'label' => [ 'en' => [ 'another label' ], ... ], ... ], 3 => [ 'description' => [ 'en' => [ 'just a description' ], ... ], ... ] ]

Member Data Documentation

◆ $db

Wikibase\Lib\Store\Sql\Terms\DatabaseTermInLangIdsResolver::$db
private

◆ $logger

Wikibase\Lib\Store\Sql\Terms\DatabaseTermInLangIdsResolver::$logger
private

◆ $typeIdsLookup

Wikibase\Lib\Store\Sql\Terms\DatabaseTermInLangIdsResolver::$typeIdsLookup
private

◆ $typeIdsResolver

Wikibase\Lib\Store\Sql\Terms\DatabaseTermInLangIdsResolver::$typeIdsResolver
private

◆ $typeNames

Wikibase\Lib\Store\Sql\Terms\DatabaseTermInLangIdsResolver::$typeNames = []
private

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