Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\DataModel\Services\Lookup\TermLookup Interface Reference

A service interface for looking up entity terms. More...

+ Inheritance diagram for Wikibase\DataModel\Services\Lookup\TermLookup:

Public Member Functions

 getLabel (EntityId $entityId, $languageCode)
 Gets the label of an Entity with the specified EntityId and language code.
 
 getLabels (EntityId $entityId, array $languageCodes)
 Gets all labels of an Entity with the specified EntityId.
 
 getDescription (EntityId $entityId, $languageCode)
 Gets the description of an Entity with the specified EntityId and language code.
 
 getDescriptions (EntityId $entityId, array $languageCodes)
 Gets all descriptions of an Entity with the specified EntityId.
 

Detailed Description

A service interface for looking up entity terms.

This service only looks up terms in the specified language(s) and does not apply language fallbacks.

Note
: A TermLookup cannot be used to determine whether an entity exists or not.
Since
1.1
Author
Katie Filbert < aude..nosp@m.wiki.nosp@m.@gmai.nosp@m.l.co.nosp@m.m >

Member Function Documentation

◆ getDescription()

Wikibase\DataModel\Services\Lookup\TermLookup::getDescription ( EntityId $entityId,
$languageCode )

Gets the description of an Entity with the specified EntityId and language code.

Since
2.0
Parameters
EntityId$entityId
string$languageCode
Exceptions
TermLookupExceptionfor entity not found
Returns
string|null

Implemented in Wikibase\Client\DataAccess\Scribunto\CachingFallbackBasedTermLookup, Wikibase\DataAccess\NullPrefetchingTermLookup, Wikibase\Lib\Store\CachingPrefetchingTermLookup, Wikibase\Lib\Store\EntityTermLookupBase, and Wikibase\DataModel\Services\Lookup\EntityRetrievingTermLookup.

◆ getDescriptions()

Wikibase\DataModel\Services\Lookup\TermLookup::getDescriptions ( EntityId $entityId,
array $languageCodes )

Gets all descriptions of an Entity with the specified EntityId.

If $languages is given, the result will contain the entries for the requested languages, if they exist.

Since
2.0
Parameters
EntityId$entityId
string[]$languageCodesThe list of languages to fetch
Exceptions
TermLookupExceptionif the entity was not found (not guaranteed).
Returns
string[] descriptions, keyed by language.

Implemented in Wikibase\Client\DataAccess\Scribunto\CachingFallbackBasedTermLookup, Wikibase\DataAccess\NullPrefetchingTermLookup, Wikibase\Lib\Store\CachingPrefetchingTermLookup, Wikibase\Lib\Store\EntityTermLookupBase, and Wikibase\DataModel\Services\Lookup\EntityRetrievingTermLookup.

◆ getLabel()

Wikibase\DataModel\Services\Lookup\TermLookup::getLabel ( EntityId $entityId,
$languageCode )

Gets the label of an Entity with the specified EntityId and language code.

Since
2.0
Parameters
EntityId$entityId
string$languageCode
Exceptions
TermLookupExceptionfor entity not found
Returns
string|null

Implemented in Wikibase\Client\DataAccess\Scribunto\CachingFallbackBasedTermLookup, Wikibase\DataAccess\NullPrefetchingTermLookup, Wikibase\Lib\Store\CachingPrefetchingTermLookup, Wikibase\Lib\Store\EntityTermLookupBase, and Wikibase\DataModel\Services\Lookup\EntityRetrievingTermLookup.

◆ getLabels()

Wikibase\DataModel\Services\Lookup\TermLookup::getLabels ( EntityId $entityId,
array $languageCodes )

Gets all labels of an Entity with the specified EntityId.

The result will contain the entries for the requested languages, if they exist.

Since
2.0
Parameters
EntityId$entityId
string[]$languageCodesThe list of languages to fetch
Exceptions
TermLookupExceptionif the entity was not found (not guaranteed).
Returns
string[] labels, keyed by language.

Implemented in Wikibase\Client\DataAccess\Scribunto\CachingFallbackBasedTermLookup, Wikibase\DataAccess\NullPrefetchingTermLookup, Wikibase\Lib\Store\CachingPrefetchingTermLookup, Wikibase\Lib\Store\EntityTermLookupBase, and Wikibase\DataModel\Services\Lookup\EntityRetrievingTermLookup.


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