WikibaseLexeme
MediaWiki WikibaseLexeme extension
Loading...
Searching...
No Matches
Wikibase\Lexeme\Domain\Model\Lexeme Class Reference

Mutable (e.g. More...

+ Inheritance diagram for Wikibase\Lexeme\Domain\Model\Lexeme:
+ Collaboration diagram for Wikibase\Lexeme\Domain\Model\Lexeme:

Public Member Functions

 __construct (LexemeId $id=null, TermList $lemmas=null, ItemId $lexicalCategory=null, ItemId $language=null, StatementList $statements=null, $nextFormId=1, FormSet $forms=null, $nextSenseId=1, SenseSet $senses=null)
 Note that $lexicalCategory and $language can only be null during construction time.
 
 getId ()
 
 getType ()
 
 getStatements ()
 
 setId ( $id)
 
 isEmpty ()
 
 equals ( $target)
 
 copy ()
 
 __clone ()
 
 getLemmas ()
 
 setLemmas (TermList $lemmas)
 
 getLexicalCategory ()
 
 setLexicalCategory ( $lexicalCategory)
 
 getLanguage ()
 
 setLanguage ( $language)
 
 getForms ()
 
 getSenses ()
 
 isSufficientlyInitialized ()
 
 getNextFormId ()
 
 getNextSenseId ()
 
 getForm (FormId $formId)
 
 getSense (SenseId $senseId)
 
 addOrUpdateForm (Form $form)
 Replace the form identified by $form->getId() with the given one or add it.
 
 addOrUpdateSense (Sense $sense)
 Replace the sense identified by $sense->getId() with the given one or add it.
 
 removeForm (FormId $formId)
 
 removeSense (SenseId $senseId)
 
 patch (callable $patcher)
 
 clear ()
 Clears lemmas, language, lexical category, statements, forms, and senses of the lexeme.
 

Public Attributes

const ENTITY_TYPE = 'lexeme'
 

Private Member Functions

 increaseNextFormIdTo ( $number)
 
 increaseNextSenseIdTo ( $number)
 
 assertCorrectNextFormIdIsGiven ( $nextFormId, FormSet $formSet)
 
 assertCorrectNextSenseIdIsGiven ( $nextSenseId, SenseSet $senseSet)
 

Private Attributes

 $id
 
 $statements
 
 $lemmas
 
 $lexicalCategory
 
 $language
 
 $forms
 
 $senses
 
 $nextFormId
 
 $nextSenseId
 

Detailed Description

Mutable (e.g.

the provided StatementList can be changed) implementation of a Lexeme in the lexicographical data model.

See also
https://www.mediawiki.org/wiki/Extension:WikibaseLexeme/Data_Model#Lexeme

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lexeme\Domain\Model\Lexeme::__construct ( LexemeId $id = null,
TermList $lemmas = null,
ItemId $lexicalCategory = null,
ItemId $language = null,
StatementList $statements = null,
$nextFormId = 1,
FormSet $forms = null,
$nextSenseId = 1,
SenseSet $senses = null )

Note that $lexicalCategory and $language can only be null during construction time.

Their setters can not be called with null, and their getters will throw an exception if the corresponding field was never initialized.

Parameters
LexemeId | null$id
TermList | null$lemmas
ItemId | null$lexicalCategory
ItemId | null$language
StatementList | null$statements
int$nextFormId
FormSet | null$forms
int$nextSenseId
SenseSet | null$senses

Member Function Documentation

◆ __clone()

Wikibase\Lexeme\Domain\Model\Lexeme::__clone ( )

◆ addOrUpdateForm()

Wikibase\Lexeme\Domain\Model\Lexeme::addOrUpdateForm ( Form $form)

Replace the form identified by $form->getId() with the given one or add it.

New form ids are generated for forms with a NullFormId or an unknown DummyFormId.

Parameters
Form$form

◆ addOrUpdateSense()

Wikibase\Lexeme\Domain\Model\Lexeme::addOrUpdateSense ( Sense $sense)

Replace the sense identified by $sense->getId() with the given one or add it.

◆ assertCorrectNextFormIdIsGiven()

Wikibase\Lexeme\Domain\Model\Lexeme::assertCorrectNextFormIdIsGiven ( $nextFormId,
FormSet $formSet )
private
Parameters
int$nextFormId
FormSet$formSet

◆ assertCorrectNextSenseIdIsGiven()

Wikibase\Lexeme\Domain\Model\Lexeme::assertCorrectNextSenseIdIsGiven ( $nextSenseId,
SenseSet $senseSet )
private
Parameters
int$nextSenseId
SenseSet$senseSet

◆ clear()

Wikibase\Lexeme\Domain\Model\Lexeme::clear ( )

Clears lemmas, language, lexical category, statements, forms, and senses of the lexeme.

Note that this leaves the lexeme in an insufficiently initialized state.

◆ copy()

Wikibase\Lexeme\Domain\Model\Lexeme::copy ( )
See also
EntityDocument::copy
Returns
self

◆ equals()

Wikibase\Lexeme\Domain\Model\Lexeme::equals ( $target)
See also
EntityDocument::equals
Parameters
mixed$target
Returns
bool

◆ getForm()

Wikibase\Lexeme\Domain\Model\Lexeme::getForm ( FormId $formId)
Exceptions
OutOfRangeException

◆ getForms()

Wikibase\Lexeme\Domain\Model\Lexeme::getForms ( )

◆ getId()

Wikibase\Lexeme\Domain\Model\Lexeme::getId ( )
Returns
LexemeId|null

◆ getLanguage()

Wikibase\Lexeme\Domain\Model\Lexeme::getLanguage ( )
Exceptions
UnexpectedValueExceptionwhen the object was constructed with $language set to null, and the field was never initialized since then.

◆ getLemmas()

Wikibase\Lexeme\Domain\Model\Lexeme::getLemmas ( )

◆ getLexicalCategory()

Wikibase\Lexeme\Domain\Model\Lexeme::getLexicalCategory ( )
Exceptions
UnexpectedValueExceptionwhen the object was constructed with $lexicalCategory set to null, and the field was never initialized since then.
Returns
ItemId

◆ getNextFormId()

Wikibase\Lexeme\Domain\Model\Lexeme::getNextFormId ( )
Returns
int

◆ getNextSenseId()

Wikibase\Lexeme\Domain\Model\Lexeme::getNextSenseId ( )
Returns
int

◆ getSense()

Wikibase\Lexeme\Domain\Model\Lexeme::getSense ( SenseId $senseId)
Exceptions
OutOfRangeExceptionif no sense by that ID exists

◆ getSenses()

Wikibase\Lexeme\Domain\Model\Lexeme::getSenses ( )

◆ getStatements()

Wikibase\Lexeme\Domain\Model\Lexeme::getStatements ( )

◆ getType()

Wikibase\Lexeme\Domain\Model\Lexeme::getType ( )
Returns
string

◆ increaseNextFormIdTo()

Wikibase\Lexeme\Domain\Model\Lexeme::increaseNextFormIdTo ( $number)
private
Parameters
int$number

◆ increaseNextSenseIdTo()

Wikibase\Lexeme\Domain\Model\Lexeme::increaseNextSenseIdTo ( $number)
private
Parameters
int$number

◆ isEmpty()

Wikibase\Lexeme\Domain\Model\Lexeme::isEmpty ( )
Returns
bool A entity is empty if it does not contain any content that can be removed. Note that neither ID nor lexical category nor language can be set to null, and are therefor not taken into account.

◆ isSufficientlyInitialized()

Wikibase\Lexeme\Domain\Model\Lexeme::isSufficientlyInitialized ( )
Returns
bool False if a non-optional field was never initialized, true otherwise.

◆ patch()

Wikibase\Lexeme\Domain\Model\Lexeme::patch ( callable $patcher)

◆ removeForm()

Wikibase\Lexeme\Domain\Model\Lexeme::removeForm ( FormId $formId)

◆ removeSense()

Wikibase\Lexeme\Domain\Model\Lexeme::removeSense ( SenseId $senseId)

◆ setId()

Wikibase\Lexeme\Domain\Model\Lexeme::setId ( $id)
Parameters
LexemeId$id
Exceptions
InvalidArgumentException

◆ setLanguage()

Wikibase\Lexeme\Domain\Model\Lexeme::setLanguage ( $language)
Parameters
ItemId | null$language

◆ setLemmas()

Wikibase\Lexeme\Domain\Model\Lexeme::setLemmas ( TermList $lemmas)

◆ setLexicalCategory()

Wikibase\Lexeme\Domain\Model\Lexeme::setLexicalCategory ( $lexicalCategory)
Parameters
ItemId | null$lexicalCategory

Member Data Documentation

◆ $forms

Wikibase\Lexeme\Domain\Model\Lexeme::$forms
private

◆ $id

Wikibase\Lexeme\Domain\Model\Lexeme::$id
private

◆ $language

Wikibase\Lexeme\Domain\Model\Lexeme::$language
private

◆ $lemmas

Wikibase\Lexeme\Domain\Model\Lexeme::$lemmas
private

◆ $lexicalCategory

Wikibase\Lexeme\Domain\Model\Lexeme::$lexicalCategory
private

◆ $nextFormId

Wikibase\Lexeme\Domain\Model\Lexeme::$nextFormId
private

◆ $nextSenseId

Wikibase\Lexeme\Domain\Model\Lexeme::$nextSenseId
private

◆ $senses

Wikibase\Lexeme\Domain\Model\Lexeme::$senses
private

◆ $statements

Wikibase\Lexeme\Domain\Model\Lexeme::$statements
private

◆ ENTITY_TYPE

const Wikibase\Lexeme\Domain\Model\Lexeme::ENTITY_TYPE = 'lexeme'

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