r60723 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60722‎ | r60723 | r60724 >
Date:10:43, 6 January 2010
Author:mkroetzsch
Status:deferred
Tags:
Comment:
remov special handling of n-ary properties (and, when applicable, use lists instead)
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Property.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Types.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_QueryResult.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_QueryResult.php
@@ -268,13 +268,13 @@
269269 case SMWPrintRequest::PRINT_PROP:
270270 $this->m_content = $this->m_store->getPropertyValues($this->m_result,$this->m_printrequest->getData(), $this->getRequestOptions(), $this->m_printrequest->getOutputFormat());
271271 // Print one component of a multi-valued string.
272 - // Known limitation: the printrequest still is of type __nry, so if printers check
 272+ // Known limitation: the printrequest still is of type _lst, so if printers check
273273 // for this then they will not recognize that it returns some more concrete type
274 - if (($this->m_printrequest->getTypeID() == '__nry') && ($this->m_printrequest->getParameter('index') !== false)) {
 274+ if (($this->m_printrequest->getTypeID() == '_lst') && ($this->m_printrequest->getParameter('index') !== false)) {
275275 $pos = $this->m_printrequest->getParameter('index')-1;
276276 $newcontent = array();
277 - foreach ($this->m_content as $naryval) {
278 - $dvs = $naryval->getDVs();
 277+ foreach ($this->m_content as $listdv) {
 278+ $dvs = $listdv->getDVs();
279279 if ( (array_key_exists($pos,$dvs)) && ($dvs[$pos] !== NULL) ) {
280280 $newcontent[] = $dvs[$pos];
281281 }
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Property.php
@@ -289,7 +289,7 @@
290290 $result = SMWDataValueFactory::newTypeIDValue('__typ');
291291 if (array_key_exists($this->m_propertyid, SMWPropertyValue::$m_propertytypes)) {
292292 $result->setDBkeys(array(SMWPropertyValue::$m_propertytypes[$this->m_propertyid][0]));
293 - } else { // fixed default for special properties
 293+ } else { // fixed default type (should rarely matter)
294294 $result->setDBkeys(array('_str'));
295295 }
296296 }
@@ -298,14 +298,14 @@
299299 }
300300
301301 /**
302 - * Quickly get the type id of some property without necessarily making another datavalue.
303 - * Note that this is not the same as getTypeID(), which returns the id of this property
304 - * datavalue.
 302+ * Quickly get the type id of some property without necessarily making
 303+ * another datavalue. Note that this is not the same as getTypeID(), which
 304+ * returns the id of this property datavalue.
305305 */
306306 public function getPropertyTypeID() {
307307 if ($this->prop_typeid === NULL) {
308308 $type = $this->getTypesValue();
309 - $this->prop_typeid = $type->isUnary()?$type->getDBkey():'__nry';
 309+ $this->prop_typeid = $type->getDBkey();
310310 }
311311 return $this->prop_typeid;
312312 }
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Types.php
@@ -13,6 +13,8 @@
1414 * wiki values, in order to support speedy creation of datavalues in
1515 * SMWDataValueFactory.
1616 *
 17+ * @todo This class has an own stubbing mechanism that is older than the
 18+ * current one used in SMWDataValue. It is confusing to have two.
1719 * @author Markus Krötzsch
1820 * @ingroup SMWDataValues
1921 */
@@ -190,10 +192,9 @@
191193 /**
192194 * Convenience method to obtain the (single) DB key as a string (not in an array).
193195 * Provided since many callers can use this hash for type recognition and registry.
194 - *
195196 */
196197 public function getDBkey() {
197 - if ($this->m_xsdvalue === false) {
 198+ if ( $this->isvalid() && ($this->m_xsdvalue === false) ) {
198199 $first = true;
199200 $this->m_xsdvalue = '';
200201 foreach ($this->m_typelabels as $label) {

Status & tagging log