Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Client\Usage\EntityUsage Class Reference

Value object representing the usage of an entity. More...

Public Member Functions

 __construct (EntityId $entityId, string $aspect, ?string $modifier=null)
 
 getAspect ()
 
 getModifier ()
 
 getAspectKey ()
 Returns the aspect with the modifier applied.
 
 getEntityId ()
 
 getIdentityString ()
 
 __toString ()
 
 asArray ()
 

Static Public Member Functions

static stripModifier (string $aspectKey)
 
static splitAspectKey (string $aspectKey)
 Splits the given aspect key into aspect and modifier (if any).
 
static makeAspectKey (string $aspect, ?string $modifier=null)
 Composes an aspect key from aspect and modifier (if any).
 

Public Attributes

const SITELINK_USAGE = 'S'
 Usage flag indicating that the entity's sitelinks (including badges) were used.
 
const LABEL_USAGE = 'L'
 Usage flag indicating that one of the entity's labels were used.
 
const DESCRIPTION_USAGE = 'D'
 Usage flag indicating that one of the entity's descriptions were used.
 
const TITLE_USAGE = 'T'
 Usage flag indicating that the entity's local page name was used, i.e.
 
const STATEMENT_USAGE = 'C'
 Usage flag indicating that certain statements (identified by their property id) from the entity were used.
 
const ALL_USAGE = 'X'
 Usage flag indicating that any and all aspects of the entity were (or may have been) used.
 
const OTHER_USAGE = 'O'
 Usage flag indicating that some aspect of the entity was changed which is not covered by any other usage flag (except "all").
 

Private Attributes

 $entityId
 
 $aspect
 
 $modifier
 
 $identity
 

Static Private Attributes

static $aspects
 

Detailed Description

Value object representing the usage of an entity.

This includes information about how the entity is used, but not where.

See also
docs/usagetracking.wiki
Author
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Client\Usage\EntityUsage::__construct ( EntityId $entityId,
string $aspect,
?string $modifier = null )
Parameters
EntityId$entityId
string$aspectuse the EntityUsage::XXX_USAGE constants
string | null$modifierfor further qualifying the usage aspect (e.g. a language code may be used along with the LABEL_USAGE aspect.
Exceptions
InvalidArgumentException

Member Function Documentation

◆ __toString()

Wikibase\Client\Usage\EntityUsage::__toString ( )

◆ asArray()

Wikibase\Client\Usage\EntityUsage::asArray ( )
Returns
array ( 'entityId' => string $entityId, 'aspect' => string $aspect, 'modifier' => string|null $modifier ) -return array{entityId:string,aspect:string,modifier:?string}

◆ getAspect()

Wikibase\Client\Usage\EntityUsage::getAspect ( )

◆ getAspectKey()

Wikibase\Client\Usage\EntityUsage::getAspectKey ( )

Returns the aspect with the modifier applied.

See also
makeAspectKey

◆ getEntityId()

Wikibase\Client\Usage\EntityUsage::getEntityId ( )

◆ getIdentityString()

Wikibase\Client\Usage\EntityUsage::getIdentityString ( )

◆ getModifier()

Wikibase\Client\Usage\EntityUsage::getModifier ( )

◆ makeAspectKey()

static Wikibase\Client\Usage\EntityUsage::makeAspectKey ( string $aspect,
?string $modifier = null )
static

Composes an aspect key from aspect and modifier (if any).

This is the inverse of splitAspectKey().

Returns
string "$aspect.$modifier"

◆ splitAspectKey()

static Wikibase\Client\Usage\EntityUsage::splitAspectKey ( string $aspectKey)
static

Splits the given aspect key into aspect and modifier (if any).

This is the inverse of makeAspectKey().

Returns
string[] list( $aspect, $modifier )

◆ stripModifier()

static Wikibase\Client\Usage\EntityUsage::stripModifier ( string $aspectKey)
static
Returns
string One of the EntityUsage::..._USAGE constants with the modifier split off.

Member Data Documentation

◆ $aspect

Wikibase\Client\Usage\EntityUsage::$aspect
private

◆ $aspects

Wikibase\Client\Usage\EntityUsage::$aspects
staticprivate
Initial value:
= [
self::SITELINK_USAGE => null,
self::LABEL_USAGE => null,
self::DESCRIPTION_USAGE => null,
self::TITLE_USAGE => null,
self::STATEMENT_USAGE => null,
self::OTHER_USAGE => null,
self::ALL_USAGE => null,
]

◆ $entityId

Wikibase\Client\Usage\EntityUsage::$entityId
private

◆ $identity

Wikibase\Client\Usage\EntityUsage::$identity
private

◆ $modifier

Wikibase\Client\Usage\EntityUsage::$modifier
private

◆ ALL_USAGE

const Wikibase\Client\Usage\EntityUsage::ALL_USAGE = 'X'

Usage flag indicating that any and all aspects of the entity were (or may have been) used.

◆ DESCRIPTION_USAGE

const Wikibase\Client\Usage\EntityUsage::DESCRIPTION_USAGE = 'D'

Usage flag indicating that one of the entity's descriptions were used.

This would be the case when showing the descriptions of a referenced entity. Note that descriptions usage is typically tracked with a modifier specifying the language code.

◆ LABEL_USAGE

const Wikibase\Client\Usage\EntityUsage::LABEL_USAGE = 'L'

Usage flag indicating that one of the entity's labels were used.

This would be the case when showing the label of a referenced entity. Note that label usage is typically tracked with a modifier specifying the label's language code.

◆ OTHER_USAGE

const Wikibase\Client\Usage\EntityUsage::OTHER_USAGE = 'O'

Usage flag indicating that some aspect of the entity was changed which is not covered by any other usage flag (except "all").

That is, the specific usage flags together with the "other" flag are equivalent to the "all" flag ( S + T + L + O = X or rather O = X - S - T - L ).

This currently covers alias usage and entity existence checks.

◆ SITELINK_USAGE

const Wikibase\Client\Usage\EntityUsage::SITELINK_USAGE = 'S'

Usage flag indicating that the entity's sitelinks (including badges) were used.

This would, for example, be the case when generating language links or sister links from an entity's sitelinks, for display in the sidebar.

◆ STATEMENT_USAGE

const Wikibase\Client\Usage\EntityUsage::STATEMENT_USAGE = 'C'

Usage flag indicating that certain statements (identified by their property id) from the entity were used.

This currently implies that we also have an OTHER_USAGE or an ALL_USAGE for the same entity (STATEMENT_USAGE is never used alone).

◆ TITLE_USAGE

const Wikibase\Client\Usage\EntityUsage::TITLE_USAGE = 'T'

Usage flag indicating that the entity's local page name was used, i.e.

the title of the local (client) page linked to the entity. This would be the case when linking a referenced entity to the corresponding local wiki page. This can be thought of as a special kind of sitelink usage, specifically for the sitelink for the local wiki.


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