Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\Api\EntityTerms Class Reference

Provides wikibase terms (labels, descriptions, aliases) for entity pages. More...

+ Inheritance diagram for Wikibase\Repo\Api\EntityTerms:
+ Collaboration diagram for Wikibase\Repo\Api\EntityTerms:

Public Member Functions

 __construct (ApiQuery $query, string $moduleName, AliasTermBuffer $aliasTermBuffer, EntityIdLookup $idLookup, TermBuffer $termBuffer, ContentLanguages $termsLanguages)
 
 execute ()
 
 getCacheMode ( $params)
 

Protected Member Functions

 getAllowedParams ()
 
 getExamplesMessages ()
 

Private Member Functions

 getTermsOfEntities (array $entityIds, array $termTypes, string $languageCode)
 
 getEntityIdsForTitles (array $titles, $continue=0)
 
 getEntityToPageMap (array $entityIds)
 
 groupTermsByPageAndType (array $entityToPageMap, array $terms)
 
 addTermsToResult (array $pagesToEntityIds, array $termGroups)
 
 addTermsForPage (ApiResult $result, int $pageId, array $termsByType)
 Add page term to an ApiResult, adding a continue parameter if it doesn't fit. More...
 

Private Attributes

 $aliasTermBuffer
 
 $termBuffer
 
 $idLookup
 
 $termsLanguages
 

Detailed Description

Provides wikibase terms (labels, descriptions, aliases) for entity pages.

For example, if data item Q61 has the label "Washington" and the description "capital city of the US", calling entityterms with titles=Q61 would include that label and description in the response.

Note
This closely mirrors the Client pageterms API, except for the services injected.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Api\EntityTerms::__construct ( ApiQuery  $query,
string  $moduleName,
AliasTermBuffer  $aliasTermBuffer,
EntityIdLookup  $idLookup,
TermBuffer  $termBuffer,
ContentLanguages  $termsLanguages 
)

Member Function Documentation

◆ addTermsForPage()

Wikibase\Repo\Api\EntityTerms::addTermsForPage ( ApiResult  $result,
int  $pageId,
array  $termsByType 
)
private

Add page term to an ApiResult, adding a continue parameter if it doesn't fit.

Parameters
ApiResult$result
int$pageId
array[]$termsByType
Exceptions
InvalidArgumentException
Returns
bool True if it fits in the result

◆ addTermsToResult()

Wikibase\Repo\Api\EntityTerms::addTermsToResult ( array  $pagesToEntityIds,
array  $termGroups 
)
private
Parameters
EntityId[]$pagesToEntityIds
array[]$termGroups

◆ execute()

Wikibase\Repo\Api\EntityTerms::execute ( )

◆ getAllowedParams()

Wikibase\Repo\Api\EntityTerms::getAllowedParams ( )
protected

◆ getCacheMode()

Wikibase\Repo\Api\EntityTerms::getCacheMode (   $params)
See also
ApiQueryBase::getCacheMode
Parameters
array$params
Returns
string

◆ getEntityIdsForTitles()

Wikibase\Repo\Api\EntityTerms::getEntityIdsForTitles ( array  $titles,
  $continue = 0 
)
private
Parameters
Title[]$titles
int | null$continue
Returns
array

◆ getEntityToPageMap()

Wikibase\Repo\Api\EntityTerms::getEntityToPageMap ( array  $entityIds)
private
Parameters
EntityId[]$entityIds
Returns
int[]

◆ getExamplesMessages()

Wikibase\Repo\Api\EntityTerms::getExamplesMessages ( )
protected

◆ getTermsOfEntities()

Wikibase\Repo\Api\EntityTerms::getTermsOfEntities ( array  $entityIds,
array  $termTypes,
string  $languageCode 
)
private
Parameters
EntityId[]$entityIds
string[]$termTypes
string$languageCode
Returns
TermIndexEntry[]

◆ groupTermsByPageAndType()

Wikibase\Repo\Api\EntityTerms::groupTermsByPageAndType ( array  $entityToPageMap,
array  $terms 
)
private
Parameters
int[]$entityToPageMap
TermIndexEntry[]$terms
Returns
array[] An associative array, mapping pageId + entity type to a list of strings.

Member Data Documentation

◆ $aliasTermBuffer

Wikibase\Repo\Api\EntityTerms::$aliasTermBuffer
private

◆ $idLookup

Wikibase\Repo\Api\EntityTerms::$idLookup
private

◆ $termBuffer

Wikibase\Repo\Api\EntityTerms::$termBuffer
private

◆ $termsLanguages

Wikibase\Repo\Api\EntityTerms::$termsLanguages
private

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