Kipcool has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/54096


Change subject: Added new collection type LANG for language-specific 
annotations.
......................................................................

Added new collection type LANG
for language-specific annotations.

Change-Id: I229ec4b3a8ce6f7fd5c3f992b11022231d46abba
---
R Console/databaseTemplate.sql
R Console/install.php
M OmegaWiki/SpecialAddCollection.php
M OmegaWiki/WikiDataAPI.php
4 files changed, 31 insertions(+), 20 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikiLexicalData 
refs/changes/96/54096/1

diff --git a/Console/wikidataTemplate.sql b/Console/databaseTemplate.sql
similarity index 99%
rename from Console/wikidataTemplate.sql
rename to Console/databaseTemplate.sql
index d70463a..023e1d3 100644
--- a/Console/wikidataTemplate.sql
+++ b/Console/databaseTemplate.sql
@@ -1,7 +1,7 @@
 --
 -- Add the wikidata specific namespaces
 --
- 
+
 CREATE TABLE IF NOT EXISTS language (
   language_id int(10) NOT NULL auto_increment,
   dialect_of_lid int(10) NOT NULL default '0',
@@ -301,5 +301,4 @@
   KEY /*$wgWDprefix*/versioned_start_object 
(`add_transaction_id`,`object_id`,`attribute_mid`,`value_id`),
   KEY /*$wgWDprefix*/versioned_start_attribute 
(`add_transaction_id`,`attribute_mid`,`object_id`,`value_id`),
   KEY /*$wgWDprefix*/versioned_start_value (`add_transaction_id`,`value_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;  
-
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
diff --git a/Console/installWikidata.php b/Console/install.php
similarity index 90%
rename from Console/installWikidata.php
rename to Console/install.php
index c19707e..6dcf675 100644
--- a/Console/installWikidata.php
+++ b/Console/install.php
@@ -1,7 +1,7 @@
 <?php
 
 /**
-* Maintenance script to create a wikidata extension for mediawiki
+* Maintenance script to create a WikiLexicalData extension for mediawiki
 * it generates the tables in a database (passed as parameter) with a defined 
prefix (passed as parameter)
 */
 
@@ -10,15 +10,15 @@
 
 echo "start\n";
 
-class InstallWikidata extends Maintenance {
+class InstallWikiLexicalData extends Maintenance {
 
        public function __construct() {
                parent::__construct();
-               $this->mDescription = "Install Wikidata by creating the tables 
and filling them with the minimal necessary data\n"
-                       . 'Example usage: php installWikidata.php --prefix=uw '
+               $this->mDescription = "Installation by creating the tables and 
filling them with the minimal necessary data\n"
+                       . 'Example usage: php install.php --prefix=uw '
                        . '--template=wikidataTemplate.sql 
--datasetname="OmegaWiki community"' ;
-               $this->addOption( 'prefix', 'The prefix to use for Wikidata 
relational tables. e.g. --prefix=uw' );
-               $this->addOption( 'template', 'A sql template describing the 
relational tables. e.g. --template=wikidataTemplate.sql' );
+               $this->addOption( 'prefix', 'The prefix to use for the 
relational tables. e.g. --prefix=uw' );
+               $this->addOption( 'template', 'A sql template describing the 
relational tables. e.g. --template=databaseTemplate.sql' );
                $this->addOption( 'datasetname', 'A name for your dataset. e.g. 
--datasetname="OmegaWiki community"' );
        }
 
@@ -32,7 +32,7 @@
                        exit(0);
                }
                if ( !$this->hasOption( 'template' ) ) {
-                       $this->output( "A template is missing. Use for example 
--template=wikidataTemplate.sql\n");
+                       $this->output( "A template is missing. Use for example 
--template=databaseTemplate.sql\n");
                        exit(0);
                }
 
@@ -41,7 +41,7 @@
                $datasetname = $this->getOption( 'datasetname' );
                $wdCurrentContext = $prefix ;
 
-               $this->output( "Creating Wikidata tables...\n" );
+               $this->output( "Creating relational tables...\n" );
 
                $this->ReadTemplateSQLFile( "/*\$wgWDprefix*/", $prefix . "_", 
dirname( __FILE__ ) . DIRECTORY_SEPARATOR . $template );
 
@@ -128,27 +128,25 @@
        protected function enableAnnotations( $dc ) {
                // Admin user
                $userId = 1 ;
-               $dbw = wfGetDB( DB_MASTER );
 
                startNewTransaction( $userId, 0, "Script bootstrap class 
attribute meanings", $dc );
 
                // a collection of classes. A word added to that collection 
becomes a class
-               $lexicalCollectionId = bootstrapCollection( "lexical 
functionality", WLD_ENGLISH_LANG_ID, "CLAS", $dc );
+               $classCollectionId = bootstrapCollection( "Community class", 
WLD_ENGLISH_LANG_ID, "CLAS", $dc );
 
                // a collection of iso639-3 codes, to enable translation of the 
interface
                // and language specific annotations
-               $iso6393CollectionId = bootstrapCollection( "ISO 639-3 codes", 
WLD_ENGLISH_LANG_ID, "", $dc );
+               $iso6393CollectionId = bootstrapCollection( "ISO 639-3 codes", 
WLD_ENGLISH_LANG_ID, "LANG", $dc );
 
                // DM lexical item, a class by default for every word
                $lexicalItemDMId = $this->bootstrapDefinedMeaning( "lexical 
item", WLD_ENGLISH_LANG_ID, "Lexical item is used as a class by default." );
-               addDefinedMeaningToCollection( $lexicalItemDMId, 
$lexicalCollectionId, "" );
+               addDefinedMeaningToCollection( $lexicalItemDMId, 
$classCollectionId, "" );
 
                // DM English, a class by default for English words
                $englishDMId = $this->bootstrapDefinedMeaning( "English", 
WLD_ENGLISH_LANG_ID,
                        "A West-Germanic language originating in England but 
now spoken in all parts of the British Isles,"
                        . " the Commonwealth of Nations, the United States of 
America, and other parts of the world."
                );
-               addDefinedMeaningToCollection( $englishDMId, 
$lexicalCollectionId, "" );
                addDefinedMeaningToCollection( $englishDMId, 
$iso6393CollectionId, "eng" );
 
                echo "**\n";
@@ -239,5 +237,5 @@
 
 }
 
-$maintClass = 'InstallWikidata';
-require_once( RUN_MAINTENANCE_IF_MAIN );
\ No newline at end of file
+$maintClass = 'InstallWikiLexicalData';
+require_once( RUN_MAINTENANCE_IF_MAIN );
diff --git a/OmegaWiki/SpecialAddCollection.php 
b/OmegaWiki/SpecialAddCollection.php
index 4d2678e..fad725b 100644
--- a/OmegaWiki/SpecialAddCollection.php
+++ b/OmegaWiki/SpecialAddCollection.php
@@ -38,11 +38,25 @@
                        $datasetarray[$datasetid] = $dataset->fetchName();
                }
 
+               // CLAS: an object added to a collection of type CLAS becomes a 
class (e.g. animal)
+               // Then, objects can be attached to that class to give them 
class-specific attributes (e.g. species)
+               // LANG: an object added to a collection of type LANG is 
considered as a language
+               // which allows one to add lang-specific attributes (such as 
defining "part of speech" for that language
+               // so, it acts a bit like a class, but it is not possible to 
attach an object to that class manually
+               // this is done automatically when a word is known to belong to 
a language.
+               $collectionTypes = array(
+                       '' => 'None',
+                       'CLAS' => 'CLAS',
+                       'LANG' => 'LANG',
+                       'LEVL' => 'LEVL',
+                       'MAPP' => 'MAPP',
+                       'RELT' => 'RELT'
+               );
                $wgOut->addHTML( getOptionPanel(
                        array(
                                'Collection name:' => getTextBox( 'collection' 
),
                                'Language of name:' => getSuggest( 'language', 
'language' ),
-                               'Collection type:' => getSelect( 'type', array( 
'' => 'None', 'RELT' => 'RELT', 'LEVL' => 'LEVL', 'CLAS' => 'CLAS', 'MAPP' => 
'MAPP' ) ),
+                               'Collection type:' => getSelect( 'type', 
$collectionTypes ),
                                'Dataset:' => getSelect( 'dataset', 
$datasetarray )
                        ),
                        '', array( 'create' => wfMsg( 'ow_create' ) )
diff --git a/OmegaWiki/WikiDataAPI.php b/OmegaWiki/WikiDataAPI.php
index 02365e8..06409b9 100644
--- a/OmegaWiki/WikiDataAPI.php
+++ b/OmegaWiki/WikiDataAPI.php
@@ -1706,7 +1706,7 @@
                array(),
                array( 'col' => array( 'INNER JOIN', array(
                        'col.collection_id = cont.collection_id',
-                       'col.collection_type' => 'CLAS',
+                       'col.collection_type' => array( 'CLAS', 'LANG' ),
                        'col.remove_transaction_id' => null
                )))
        );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I229ec4b3a8ce6f7fd5c3f992b11022231d46abba
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikiLexicalData
Gerrit-Branch: master
Gerrit-Owner: Kipcool <[email protected]>

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

Reply via email to