r49519 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49518‎ | r49519 | r49520 >
Date:19:54, 15 April 2009
Author:yaron
Status:deferred
Tags:
Comment:
Filter's is_relation field default changed to 'true', check changed from
'SMWSQLStore2' to 'SMWSQLStore' to accomodate Halo 1.4
Modified paths:
  • /trunk/extensions/SemanticDrilldown/includes/SD_Filter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticDrilldown/includes/SD_Filter.php
@@ -24,7 +24,7 @@
2525 if (count($properties_used) > 0) {
2626 $f->property = $properties_used[0];
2727 }
28 - $f->is_relation = false;
 28+ $f->is_relation = true;
2929 $proptitle = Title::newFromText($f->property, SMW_NS_PROPERTY);
3030 if ($proptitle != NULL) {
3131 $store = smwfGetStore();
@@ -36,9 +36,10 @@
3737 global $smwgContLang;
3838 $datatypeLabels = $smwgContLang->getDatatypeLabels();
3939 if (count($types) > 0) {
40 - if ($types[0]->getWikiValue() == $datatypeLabels['_wpg']) {
41 - $f->is_relation = true;
42 - } elseif ($types[0]->getWikiValue() == $datatypeLabels['_boo']) {
 40+ if ($types[0]->getWikiValue() != $datatypeLabels['_wpg']) {
 41+ $f->is_relation = false;
 42+ }
 43+ if ($types[0]->getWikiValue() == $datatypeLabels['_boo']) {
4344 $f->is_boolean = true;
4445 }
4546 }
@@ -86,26 +87,26 @@
8788 } else {
8889 $fields = "YEAR(value_xsd)";
8990 }
90 - if ($smwgDefaultStore == 'SMWSQLStore2') {
91 - $smw_attributes = $dbr->tableName( 'smw_atts2' );
92 - $smw_ids = $dbr->tableName( 'smw_ids' );
 91+ if ($smwgDefaultStore == 'SMWSQLStore') {
 92+ $smw_attributes = $dbr->tableName( 'smw_attributes' );
9393 $sql =<<<END
9494 SELECT $fields, count(*)
9595 FROM semantic_drilldown_values sdv
96 - JOIN $smw_attributes a ON sdv.id = a.s_id
97 - JOIN $smw_ids p_ids ON a.p_id = p_ids.smw_id
98 - WHERE p_ids.smw_title = '$property_value'
 96+ JOIN $smw_attributes a ON sdv.id = a.subject_id
 97+ WHERE a.attribute_title = '$property_value'
9998 GROUP BY $fields
10099 ORDER BY $fields
101100
102101 END;
103102 } else {
104 - $smw_attributes = $dbr->tableName( 'smw_attributes' );
 103+ $smw_attributes = $dbr->tableName( 'smw_atts2' );
 104+ $smw_ids = $dbr->tableName( 'smw_ids' );
105105 $sql =<<<END
106106 SELECT $fields, count(*)
107107 FROM semantic_drilldown_values sdv
108 - JOIN $smw_attributes a ON sdv.id = a.subject_id
109 - WHERE a.attribute_title = '$property_value'
 108+ JOIN $smw_attributes a ON sdv.id = a.s_id
 109+ JOIN $smw_ids p_ids ON a.p_id = p_ids.smw_id
 110+ WHERE p_ids.smw_title = '$property_value'
110111 GROUP BY $fields
111112 ORDER BY $fields
112113
@@ -135,10 +136,10 @@
136137 global $smwgDefaultStore;
137138 if ($this->time_period != NULL) {
138139 return $this->getTimePeriodValues();
139 - } elseif ($smwgDefaultStore == 'SMWSQLStore2') {
 140+ } elseif ($smwgDefaultStore == 'SMWSQLStore') {
 141+ return $this->getAllValues_orig();
 142+ } else {
140143 return $this->getAllValues_2();
141 - } else {
142 - return $this->getAllValues_orig();
143144 }
144145 }
145146
@@ -227,10 +228,10 @@
228229 */
229230 function createTempTable() {
230231 global $smwgDefaultStore;
231 - if ($smwgDefaultStore == 'SMWSQLStore2') {
 232+ if ($smwgDefaultStore == 'SMWSQLStore') {
 233+ $this->createTempTable_orig();
 234+ } else {
232235 $this->createTempTable_2();
233 - } else {
234 - $this->createTempTable_orig();
235236 }
236237 }
237238

Status & tagging log