/**
  * Get the serialization for the provided data item.
  *
  * @since 1.7
  *
  * @param SMWDataItem $dataItem
  *
  * @return mixed
  */
 public static function getSerialization(DataItem $dataItem, $printRequest = null)
 {
     $result = array();
     switch ($dataItem->getDIType()) {
         case DataItem::TYPE_WIKIPAGE:
             $title = $dataItem->getTitle();
             $result = array('fulltext' => $title->getFullText(), 'fullurl' => $title->getFullUrl(), 'namespace' => $title->getNamespace(), 'exists' => $title->isKnown());
             break;
         case DataItem::TYPE_NUMBER:
             // dataitems and datavalues
             // Quantity is a datavalue type that belongs to dataitem
             // type number which means in order to identify the correct
             // unit, we have re-factor the corresponding datavalue otherwise
             // we will not be able to determine the unit
             // (unit is part of the datavalue object)
             if ($printRequest !== null && $printRequest->getTypeID() === '_qty') {
                 $diProperty = $printRequest->getData()->getDataItem();
                 $dataValue = DataValueFactory::getInstance()->newDataItemValue($dataItem, $diProperty);
                 $result = array('value' => $dataValue->getNumber(), 'unit' => $dataValue->getUnit());
             } else {
                 $result = $dataItem->getNumber();
             }
             break;
         case DataItem::TYPE_GEO:
             $result = $dataItem->getCoordinateSet();
             break;
         case DataItem::TYPE_TIME:
             $result = $dataItem->getMwTimestamp();
             break;
         default:
             $result = $dataItem->getSerialization();
             break;
     }
     return $result;
 }
 public function equals(SMWDataItem $di)
 {
     if ($di->getDIType() !== SMWDataItem::TYPE_BOOLEAN) {
         return false;
     }
     return $di->getBoolean() === $this->m_boolean;
 }
Exemple #3
0
 public function equals(SMWDataItem $di)
 {
     if ($di->getDIType() !== SMWDataItem::TYPE_ERROR) {
         return false;
     }
     return $di->getSerialization() === $this->getSerialization();
 }
Exemple #4
0
 public function equals(SMWDataItem $di)
 {
     if ($di->getDIType() !== SMWDataItem::TYPE_NUMBER) {
         return false;
     }
     return $di->getNumber() === $this->m_number;
 }
 /**
  * @see DataValue::loadDataItem
  *
  * @param DataItem $dataItem
  *
  * @return boolean
  */
 protected function loadDataItem(DataItem $dataItem)
 {
     if ($dataItem->getDIType() !== DataItem::TYPE_BOOLEAN) {
         return false;
     }
     $this->m_dataitem = $dataItem;
     $this->m_caption = $this->getStandardCaption(true);
     return true;
 }
	/**
	 * @see SMWDataValue::loadDataItem()
	 * @param $dataitem SMWDataItem
	 * @return boolean
	 */
	protected function loadDataItem( SMWDataItem $dataItem ) {
		if ( $dataItem->getDIType() == SMWDataItem::TYPE_CONCEPT ) {
			$this->m_dataitem = $dataItem;
			$this->m_caption = $dataItem->getConceptQuery(); // probably useless
			return true;
		} else {
			return false;
		}
	}
Exemple #7
0
 /**
  * @see SMWDataValue::loadDataItem()
  * @param $dataitem SMWDataItem
  * @return boolean
  */
 protected function loadDataItem(SMWDataItem $dataItem)
 {
     if ($dataItem->getDIType() == SMWDataItem::TYPE_ERROR) {
         $this->addError($dataItem->getErrors());
         $this->m_caption = $this->getErrorText();
         return true;
     } else {
         return false;
     }
 }
