r24289 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24288‎ | r24289 | r24290 >
Date:21:17, 20 July 2007
Author:kim
Status:old
Tags:
Comment:
Now using defining expressions for words that were previously "undefined"
Modified paths:
  • /trunk/extensions/Wikidata/util/missing.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/util/missing.php
@@ -98,10 +98,11 @@
9999 # * don't count deleted stuff (old query did)
100100 # * do 2 joins: between members of collection and target language, and then with english for default, but only for elements having target language expression as NULL (non-existing)
101101 # * this gives us the DM id, the spelling in target language (or NULL, if none), the spelling in English (or NULL, if none)
 102+# (+Kim) Alternately, just try the actual defining expression, which should never be NULL in the first place.
102103 # Warning: some DMs came up in OLPC and Swadesh collections belonging to those collections but having no expressions associated... These are visible in this query
103104
104105 $result = mysql_query("
105 - SELECT member.id, translation_en.spelling_en
 106+ SELECT member.id, translation_dm.spelling_dm
106107 FROM
107108 (
108109 SELECT member_mid as id
@@ -128,37 +129,57 @@
129130 translation.defined_meaning_id = member.id
130131 LEFT JOIN
131132 (
132 - SELECT spelling as spelling_en, defined_meaning_id
133 - FROM uw_syntrans, uw_expression_ns WHERE
134 - uw_expression_ns.expression_id = uw_syntrans.expression_id
135 - AND uw_syntrans.remove_transaction_id IS NULL
136 - AND language_id = 85
137 - AND defined_meaning_id IN
138 - (
139 - SELECT member_mid as id
140 - FROM uw_collection_contents WHERE
141 - collection_id = $collection_esc
142 - AND remove_transaction_id IS NULL
143 - )
144 - ) as translation_en
 133+ SELECT COALESCE(translation_en.spelling_en, translation_dm1.spelling_dm ) as spelling_dm, translation_dm1.defined_meaning_id as defined_meaning_id
 134+ FROM
 135+ (
 136+ SELECT spelling as spelling_dm, defined_meaning_id
 137+ FROM uw_defined_meaning, uw_expression_ns WHERE
 138+ uw_expression_ns.expression_id = uw_defined_meaning.expression_id
 139+ AND uw_defined_meaning.remove_transaction_id IS NULL
 140+ AND uw_expression_ns.remove_transaction_id IS NULL
 141+ AND defined_meaning_id IN
 142+ (
 143+ SELECT member_mid as id
 144+ FROM uw_collection_contents WHERE
 145+ collection_id = $collection_esc
 146+ AND remove_transaction_id IS NULL
 147+ )
 148+ ) as translation_dm1
 149+ LEFT JOIN
 150+ (
 151+ SELECT spelling as spelling_en, defined_meaning_id
 152+ FROM uw_syntrans, uw_expression_ns WHERE
 153+ uw_expression_ns.expression_id = uw_syntrans.expression_id
 154+ AND uw_syntrans.remove_transaction_id IS NULL
 155+ AND language_id = 85
 156+ AND defined_meaning_id IN
 157+ (
 158+ SELECT member_mid as id
 159+ FROM uw_collection_contents WHERE
 160+ collection_id = $collection_esc
 161+ AND remove_transaction_id IS NULL
 162+ )
 163+ ) as translation_en
 164+ ON translation_dm1.defined_meaning_id=translation_en.defined_meaning_id
 165+ ) as translation_dm
145166 ON
146 - translation_en.defined_meaning_id = member.id
 167+ translation_dm.defined_meaning_id = member.id
147168 WHERE translation.spelling IS NULL
148 - ORDER BY spelling_en
 169+ ORDER BY spelling_dm
149170 ")or die ("error ".mysql_error());
150171
151172
152173 while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
153174 $id=$row[0];
154 - $spelling_en=$row[1];
 175+ $spelling_dm=$row[1];
155176
156177 # Malafaya: Not translated to target language
157 - if ($spelling_en == null)
 178+ if ($spelling_dm == null)
158179 # Malafaya: Not translated to English either; use a placeholder expression
159180 print "<a href=\"../../../index.php?title=DefinedMeaning:(untranslated)_($id)\">(untranslated)</a>;\n";
160181 else
161182 # Malafaya: English translation exists; use it
162 - print "<a href=\"../../../index.php?title=DefinedMeaning:".$spelling_en."_($id)\">$spelling_en</a>;\n";
 183+ print "<a href=\"../../../index.php?title=DefinedMeaning:".$spelling_dm."_($id)\">$spelling_dm</a>;\n";
163184 }
164185 print "<br>\n";
165186

Status & tagging log