Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Client\Api\PageTerms Class Reference

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

+ Inheritance diagram for Wikibase\Client\Api\PageTerms:
+ Collaboration diagram for Wikibase\Client\Api\PageTerms:

Public Member Functions

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

Static Public Member Functions

static newFromGlobalState (ApiQuery $apiQuery, string $moduleName)
 

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.
 

Private Attributes

 $termBuffer
 
 $idLookup
 

Detailed Description

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

For example, if a data item has the label "Washington" and the description "capital city of the US", and has a sitelink to the local page called "Washington DC", calling pageterms with titles=Washington_DC would include that label and description in the response.

Note
This closely mirrors the Repo entityterms API, except for newFromGlobalState.
Author
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Client\Api\PageTerms::__construct ( TermBuffer  $termBuffer,
EntityIdLookup  $idLookup,
ApiQuery  $query,
string  $moduleName 
)

Member Function Documentation

◆ addTermsForPage()

Wikibase\Client\Api\PageTerms::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\Client\Api\PageTerms::addTermsToResult ( array  $pagesToEntityIds,
array  $termGroups 
)
private
Parameters
EntityId[]$pagesToEntityIds
array[]$termGroups

◆ execute()

Wikibase\Client\Api\PageTerms::execute ( )

◆ getAllowedParams()

Wikibase\Client\Api\PageTerms::getAllowedParams ( )
protected

◆ getCacheMode()

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

◆ getEntityIdsForTitles()

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

◆ getEntityToPageMap()

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

◆ getExamplesMessages()

Wikibase\Client\Api\PageTerms::getExamplesMessages ( )
protected

◆ getTermsOfEntities()

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

◆ groupTermsByPageAndType()

Wikibase\Client\Api\PageTerms::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.

◆ newFromGlobalState()

static Wikibase\Client\Api\PageTerms::newFromGlobalState ( ApiQuery  $apiQuery,
string  $moduleName 
)
static

Member Data Documentation

◆ $idLookup

Wikibase\Client\Api\PageTerms::$idLookup
private

◆ $termBuffer

Wikibase\Client\Api\PageTerms::$termBuffer
private

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