Exemple #8
0
 /**
  * @see SMWDataValue::loadDataItem()
  * @param $dataitem SMWDataItem
  * @return boolean
  */
 protected function loadDataItem(SMWDataItem $dataItem)
 {
     if ($dataItem->getDIType() == SMWDataItem::TYPE_BOOLEAN) {
         $this->m_dataitem = $dataItem;
         $this->m_caption = $this->getStandardCaption(true);
         // use default for this language
         return true;
     } else {
         return false;
     }
 }
 /**
  * @see SMWDataValue::setDataItem()
  * 
  * @since 1.0
  * 
  * @param $dataitem SMWDataItem
  * 
  * @return boolean
  */
 protected function loadDataItem(SMWDataItem $dataItem)
 {
     if ($dataItem->getDIType() == SMWDataItem::TYPE_GEO) {
         $this->m_dataitem = $dataItem;
         global $smgQPCoodFormat, $smgQPCoodDirectional;
         $this->wikiValue = MapsCoordinateParser::formatCoordinates($dataItem->getCoordinateSet(), $smgQPCoodFormat, $smgQPCoodDirectional);
         return true;
     } else {
         return false;
     }
 }
 /**
  * Get the serialization for the provided data item.
  *
  * @since 1.7
  *
  * @param SMWDataItem $dataItem
  *
  * @return mixed
  */
 public static function getSerialization(DataItem $dataItem, $printRequest = null)
 {
     switch ($dataItem->getDIType()) {
         case DataItem::TYPE_WIKIPAGE:
             // Support for a deserializable _rec type with 0.6
             if ($printRequest !== null && strpos($printRequest->getTypeID(), '_rec') !== false) {
                 $recordValue = DataValueFactory::getInstance()->newDataValueByItem($dataItem, $printRequest->getData()->getDataItem());
                 $recordDiValues = array();
                 foreach ($recordValue->getPropertyDataItems() as $property) {
                     $label = $property->getLabel();
                     $recordDiValues[$label] = array('label' => $label, 'key' => $property->getKey(), 'typeid' => $property->findPropertyTypeID(), 'item' => array());
                     foreach ($recordValue->getDataItem()->getSemanticData()->getPropertyValues($property) as $value) {
                         $recordDiValues[$label]['item'][] = self::getSerialization($value);
                     }
                 }
                 $result = $recordDiValues;
             } else {
                 $title = $dataItem->getTitle();
                 $wikiPageValue = DataValueFactory::getInstance()->newDataValueByItem($dataItem);
                 $result = array('fulltext' => $title->getFullText(), 'fullurl' => $title->getFullUrl(), 'namespace' => $title->getNamespace(), 'exists' => strval($title->isKnown()), 'displaytitle' => $wikiPageValue->getDisplayTitle());
             }
             break;
         case DataItem::TYPE_NUMBER:
             // dataitems and datavalues
             // Quantity is a datavalue type that belongs to dataitem
             // type number which means in order to identify the correct
             // unit, we have re-factor the corresponding datavalue otherwise
             // we will not be able to determine the unit
             // (unit is part of the datavalue object)
             if ($printRequest !== null && $printRequest->getTypeID() === '_qty') {
                 $diProperty = $printRequest->getData()->getDataItem();
                 $dataValue = DataValueFactory::getInstance()->newDataValueByItem($dataItem, $diProperty);
                 $result = array('value' => $dataValue->getNumber(), 'unit' => $dataValue->getUnit());
             } else {
                 $result = $dataItem->getNumber();
             }
             break;
         case DataItem::TYPE_GEO:
             $result = $dataItem->getCoordinateSet();
             break;
         case DataItem::TYPE_TIME:
             $result = array('timestamp' => $dataItem->getMwTimestamp(), 'raw' => $dataItem->getSerialization());
             break;
         default:
             $result = $dataItem->getSerialization();
             break;
     }
     return $result;
 }
