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, int $nextFormId=1, ?FormSet $forms=null, int $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 (?ItemId $lexicalCategory)
 
 getLanguage ()
 
 setLanguage (?ItemId $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 (int $number)
 
 increaseNextSenseIdTo (int $number)
 
 assertCorrectNextFormIdIsGiven (int $nextFormId, FormSet $formSet)
 
 assertCorrectNextSenseIdIsGiven (int $nextSenseId, SenseSet $senseSet)
 

Private Attributes

LexemeId $id
 
StatementList $statements
 
TermList $lemmas
 
ItemId $lexicalCategory
 
ItemId $language
 
FormSet $forms
 
SenseSet $senses
 
int $nextFormId
 
int $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,
int $nextFormId = 1,
?FormSet $forms = null,
int $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.

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.

◆ 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 ( int $nextFormId,
FormSet $formSet )
private

◆ assertCorrectNextSenseIdIsGiven()

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

◆ 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 ( )

◆ 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 ( )

◆ 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.

◆ getNextFormId()

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

◆ getNextSenseId()

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

◆ 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 ( )

◆ increaseNextFormIdTo()

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

◆ increaseNextSenseIdTo()

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

◆ 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 ( ?ItemId $language)

◆ setLemmas()

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

◆ setLexicalCategory()

Wikibase\Lexeme\Domain\Model\Lexeme::setLexicalCategory ( ?ItemId $lexicalCategory)

Member Data Documentation

◆ $forms

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

◆ $id

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

◆ $language

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

◆ $lemmas

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

◆ $lexicalCategory

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

◆ $nextFormId

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

◆ $nextSenseId

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

◆ $senses

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

◆ $statements

StatementList 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: