Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\FederatedProperties\ApiPrefetchingTermLookup Class Reference

A PrefetchingTermLookup for federated properties. More...

+ Inheritance diagram for Wikibase\Repo\FederatedProperties\ApiPrefetchingTermLookup:
+ Collaboration diagram for Wikibase\Repo\FederatedProperties\ApiPrefetchingTermLookup:

Public Member Functions

 __construct (ApiEntityLookup $apiEntityLookup)
 
 prefetchTerms (array $entityIds, array $termTypes, array $languageCodes)
 Loads a set of terms into the buffer.
 
 getPrefetchedTerm (EntityId $entityId, $termType, $languageCode)
 Returns a term that was previously loaded by prefetchTerms.
 
 getPrefetchedAliases (EntityId $entityId, $languageCode)
 
- Public Member Functions inherited from Wikibase\Lib\Store\EntityTermLookupBase
 getLabel (EntityId $entityId, $languageCode)
 
 getLabels (EntityId $entityId, array $languageCodes)
 
 getDescription (EntityId $entityId, $languageCode)
 
 getDescriptions (EntityId $entityId, array $languageCodes)
 

Protected Member Functions

 getTermsOfType (EntityId $entityId, $termType, array $languageCodes)
 
- Protected Member Functions inherited from Wikibase\Lib\Store\EntityTermLookupBase
 convertTermsToMap (array $wikibaseTerms)
 

Private Member Functions

 getKey (EntityId $entityId, string $termType, string $languageCode)
 
 getKeyString (string $entityId, string $termType, string $languageCode)
 
 setKeys (array $entityIds, array $termTypes, array $languageCodes)
 
 isPrefetched (EntityId $entityId, array $termTypes, array $languageCodes)
 
 translateTermTypesToApiProps (array $termTypes)
 
 validateTermTypes (array $termTypes)
 

Private Attributes

 $terms = []
 
 $termKeys = []
 
 $apiEntityLookup
 
const SUPPORTED_TERM_TYPES = [ TermTypes::TYPE_LABEL, TermTypes::TYPE_DESCRIPTION ]
 

Detailed Description

A PrefetchingTermLookup for federated properties.

Prefetches from GenericActionApiClient(API) and stores them in $terms (current process only). Looks up terms from $terms.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\FederatedProperties\ApiPrefetchingTermLookup::__construct ( ApiEntityLookup $apiEntityLookup)
Parameters
ApiEntityLookup$apiEntityLookup

Member Function Documentation

◆ getKey()

Wikibase\Repo\FederatedProperties\ApiPrefetchingTermLookup::getKey ( EntityId $entityId,
string $termType,
string $languageCode )
private

◆ getKeyString()

Wikibase\Repo\FederatedProperties\ApiPrefetchingTermLookup::getKeyString ( string $entityId,
string $termType,
string $languageCode )
private

◆ getPrefetchedAliases()

Wikibase\Repo\FederatedProperties\ApiPrefetchingTermLookup::getPrefetchedAliases ( EntityId $entityId,
$languageCode )
Returns
never

Implements Wikibase\DataAccess\AliasTermBuffer.

◆ getPrefetchedTerm()

Wikibase\Repo\FederatedProperties\ApiPrefetchingTermLookup::getPrefetchedTerm ( EntityId $entityId,
$termType,
$languageCode )

Returns a term that was previously loaded by prefetchTerms.

Parameters
EntityId$entityId
string$termType
string$languageCode
Returns
string|false|null The term, or false of that term is known to not exist, or null if the term was not prefetched.

Implements Wikibase\DataModel\Services\Term\TermBuffer.

◆ getTermsOfType()

Wikibase\Repo\FederatedProperties\ApiPrefetchingTermLookup::getTermsOfType ( EntityId $entityId,
$termType,
array $languageCodes )
protected
Parameters
EntityId$entityId
string$termType
array$languageCodes
Returns
array|string[]

Reimplemented from Wikibase\Lib\Store\EntityTermLookupBase.

◆ isPrefetched()

Wikibase\Repo\FederatedProperties\ApiPrefetchingTermLookup::isPrefetched ( EntityId $entityId,
array $termTypes,
array $languageCodes )
private

◆ prefetchTerms()

Wikibase\Repo\FederatedProperties\ApiPrefetchingTermLookup::prefetchTerms ( array $entityIds,
array $termTypes,
array $languageCodes )

Loads a set of terms into the buffer.

The source from which to fetch would typically be supplied to the buffer's constructor.

Parameters
EntityId[]$entityIds
string[]$termTypesThe desired term types.
string[]$languageCodesThe desired languages.

Implements Wikibase\DataModel\Services\Term\TermBuffer.

◆ setKeys()

Wikibase\Repo\FederatedProperties\ApiPrefetchingTermLookup::setKeys ( array $entityIds,
array $termTypes,
array $languageCodes )
private

◆ translateTermTypesToApiProps()

Wikibase\Repo\FederatedProperties\ApiPrefetchingTermLookup::translateTermTypesToApiProps ( array $termTypes)
private

◆ validateTermTypes()

Wikibase\Repo\FederatedProperties\ApiPrefetchingTermLookup::validateTermTypes ( array $termTypes)
private

Member Data Documentation

◆ $apiEntityLookup

Wikibase\Repo\FederatedProperties\ApiPrefetchingTermLookup::$apiEntityLookup
private

◆ $termKeys

Wikibase\Repo\FederatedProperties\ApiPrefetchingTermLookup::$termKeys = []
private

◆ $terms

Wikibase\Repo\FederatedProperties\ApiPrefetchingTermLookup::$terms = []
private

◆ SUPPORTED_TERM_TYPES

const Wikibase\Repo\FederatedProperties\ApiPrefetchingTermLookup::SUPPORTED_TERM_TYPES = [ TermTypes::TYPE_LABEL, TermTypes::TYPE_DESCRIPTION ]
private

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