Exemple #11
0
 /**
  * @see SMWDataValue::loadDataItem()
  * @param $dataitem SMWDataItem
  * @return boolean
  */
 protected function loadDataItem(SMWDataItem $dataItem)
 {
     $diType = $this->m_typeid == '_txt' || $this->m_typeid == '_cod' ? SMWDataItem::TYPE_BLOB : SMWDataItem::TYPE_STRING;
     if ($dataItem->getDIType() == $diType) {
         $this->m_dataitem = $dataItem;
         if ($this->m_typeid == '_cod') {
             $this->m_caption = $this->getCodeDisplay($this->m_dataitem->getString());
         } else {
             $this->m_caption = $this->m_dataitem->getString();
         }
         return true;
     } else {
         return false;
     }
 }
 /**
  * @see SMWDataValue::loadDataItem()
  *
  * @param $dataitem SMWDataItem
  *
  * @return boolean
  */
 protected function loadDataItem(SMWDataItem $dataItem)
 {
     if ($dataItem->getDIType() == SMWDataItem::TYPE_STRING) {
         $this->m_dataitem = $dataItem;
         $this->m_diProperties = array();
         foreach (explode(';', $dataItem->getString()) as $propertyKey) {
             try {
                 $this->m_diProperties[] = new SMWDIProperty($propertyKey);
             } catch (SMWDataItemException $e) {
                 $this->m_diProperties[] = new SMWDIProperty('Error');
                 $this->addError(wfMsgForContent('smw_parseerror'));
             }
         }
         $this->m_caption = false;
         return true;
     } else {
         return false;
     }
 }
 /**
  * Get the serialization for the provided data item.
  *
  * @since 1.7
  *
  * @param SMWDataItem $dataItem
  *
  * @return mixed
  */
 public static function getSerialization(SMWDataItem $dataItem)
 {
     switch ($dataItem->getDIType()) {
         case SMWDataItem::TYPE_WIKIPAGE:
             $title = $dataItem->getTitle();
             $result = array('fulltext' => $title->getFullText(), 'fullurl' => $title->getFullUrl());
             break;
         case SMWDataItem::TYPE_NUMBER:
             $result = $dataItem->getNumber();
             break;
         case SMWDataItem::TYPE_GEO:
             $result = $dataItem->getCoordinateSet();
             break;
         case SMWDataItem::TYPE_TIME:
             $result = $dataItem->getMwTimestamp();
             break;
         default:
             $result = $dataItem->getSerialization();
             break;
     }
     return $result;
 }
 /**
  * @see SMWDataValue::loadDataItem()
  * @param $dataitem SMWDataItem
  * @return boolean
  */
 protected function loadDataItem(SMWDataItem $dataItem)
 {
     if ($dataItem->getDIType() == SMWDataItem::TYPE_CONTAINER) {
         $this->m_dataitem = $dataItem;
         return true;
     } elseif ($dataItem->getDIType() == SMWDataItem::TYPE_WIKIPAGE) {
         $semanticData = new SMWContainerSemanticData($dataItem);
         $semanticData->copyDataFrom(\SMW\StoreFactory::getStore()->getSemanticData($dataItem));
         $this->m_dataitem = new SMWDIContainer($semanticData);
         return true;
     } else {
         return false;
     }
 }
Exemple #15
0
 /**
  * Create an SWMExpElement that encodes auxiliary data for representing
  * values of the specified dataitem object in a simplified fashion.
  * This is done for types of dataitems that are not supported very well
  * in current systems, or that do not match a standard datatype in RDF.
  * For example, time points (DITime) are encoded as numbers. The number
  * can replace the actual time for all query and ordering purposes (the
  * order in either case is linear and maps to the real number line).
  * Only data retrieval should better use the real values to avoid that
  * rounding errors lead to unfaithful recovery of data. Note that the
  * helper values do not maintain any association with their original
  * values -- they are a fully redundant alternative representation, not
  * an additional piece of information for the main values. Even if
  * decoding is difficult, they must be in one-to-one correspondence to
  * the original value.
  *
  * For dataitems that do not have such a simplification, the method
  * returns null.
  *
  * @note If a helper element is used, then it must be the same as
  * getDataItemHelperExpElement( $dataItem->getSortKeyDataItem() ).
  * Query conditions like ">" use sortkeys for values, and helper
  * elements are always preferred in query answering.
  *
  * @param $dataItem SMWDataItem
  * @return SMWExpElement or null
  */
 public static function getDataItemHelperExpElement(SMWDataItem $dataItem)
 {
     if ($dataItem->getDIType() == SMWDataItem::TYPE_TIME) {
         $lit = new SMWExpLiteral($dataItem->getSortKey(), 'http://www.w3.org/2001/XMLSchema#double', $dataItem);
         return $lit;
     } else {
         return null;
     }
 }
Exemple #16
0
 /**
  * @see SMWDataValue::loadDataItem()
  * @param $dataitem SMWDataItem
  * @return boolean
  */
 protected function loadDataItem(SMWDataItem $dataItem)
 {
     if ($dataItem->getDIType() == SMWDataItem::TYPE_PROPERTY) {
         $this->m_dataitem = $dataItem;
         $this->mPropTypeValue = null;
         unset($this->m_wikipage);
         $this->m_caption = false;
         return true;
     } else {
         return false;
     }
 }
 /**
  * Implementation of SMWStore::getInProperties(). This function is meant to
  * be used for finding properties that link to wiki pages.
  *
  * @since 1.8
  * @see SMWStore::getInProperties
  *
  * @param SMWDataItem $value
  * @param SMWRequestOptions|null $requestOptions
  *
  * @return array of SMWWikiPageValue
  */
 public function getInProperties(SMWDataItem $value, SMWRequestOptions $requestOptions = null)
 {
     $db = $this->store->getConnection();
     $result = array();
     // Potentially need to get more results, since options apply to union.
     if ($requestOptions !== null) {
         $subOptions = clone $requestOptions;
         $subOptions->limit = $requestOptions->limit + $requestOptions->offset;
         $subOptions->offset = 0;
     } else {
         $subOptions = null;
     }
     $diType = $value->getDIType();
     foreach ($this->store->getPropertyTables() as $proptable) {
         if ($diType != $proptable->getDiType()) {
             continue;
         }
         $where = $from = '';
         if (!$proptable->isFixedPropertyTable()) {
             // join ID table to get property titles
             $from = $db->tableName(SMWSql3SmwIds::TABLE_NAME) . " INNER JOIN " . $db->tableName($proptable->getName()) . " AS t1 ON t1.p_id=smw_id";
             $this->prepareValueQuery($from, $where, $proptable, $value, 1);
             $where .= " AND smw_iw!=" . $db->addQuotes(SMW_SQL3_SMWIW_OUTDATED) . " AND smw_iw!=" . $db->addQuotes(SMW_SQL3_SMWDELETEIW);
             $res = $db->select($from, 'DISTINCT smw_title,smw_sortkey,smw_iw', $where . $this->store->getSQLConditions($subOptions, 'smw_sortkey', 'smw_sortkey', $where !== ''), __METHOD__, $this->store->getSQLOptions($subOptions, 'smw_sortkey'));
             foreach ($res as $row) {
                 try {
                     $result[] = new SMW\DIProperty($row->smw_title);
                 } catch (SMWDataItemException $e) {
                     // has been observed to happen (empty property title); cause unclear; ignore this data
                 }
             }
         } else {
             $from = $db->tableName($proptable->getName()) . " AS t1";
             $this->prepareValueQuery($from, $where, $proptable, $value, 1);
             $res = $db->select($from, '*', $where, __METHOD__, array('LIMIT' => 1));
             if ($db->numRows($res) > 0) {
                 $result[] = new SMW\DIProperty($proptable->getFixedProperty());
             }
         }
         $db->freeResult($res);
     }
     $result = $this->store->applyRequestOptions($result, $requestOptions);
     // apply options to overall result
     return $result;
 }
 public function equals(SMWDataItem $di)
 {
     if ($di->getDIType() !== SMWDataItem::TYPE_TIME) {
         return false;
     }
     return $di->getSortKey() === $this->getSortKey();
 }
 /**
  * Implementation of SMWStore::getInProperties(). This function is meant to
  * be used for finding properties that link to wiki pages.
  * 
  * @see SMWStore::getInProperties
  * 
  * TODO: When used for other datatypes, the function may return too many
  * properties since it selects results by comparing the stored information
  * (DB keys) only, while not currently comparing the type of the returned
  * property to the type of the queried data. So values with the same DB keys
  * can be confused. This is a minor issue now since no code is known to use
  * this function in cases where this occurs.
  *
  * @param SMWDataItem $value
  * @param SMWRequestOptions $requestoptions
  * 
  * @return array of SMWWikiPageValue
  */
 public function getInProperties(SMWDataItem $value, $requestoptions = null)
 {
     wfProfileIn("SMWSQLStore2::getInProperties (SMW)");
     $db = wfGetDB(DB_SLAVE);
     $result = array();
     // Potentially need to get more results, since options apply to union.
     if ($requestoptions !== null) {
         $suboptions = clone $requestoptions;
         $suboptions->limit = $requestoptions->limit + $requestoptions->offset;
         $suboptions->offset = 0;
     } else {
         $suboptions = null;
     }
     $tableIds = self::findAllDiTypeTableIds($value->getDIType());
     $proptables = self::getPropertyTables();
     foreach ($tableIds as $tid) {
         $proptable = $proptables[$tid];
         $where = $from = '';
         if ($proptable->fixedproperty == false) {
             // join smw_ids to get property titles
             $from = $db->tableName('smw_ids') . " INNER JOIN " . $db->tableName($proptable->name) . " AS t1 ON t1.p_id=smw_id";
             $this->prepareValueQuery($from, $where, $proptable, $value, 1);
             $res = $db->select($from, 'DISTINCT smw_title,smw_sortkey', $where . $this->getSQLConditions($suboptions, 'smw_sortkey', 'smw_sortkey', $where !== ''), 'SMW::getInProperties', $this->getSQLOptions($suboptions, 'smw_sortkey'));
             foreach ($res as $row) {
                 try {
                     $result[] = new SMWDIProperty($row->smw_title);
                 } catch (SMWDataItemException $e) {
                     // has been observed to happen (empty property title); cause unclear; ignore this data
                 }
             }
         } else {
             $from = $db->tableName($proptable->name) . " AS t1";
             $this->prepareValueQuery($from, $where, $proptable, $value, 1);
             $res = $db->select($from, '*', $where, 'SMW::getInProperties', array('LIMIT' => 1));
             if ($db->numRows($res) > 0) {
                 $result[] = new SMWDIProperty($proptable->fixedproperty);
             }
         }
         $db->freeResult($res);
     }
     $result = $this->applyRequestOptions($result, $requestoptions);
     // apply options to overall result
     wfProfileOut("SMWSQLStore2::getInProperties (SMW)");
     return $result;
 }
 /**
  * Adds all numbers contained in a dataitem to the list.
  *
  * @since 1.7
  *
  * @param SMWDataItem $dataItem
  * @param array $values
  * @param string $name
  */
 protected function addNumbersForDataItem(SMWDataItem $dataItem, array &$values, $name)
 {
     switch ($dataItem->getDIType()) {
         case SMWDataItem::TYPE_NUMBER:
             $values[$name] = $dataItem->getNumber();
             break;
         case SMWDataItem::TYPE_CONTAINER:
             foreach ($dataItem->getDataItems() as $di) {
                 $this->addNumbersForDataItem($di, $values, $name);
             }
             break;
         default:
     }
 }
 /**
  * @see DataValue::loadDataItem
  */
 protected function loadDataItem(DataItem $dataItem)
 {
     if ($dataItem->getDIType() === DataItem::TYPE_CONTAINER) {
         $this->m_dataitem = $dataItem;
         return true;
     } elseif ($dataItem->getDIType() === DataItem::TYPE_WIKIPAGE) {
         $semanticData = new ContainerSemanticData($dataItem);
         $semanticData->copyDataFrom(ApplicationFactory::getInstance()->getStore()->getSemanticData($dataItem));
         $this->m_dataitem = new DIContainer($semanticData);
         return true;
     }
     return false;
 }
Exemple #22
0
 public function equals(SMWDataItem $di)
 {
     if ($di->getDIType() !== SMWDataItem::TYPE_URI) {
         return false;
     }
     return $di->getURI() === $this->getURI();
 }
Exemple #23
0
 /**
  * @see SMWDataValue::loadDataItem()
  * @param $dataitem SMWDataItem
  * @return boolean
  */
 protected function loadDataItem(SMWDataItem $dataItem)
 {
     if ($dataItem->getDIType() == SMWDataItem::TYPE_NUMBER) {
         $this->m_dataitem = $dataItem;
         $this->m_caption = false;
         $this->m_unitin = false;
         $this->makeUserValue();
         $this->m_unitvalues = false;
         return true;
     } else {
         return false;
     }
 }
Exemple #24
0
 /**
  * Convenience method to find the redirect target of an SMWDIWikiPage
  * or SMWDIProperty object. Returns a dataitem of the same type that
  * the input redirects to, or the input itself if there is no redirect.
  *
  * @param $dataItem SMWDataItem to find the redirect for.
  * @return SMWDataItem
  */
 public function getRedirectTarget(SMWDataItem $dataItem)
 {
     if ($dataItem->getDIType() == SMWDataItem::TYPE_PROPERTY) {
         if (!$dataItem->isUserDefined()) {
             return $dataItem;
         }
         $wikipage = $dataItem->getDiWikiPage();
     } elseif ($dataItem->getDIType() == SMWDataItem::TYPE_WIKIPAGE) {
         $wikipage = $dataItem;
     } else {
         throw new InvalidArgumentException('SMWStore::getRedirectTarget() expects an object of type SMWDIProperty or SMWDIWikiPage.');
     }
     $redirectDataItems = $this->getPropertyValues($wikipage, new SMWDIProperty('_REDI'));
     if (count($redirectDataItems) > 0) {
         if ($dataItem->getDIType() == SMWDataItem::TYPE_PROPERTY) {
             return new SMWDIProperty(end($redirectDataItems)->getDBkey());
         } else {
             return end($redirectDataItems);
         }
     } else {
         return $dataItem;
     }
 }
