Aleksey Bekh-Ivanov (WMDE) has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/377284 )

Change subject: Remove DemoData
......................................................................

Remove DemoData

Change-Id: Idd8b20fcca349a06f0fb18d92cf2608b113b163e
---
M src/Content/LexemeContent.php
M src/DataModel/Lexeme.php
D src/DemoData/AskOut1Populator.php
D src/DemoData/AskOut2Populator.php
D src/DemoData/AskOut3Populator.php
D src/DemoData/HardLexemePopulator.php
D src/DemoData/Id.php
D src/DemoData/LeiterLexemePopulator.php
8 files changed, 1 insertion(+), 438 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseLexeme 
refs/changes/84/377284/1

diff --git a/src/Content/LexemeContent.php b/src/Content/LexemeContent.php
index 5856d90..2f4649a 100644
--- a/src/Content/LexemeContent.php
+++ b/src/Content/LexemeContent.php
@@ -51,24 +51,7 @@
                        throw new LogicException( 'This content object is 
empty!' );
                }
 
-               /** @var Lexeme $lexeme */
-               $lexeme = $this->lexemeHolder->getEntity( Lexeme::class );
-
-               // TODO: This is a test dummy that must be removed later
-               $id = $lexeme->getId()->getSerialization();
-               if ( $id === DemoData\Id::L_HARD ) {
-                       ( new DemoData\HardLexemePopulator() )->populate( 
$lexeme );
-               } elseif ( $id === DemoData\Id::L_LEITER ) {
-                       ( new DemoData\LeiterLexemePopulator() )->populate( 
$lexeme );
-               } elseif ( $id === DemoData\Id::L_ASK_1 ) {
-                       ( new DemoData\AskOut1Populator() )->populate( $lexeme 
);
-               } elseif ( $id === DemoData\Id::L_ASK_2 ) {
-                       ( new DemoData\AskOut2Populator() )->populate( $lexeme 
);
-               } elseif ( $id === DemoData\Id::L_ASK_OUT ) {
-                       ( new DemoData\AskOut3Populator() )->populate( $lexeme 
);
-               }
-
-               return $lexeme;
+               return $this->lexemeHolder->getEntity( Lexeme::class );
        }
 
        /**
diff --git a/src/DataModel/Lexeme.php b/src/DataModel/Lexeme.php
index d6cba22..62977a7 100644
--- a/src/DataModel/Lexeme.php
+++ b/src/DataModel/Lexeme.php
@@ -256,26 +256,10 @@
        }
 
        /**
-        * @param Form[] $forms
-        * @deprecated Temporary method, for demo. Just don't use.
-        */
-       public function setForms( array $forms ) {
-               $this->forms = $forms;
-       }
-
-       /**
         * @return Sense[]
         */
        public function getSenses() {
                return $this->senses;
-       }
-
-       /**
-        * @param Sense[] $senses
-        * @deprecated Only for demonstration purposes. Do not use otherwise!
-        */
-       public function setSenses( array $senses ) {
-               $this->senses = $senses;
        }
 
        /**
diff --git a/src/DemoData/AskOut1Populator.php 
b/src/DemoData/AskOut1Populator.php
deleted file mode 100644
index e0944c1..0000000
--- a/src/DemoData/AskOut1Populator.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-namespace Wikibase\Lexeme\DemoData;
-
-use Wikibase\Lexeme\DataModel\Lexeme;
-use Wikibase\Lexeme\Tests\DataModel\NewSense;
-
-class AskOut1Populator {
-
-       public function populate( Lexeme $lexeme ) {
-               $defaultSense = $this->buildDefaultSense();
-
-               $lexeme->setForms( [] );
-               $lexeme->setSenses( [ $defaultSense ] );
-       }
-
-       /**
-        * @return \Wikibase\Lexeme\DataModel\Sense
-        */
-       private function buildDefaultSense() {
-               return NewSense::havingId( 'S5' )
-                       ->withGloss( 'en', '’To ask somebody out’: To request a 
romantic date' )
-                       ->build();
-       }
-
-}
diff --git a/src/DemoData/AskOut2Populator.php 
b/src/DemoData/AskOut2Populator.php
deleted file mode 100644
index f10315a..0000000
--- a/src/DemoData/AskOut2Populator.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-
-namespace Wikibase\Lexeme\DemoData;
-
-use Wikibase\Lexeme\DataModel\Lexeme;
-use Wikibase\Lexeme\Tests\DataModel\NewSense;
-use Wikibase\Repo\Tests\NewStatement;
-
-class AskOut2Populator {
-
-       public function populate( Lexeme $lexeme ) {
-               $defaultSense = $this->buildDefaultSense();
-
-               $lexeme->setForms( [] );
-               $lexeme->setSenses( [ $defaultSense ] );
-       }
-
-       /**
-        * @return \Wikibase\Lexeme\DataModel\Sense
-        */
-       private function buildDefaultSense() {
-               return NewSense::havingId( 'S5' )
-                       ->withGloss( 'en', 'To request a romantic date' )
-                       ->withStatement(
-                               NewStatement::forProperty( 
Id::P_GRAMMATICAL_FRAME )
-                                       ->withValue( 'to <ask> $somebody out' )
-                                       ->withSomeGuid()
-                       )
-                       ->build();
-       }
-
-}
diff --git a/src/DemoData/AskOut3Populator.php 
b/src/DemoData/AskOut3Populator.php
deleted file mode 100644
index afd8062..0000000
--- a/src/DemoData/AskOut3Populator.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-namespace Wikibase\Lexeme\DemoData;
-
-use Wikibase\Lexeme\DataModel\Lexeme;
-use Wikibase\Lexeme\Tests\DataModel\NewSense;
-
-class AskOut3Populator {
-
-       public function populate( Lexeme $lexeme ) {
-               $defaultSense = $this->buildDefaultSense();
-
-               $lexeme->setForms( [] );
-               $lexeme->setSenses( [ $defaultSense ] );
-       }
-
-       /**
-        * @return \Wikibase\Lexeme\DataModel\Sense
-        */
-       private function buildDefaultSense() {
-               return NewSense::havingId( 'S1' )
-                       ->withGloss( 'en', 'To request a romantic date' )
-                       ->build();
-       }
-
-}
diff --git a/src/DemoData/HardLexemePopulator.php 
b/src/DemoData/HardLexemePopulator.php
deleted file mode 100644
index 5581663..0000000
--- a/src/DemoData/HardLexemePopulator.php
+++ /dev/null
@@ -1,141 +0,0 @@
-<?php
-
-namespace Wikibase\Lexeme\DemoData;
-
-use Wikibase\DataModel\Entity\ItemId;
-use Wikibase\Lexeme\DataModel\Lexeme;
-use Wikibase\Lexeme\Tests\DataModel\NewForm;
-use Wikibase\Lexeme\Tests\DataModel\NewSense;
-use Wikibase\Repo\Tests\NewStatement;
-
-class HardLexemePopulator {
-
-       public function populate( Lexeme $lexeme ) {
-               $hardForm = $this->buildHardForm();
-               $harderForm = $this->buildHarderForm();
-
-               $presentingDifficultySense = 
$this->buildPresentingDifficultySense();
-               $resistingDeformationSense = 
$this->buildResistingDeformationSense();
-
-               $lexeme->setForms( [ $hardForm, $harderForm ] );
-               $lexeme->setSenses( [ $presentingDifficultySense, 
$resistingDeformationSense ] );
-       }
-
-       /**
-        * @return \Wikibase\Lexeme\DataModel\Form
-        */
-       private function buildHardForm() {
-               return NewForm::havingId( 'F1' )
-                       ->andRepresentation( 'en', 'hard' )
-                       ->andGrammaticalFeature( Id::Q_NORMATIVE )
-                       ->andStatement(
-                               NewStatement::forProperty( 
Id::P_IPA_PRONUNCIATION )
-                                       ->withValue( '/hɑːd/' )
-                                       ->withQualifier( Id::P_REGION, new 
ItemId( Id::Q_SCOTLAND ) )
-                                       ->withSomeGuid()
-                       )->andStatement(
-                               NewStatement::forProperty( 
Id::P_IPA_PRONUNCIATION )
-                                       ->withValue( '/hɑɹd/' )
-                                       ->withQualifier(
-                                               Id::P_REGION,
-                                               new ItemId( 
Id::Q_UNITED_STATES_OF_AMERICA )
-                                       )->withSomeGuid()
-                       )->andStatement(
-                               NewStatement::forProperty( 
Id::P_PRONUNCIATION_AUDIO )
-                                       ->withValue( 'hard.ogg' )
-                                       ->withQualifier(
-                                               Id::P_REGION,
-                                               new ItemId( 
Id::Q_UNITED_STATES_OF_AMERICA )
-                                       )->withSomeGuid()
-                       )->andStatement(
-                               NewStatement::forProperty( Id::P_RHYME )
-                                       ->withValue( Id::LF_CARD )
-                                       ->withSomeGuid()
-                       )->andStatement(
-                               NewStatement::forProperty( Id::P_RHYME )
-                                       ->withValue( Id::LF_BARD )
-                                       ->withSomeGuid()
-                       )->build();
-       }
-
-       /**
-        * @return \Wikibase\Lexeme\DataModel\Form
-        */
-       private function buildHarderForm() {
-               return NewForm::havingId( 'F2' )
-                       ->andRepresentation( 'en', 'harder' )
-                       ->andGrammaticalFeature( Id::Q_COMPARATIVE )
-                       ->build();
-       }
-
-       /**
-        * @return \Wikibase\Lexeme\DataModel\Sense
-        */
-       private function buildPresentingDifficultySense() {
-               return NewSense::havingId( 'S1' )
-                       ->withGloss( 'en', 'presenting difficulty' )
-                       ->withGloss( 'de', 'Schwierig oder kompliziert' )
-                       ->withStatement(
-                               NewStatement::forProperty( Id::P_SYNONYM )
-                                       ->withValue( Id::LS_DIFFICULT )
-                                       ->withSomeGuid()
-                       )
-                       ->withStatement(
-                               NewStatement::forProperty( Id::P_REGISTER )
-                                       ->withValue( new ItemId( 
Id::Q_COLLOQUIALISM ) )
-                                       ->withSomeGuid()
-                       )
-                       ->withStatement(
-                               NewStatement::forProperty( Id::P_TRANSLATION )
-                                       ->withValue( Id::LS_SCHWIERIG )
-                                       ->withSomeGuid()
-                       )
-                       ->withStatement(
-                               NewStatement::forProperty( Id::P_TRANSLATION )
-                                       ->withValue( Id::LS_DUR )
-                                       ->withSomeGuid()
-                       )
-                       ->withStatement(
-                               NewStatement::forProperty( Id::P_ANTONYM )
-                                       ->withValue( Id::LS_EASY )
-                                       ->withSomeGuid()
-                       )
-                       ->withStatement(
-                               NewStatement::forProperty( Id::P_ANTONYM )
-                                       ->withValue( Id::LS_SIMPLE )
-                                       ->withSomeGuid()
-                       )
-                       ->build();
-       }
-
-       /**
-        * @return \Wikibase\Lexeme\DataModel\Sense
-        */
-       private function buildResistingDeformationSense() {
-               return NewSense::havingId( 'S2' )
-                       ->withGloss( 'en', 'resisting deformation' )
-                       ->withGloss( 'de', 'schwer verformbar' )
-                       ->withStatement(
-                               NewStatement::forProperty( Id::P_EVOKES )
-                                       ->withValue( new ItemId( 
Id::Q_ELASTICITY ) )
-                                       ->withSomeGuid()
-                       )
-                       ->withStatement(
-                               NewStatement::forProperty( Id::P_EVOKES )
-                                       ->withValue( new ItemId( 
Id::Q_DUCTILITY ) )
-                                       ->withSomeGuid()
-                       )
-                       ->withStatement(
-                               NewStatement::forProperty( Id::P_EVOKES )
-                                       ->withValue( new ItemId( Id::Q_HARDNESS 
) )
-                                       ->withSomeGuid()
-                       )
-                       ->withStatement(
-                               NewStatement::forProperty( Id::P_ANTONYM )
-                                       ->withValue( Id::LS_SOFT )
-                                       ->withSomeGuid()
-                       )
-                       ->build();
-       }
-
-}
diff --git a/src/DemoData/Id.php b/src/DemoData/Id.php
deleted file mode 100644
index b4b3b0f..0000000
--- a/src/DemoData/Id.php
+++ /dev/null
@@ -1,80 +0,0 @@
-<?php
-
-namespace Wikibase\Lexeme\DemoData;
-
-class Id {
-
-       const L_HARD = 'L13';
-       const L_HEARD = 'L14';
-       const L_LEITER = 'L15';
-       const L_LEITERIN = 'L16';
-       const L_ASK_1 = 'L17';
-       const L_ASK_2 = 'L18';
-       const L_ASK_OUT = 'L19';
-
-       const LF_CARD = 'L456-F4';
-       const LF_BARD = 'L888-F1';
-
-       const LS_DIFFICULT = 'L3627-S4';
-       const LS_SCHWIERIG = 'L283-S2';
-       const LS_DUR = 'L465-S1';
-       const LS_EASY = 'L801-S1';
-       const LS_SIMPLE = 'L802-S1';
-       const LS_SOFT = 'L803-S1';
-       const LS_LEADER = 'L15-S1';
-
-       const P_LANGUAGE_CODE = 'P2';
-       const P_INSTANCE_OF = 'P3';
-       const P_LEXEME_PROPERTY = 'P4';
-       const P_HOMOPHONE = 'P6';
-       const P_TRANSLATES_TO = 'P7';
-       const P_DERIVED_FROM = 'P9';
-       const P_IPA_PRONUNCIATION = 'P10';
-       const P_REGION = 'P11';
-       const P_PRONUNCIATION_AUDIO = 'P12';
-       const P_REGISTER = 'P13';
-       const P_EVOKES = 'P14';
-       const P_MORPHOLOGY = 'P15';
-       const P_GRAMMATICAL_GENDER = 'P16';
-       const P_GENDERED_FORM = 'P17';
-       const P_SYLLABIFICATION = 'P18';
-       const P_GRAMMATICAL_FRAME = 'P19';
-       const P_DENOTES = 'P26';
-
-       // Form type
-       const P_RHYME = 'P20';
-       //Sense type
-       const P_SYNONYM = 'P21';
-       const P_TRANSLATION = 'P22';
-       const P_ANTONYM = 'P24';
-       const P_REFERS_TO_SENSE = 'P25';
-
-       const Q_CONDUCTOR = 'Q33';
-       const Q_LEADER = 'Q32';
-       const Q_VERBAL_PHRASE = 'Q31';
-       const Q_FEMALE = 'Q30';
-       const Q_GENITIVE = 'Q29';
-       const Q_SINGULAR = 'Q28';
-       const Q_NOMINATIVE = 'Q27';
-       const Q_MALE = 'Q26';
-       const Q_GERMAN_DECLINATION_W1 = 'Q25';
-       const Q_NORMATIVE = 'Q24';
-       const Q_HARDNESS = 'Q22';
-       const Q_DUCTILITY = 'Q21';
-       const Q_ELASTICITY = 'Q20';
-       const Q_COLLOQUIALISM = 'Q19';
-       const Q_COMPARATIVE = 'Q18';
-       const Q_UNITED_STATES_OF_AMERICA = 'Q17';
-       const Q_SCOTLAND = 'Q16';
-       const Q_OLDENGLISH = 'Q15';
-       const Q_ADJECTIVE = 'Q14';
-       const Q_FORM_ITEM = 'Q9';
-       const Q_NOUN = 'Q8';
-       const Q_GERMAN = 'Q7';
-       const Q_LEXICAL_CATEGORY = 'Q6';
-       const Q_LANGUAGE = 'Q5';
-       const Q_ENGLISH_LANGUAGE = 'Q4';
-       const Q_ENGLISH = 'Q3';
-       const Q_VERB = 'Q2';
-
-}
diff --git a/src/DemoData/LeiterLexemePopulator.php 
b/src/DemoData/LeiterLexemePopulator.php
deleted file mode 100644
index 3eceef9..0000000
--- a/src/DemoData/LeiterLexemePopulator.php
+++ /dev/null
@@ -1,99 +0,0 @@
-<?php
-
-namespace Wikibase\Lexeme\DemoData;
-
-use Wikibase\DataModel\Entity\ItemId;
-use Wikibase\Lexeme\DataModel\Lexeme;
-use Wikibase\Lexeme\Tests\DataModel\NewForm;
-use Wikibase\Lexeme\Tests\DataModel\NewSense;
-use Wikibase\Repo\Tests\NewStatement;
-
-class LeiterLexemePopulator {
-
-       public function populate( Lexeme $lexeme ) {
-               $leiterForm = $this->buildLeiterForm();
-               $leitersForm = $this->buildLeitersForm();
-               $leiterinForm = $this->buildLeiterinForm();
-
-               $leaderSense = $this->buildLeaderSense();
-               $electricalConductorSense = 
$this->buildElectricalConductorSense();
-
-               $lexeme->setForms( [ $leiterForm, $leitersForm, $leiterinForm ] 
);
-               $lexeme->setSenses( [ $leaderSense, $electricalConductorSense ] 
);
-       }
-
-       /**
-        * @return \Wikibase\Lexeme\DataModel\Form
-        */
-       private function buildLeiterForm() {
-               return NewForm::havingId( 'F1' )
-                       ->andRepresentation( 'de', 'Leiter' )
-                       ->andGrammaticalFeature( Id::Q_NOMINATIVE )
-                       ->andGrammaticalFeature( Id::Q_SINGULAR )
-                       ->andStatement(
-                               NewStatement::forProperty( 
Id::P_IPA_PRONUNCIATION )
-                                       ->withValue( '/ˈlaɪ̯tɐ/' )
-                                       ->withSomeGuid()
-                       )->andStatement(
-                               NewStatement::forProperty( 
Id::P_SYLLABIFICATION )
-                                       ->withValue( 'Lei-ter' )
-                                       ->withSomeGuid()
-                       )->build();
-       }
-
-       /**
-        * @return \Wikibase\Lexeme\DataModel\Form
-        */
-       private function buildLeitersForm() {
-               return NewForm::havingId( 'F2' )
-                       ->andRepresentation( 'de', 'Leiters' )
-                       ->andGrammaticalFeature( Id::Q_GENITIVE )
-                       ->andGrammaticalFeature( Id::Q_SINGULAR )
-                       ->build();
-       }
-
-       private function buildLeiterinForm() {
-               return NewForm::havingId( 'F3' )
-                       ->andRepresentation( 'de', 'Leiterin' )
-                       ->andGrammaticalFeature( Id::Q_NOMINATIVE )
-                       ->andGrammaticalFeature( Id::Q_SINGULAR )
-                       ->andGrammaticalFeature( Id::Q_FEMALE )
-                       ->andStatement(
-                               NewStatement::forProperty( 
Id::P_REFERS_TO_SENSE )
-                                       ->withValue( Id::LS_LEADER )
-                                       ->withSomeGuid()
-                       )
-                       ->build();
-       }
-
-       /**
-        * @return \Wikibase\Lexeme\DataModel\Sense
-        */
-       private function buildLeaderSense() {
-               return NewSense::havingId( 'S1' )
-                       ->withGloss( 'de', 'Führungsperson' )
-                       ->withGloss( 'en', 'leader' )
-                       ->withStatement(
-                               NewStatement::forProperty( Id::P_DENOTES )
-                                       ->withValue( new ItemId( Id::Q_LEADER ) 
)
-                                       ->withSomeGuid()
-                       )
-                       ->build();
-       }
-
-       /**
-        * @return \Wikibase\Lexeme\DataModel\Sense
-        */
-       private function buildElectricalConductorSense() {
-               return NewSense::havingId( 'S2' )
-                       ->withGloss( 'de', 'elektrischer Leiter' )
-                       ->withGloss( 'en', 'electrical conductor' )
-                       ->withStatement(
-                               NewStatement::forProperty( Id::P_DENOTES )
-                                       ->withValue( new ItemId( 
Id::Q_CONDUCTOR ) )
-                                       ->withSomeGuid()
-                       )
-                       ->build();
-       }
-
-}

-- 
To view, visit https://gerrit.wikimedia.org/r/377284
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idd8b20fcca349a06f0fb18d92cf2608b113b163e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseLexeme
Gerrit-Branch: master
Gerrit-Owner: Aleksey Bekh-Ivanov (WMDE) <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to