Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\Maintenance\PopulateWithRandomEntitiesAndTerms Class Reference

Populates the database with generated entities. More...

+ Inheritance diagram for Wikibase\Repo\Maintenance\PopulateWithRandomEntitiesAndTerms:
+ Collaboration diagram for Wikibase\Repo\Maintenance\PopulateWithRandomEntitiesAndTerms:

Public Member Functions

 __construct ()
 
 execute ()
 

Private Member Functions

 saveEntity (EntityDocument $entity, IContextSource $context, MediaWikiEditEntityFactory $editEntityFactory)
 
 createEntityGenerator ( $entityType, $nrOfEntities, array $languages)
 
 getDuplicationDegree ()
 
 addLabelsToEntity (EntityDocument $entity, array $languages, Generator $textGenerator)
 
 addDescriptionsToEntity (EntityDocument $entity, array $languages, Generator $textGenerator)
 
 addAliasesToEntity (EntityDocument $entity, array $languages, Generator $textGenerator)
 
 getNrOfEntities ()
 
 createTextGenerator ( $duplicationDegree=0)
 
 getDefaultLanguages ()
 

Private Attributes

const SCRIPT_USER_NAME = 'script_populate_random_entities'
 
const SUMMARY_TEXT = 'Created using PopulateWithRandomEntitiesAndTerms maintenance script'
 
const OPTION_DEFAULT_AT_LEAST = 1
 
const OPTION_DEFAULT_AT_MOST = 50
 
const OPTION_DEFAULT_DUPLICATION_DEGREE = 0.5
 

Detailed Description

Populates the database with generated entities.

Those entities will be populated with randomly generated terms (labels, descriptions, aliases), in a set of different languages (can be modified through options).

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Maintenance\PopulateWithRandomEntitiesAndTerms::__construct ( )

Member Function Documentation

◆ addAliasesToEntity()

Wikibase\Repo\Maintenance\PopulateWithRandomEntitiesAndTerms::addAliasesToEntity ( EntityDocument $entity,
array $languages,
Generator $textGenerator )
private

◆ addDescriptionsToEntity()

Wikibase\Repo\Maintenance\PopulateWithRandomEntitiesAndTerms::addDescriptionsToEntity ( EntityDocument $entity,
array $languages,
Generator $textGenerator )
private

◆ addLabelsToEntity()

Wikibase\Repo\Maintenance\PopulateWithRandomEntitiesAndTerms::addLabelsToEntity ( EntityDocument $entity,
array $languages,
Generator $textGenerator )
private

◆ createEntityGenerator()

Wikibase\Repo\Maintenance\PopulateWithRandomEntitiesAndTerms::createEntityGenerator ( $entityType,
$nrOfEntities,
array $languages )
private
Parameters
string$entityType'item' or 'property'
int$nrOfEntities
array$languages
Returns
Generator

◆ createTextGenerator()

Wikibase\Repo\Maintenance\PopulateWithRandomEntitiesAndTerms::createTextGenerator ( $duplicationDegree = 0)
private
Parameters
int$duplicationDegree[0, 1] aimed percentage of duplication over all generated text. <= 0 means no duplication and all generated text is unique >= 1 will generate one unique text once and always return it
Returns
Generator

◆ execute()

Wikibase\Repo\Maintenance\PopulateWithRandomEntitiesAndTerms::execute ( )

◆ getDefaultLanguages()

Wikibase\Repo\Maintenance\PopulateWithRandomEntitiesAndTerms::getDefaultLanguages ( )
private

◆ getDuplicationDegree()

Wikibase\Repo\Maintenance\PopulateWithRandomEntitiesAndTerms::getDuplicationDegree ( )
private
Returns
int

◆ getNrOfEntities()

Wikibase\Repo\Maintenance\PopulateWithRandomEntitiesAndTerms::getNrOfEntities ( )
private
Returns
int number of entities to generate

◆ saveEntity()

Wikibase\Repo\Maintenance\PopulateWithRandomEntitiesAndTerms::saveEntity ( EntityDocument $entity,
IContextSource $context,
MediaWikiEditEntityFactory $editEntityFactory )
private

Member Data Documentation

◆ OPTION_DEFAULT_AT_LEAST

const Wikibase\Repo\Maintenance\PopulateWithRandomEntitiesAndTerms::OPTION_DEFAULT_AT_LEAST = 1
private

◆ OPTION_DEFAULT_AT_MOST

const Wikibase\Repo\Maintenance\PopulateWithRandomEntitiesAndTerms::OPTION_DEFAULT_AT_MOST = 50
private

◆ OPTION_DEFAULT_DUPLICATION_DEGREE

const Wikibase\Repo\Maintenance\PopulateWithRandomEntitiesAndTerms::OPTION_DEFAULT_DUPLICATION_DEGREE = 0.5
private

◆ SCRIPT_USER_NAME

const Wikibase\Repo\Maintenance\PopulateWithRandomEntitiesAndTerms::SCRIPT_USER_NAME = 'script_populate_random_entities'
private

◆ SUMMARY_TEXT

const Wikibase\Repo\Maintenance\PopulateWithRandomEntitiesAndTerms::SUMMARY_TEXT = 'Created using PopulateWithRandomEntitiesAndTerms maintenance script'
private

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