Exemple #25
0
 /**
  * @see SMWDataValue::loadDataItem()
  * @param $dataitem SMWDataItem
  * @return boolean
  */
 protected function loadDataItem(SMWDataItem $dataItem)
 {
     if ($dataItem->getDIType() == SMWDataItem::TYPE_CONTAINER) {
         // might throw an exception, we just pass it through
         $dataItem = $dataItem->getSemanticData()->getSubject();
     }
     if ($dataItem->getDIType() == SMWDataItem::TYPE_WIKIPAGE) {
         $this->m_dataitem = $dataItem;
         $this->m_id = -1;
         $this->m_title = null;
         $this->m_fragment = $dataItem->getSubobjectName();
         $this->m_prefixedtext = '';
         $this->m_caption = false;
         // this class can handle this
         if ($this->m_fixNamespace != NS_MAIN && $this->m_fixNamespace != $dataItem->getNamespace()) {
             global $wgContLang;
             $this->addError(wfMessage('smw_wrong_namespace', $wgContLang->getNsText($this->m_fixNamespace))->inContentLanguage()->text());
         }
         return true;
     } else {
         return false;
     }
 }
Exemple #26
0
 /**
  * Gets a list of all numbers contained in a dataitem.
  * 
  * @since 1.6
  * 
  * @param SMWDataItem $dataItem
  * @param array $numbers
  */
 public static function addNumbersForDataItem(SMWDataItem $dataItem, array &$numbers)
 {
     switch ($dataItem->getDIType()) {
         case SMWDataItem::TYPE_NUMBER:
             $numbers[] = $dataItem->getNumber();
             break;
         case SMWDataItem::TYPE_CONTAINER:
             foreach ($dataItem->getDataItems() as $di) {
                 self::addNumbersForDataItem($di, $numbers);
             }
             break;
         default:
     }
 }
 /**
  * @see SMWDataValue::loadDataItem()
  * @param $dataitem SMWDataItem
  * @return boolean
  */
 protected function loadDataItem(SMWDataItem $dataItem)
 {
     SWBSpecialBrowseWiki::debug("loadItem");
     if ($dataItem->getDIType() == SMWDataItem::TYPE_URI) {
         $this->m_dataitem = $dataItem;
         if ($this->m_mode == SMW_URI_MODE_EMAIL) {
             $this->m_wikitext = substr($dataItem->getURI(), 7);
         } elseif ($this->m_mode == SMW_URI_MODE_TEL) {
             $this->m_wikitext = substr($dataItem->getURI(), 4);
         } else {
             $this->m_wikitext = $dataItem->getURI();
         }
         $this->m_caption = $this->m_wikitext;
         return true;
     } else {
         return false;
     }
 }
 /**
  * Create an SWMExpElement that encodes auxiliary data for representing
  * values of the specified dataitem object in a simplified fashion.
  * This is done for types of dataitems that are not supported very well
  * in current systems, or that do not match a standard datatype in RDF.
  * For example, time points (DITime) are encoded as numbers. The number
  * can replace the actual time for all query and ordering purposes (the
  * order in either case is linear and maps to the real number line).
  * Only data retrieval should better use the real values to avoid that
  * rounding errors lead to unfaithful recovery of data. Note that the
  * helper values do not maintain any association with their original
  * values -- they are a fully redundant alternative representation, not
  * an additional piece of information for the main values. Even if
  * decoding is difficult, they must be in one-to-one correspondence to
  * the original value.
  *
  * For dataitems that do not have such a simplification, the method
  * returns null.
  *
  * @note If a helper element is used, then it must be the same as
  * getDataItemHelperExpElement( $dataItem->getSortKeyDataItem() ).
  * Query conditions like ">" use sortkeys for values, and helper
  * elements are always preferred in query answering.
  *
  * @param $dataItem SMWDataItem
  * @return SMWExpElement or null
  */
 public static function getDataItemHelperExpElement(SMWDataItem $dataItem)
 {
     if ($dataItem->getDIType() == SMWDataItem::TYPE_TIME) {
         return new SMWExpLiteral((string) $dataItem->getSortKey(), 'http://www.w3.org/2001/XMLSchema#double', '', $dataItem);
     }
     if ($dataItem->getDIType() == SMWDataItem::TYPE_GEO) {
         return new SMWExpLiteral((string) $dataItem->getSortKey(), 'http://www.w3.org/2001/XMLSchema#string', '', $dataItem);
     }
     return null;
 }
 /**
  * @see SMWDataValue::loadDataItem()
  * @param $dataitem SMWDataItem
  * @return boolean
  */
 protected function loadDataItem(SMWDataItem $dataItem)
 {
     if ($dataItem->getDIType() !== SMWDataItem::TYPE_URI) {
         return false;
     }
     $this->m_dataitem = $dataItem;
     if ($this->m_mode == SMW_URI_MODE_EMAIL) {
         $this->m_wikitext = substr($dataItem->getURI(), 7);
     } elseif ($this->m_mode == SMW_URI_MODE_TEL) {
         $this->m_wikitext = substr($dataItem->getURI(), 4);
     } else {
         $this->m_wikitext = $dataItem->getURI();
     }
     $this->m_caption = $this->m_wikitext;
     $this->showUrlContextInRawFormat = false;
     return true;
 }
 /**
  * @see SMWDataValue::loadDataItem()
  * @param $dataitem SMWDataItem
  * @return boolean
  */
 protected function loadDataItem(SMWDataItem $dataItem)
 {
     if ($dataItem->getDIType() == SMWDataItem::TYPE_TIME) {
         $this->m_dataitem = $dataItem;
         $this->m_caption = $this->m_wikivalue = false;
         return true;
     } else {
         return false;
     }
 }