当前位置: 首页>>代码示例>>PHP>>正文


PHP SMWDataItem::getSortKey方法代码示例

本文整理汇总了PHP中SMWDataItem::getSortKey方法的典型用法代码示例。如果您正苦于以下问题:PHP SMWDataItem::getSortKey方法的具体用法?PHP SMWDataItem::getSortKey怎么用?PHP SMWDataItem::getSortKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SMWDataItem的用法示例。


在下文中一共展示了SMWDataItem::getSortKey方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isNumeric

	/**
	 * Convenience method that checks if the value that is used to sort
	 * data of this type is numeric. This only works if the value is set.
	 *
	 * @return boolean
	 */
	public function isNumeric() {
		if ( isset( $this->m_dataitem ) ) {
			return is_numeric( $this->m_dataitem->getSortKey() );
		} else {
			return false;
		}
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:13,代码来源:SMW_DataValue.php

示例2: getDataItemHelperExpElement

 /**
  * 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;
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:36,代码来源:SMW_Exporter.php

示例3: getDataItemHelperExpElement

 /**
  * 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;
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:37,代码来源:SMW_Exporter.php

示例4: equals

 public function equals(SMWDataItem $di)
 {
     if ($di->getDIType() !== SMWDataItem::TYPE_TIME) {
         return false;
     }
     return $di->getSortKey() === $this->getSortKey();
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:7,代码来源:SMW_DI_Time.php

示例5: getInsertValues

 /**
  * Method to return an array of fields=>values for a DataItem.
  * This array is used to perform all insert operations into the DB.
  * To optimize return minimum fields having indexes.
  *
  * @return array
  */
 public function getInsertValues(SMWDataItem $dataItem)
 {
     return array('o_serialized' => $dataItem->getSerialization(), 'o_sortkey' => $dataItem->getSortKey());
 }
开发者ID:yusufchang,项目名称:app,代码行数:11,代码来源:SMW_DIHandler_Time.php

示例6: getFirstLetterForCategory

 private function getFirstLetterForCategory(DataItem $dataItem)
 {
     $sortKey = $dataItem->getSortKey();
     if ($dataItem->getDIType() == DataItem::TYPE_WIKIPAGE) {
         $sortKey = ApplicationFactory::getInstance()->getStore()->getWikiPageSortKey($dataItem);
     }
     return ByLanguageCollationMapper::getInstance()->findFirstLetterForCategory($sortKey);
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:8,代码来源:ConceptPage.php

示例7: getDBkeysFromDataItem

 /**
  * Compatibility function for computing the old getDBkeys() array for
  * the new SMW data items.
  *
  * @param $dataItem SMWDataItem
  * @return array of mixed
  */
 public static function getDBkeysFromDataItem(SMWDataItem $dataItem)
 {
     switch ($dataItem->getDIType()) {
         case SMWDataItem::TYPE_STRING:
         case SMWDataItem::TYPE_BLOB:
             return array($dataItem->getString());
         case SMWDataItem::TYPE_URI:
             return array($dataItem->getSerialization());
         case SMWDataItem::TYPE_WIKIPAGE:
             return array($dataItem->getDBkey(), $dataItem->getNamespace(), $dataItem->getInterwiki(), $dataItem->getSortKey());
         case SMWDataItem::TYPE_NUMBER:
             return array($dataItem->getSerialization(), floatval($dataItem->getNumber()));
         case SMWDataItem::TYPE_TIME:
             $xsdvalue = $dataItem->getYear() . "/" . ($dataItem->getPrecision() >= SMWDITime::PREC_YM ? $dataItem->getMonth() : '') . "/" . ($dataItem->getPrecision() >= SMWDITime::PREC_YMD ? $dataItem->getDay() : '') . "T";
             if ($dataItem->getPrecision() == SMWDITime::PREC_YMDT) {
                 $xsdvalue .= sprintf("%02d", $dataItem->getHour()) . ':' . sprintf("%02d", $dataItem->getMinute()) . ':' . sprintf("%02d", $dataItem->getSecond());
             }
             return array($xsdvalue, $dataItem->getSortKey());
         case SMWDataItem::TYPE_BOOLEAN:
             return $dataItem->getBoolean() ? array('1', 1) : array('0', 0);
         case SMWDataItem::TYPE_CONTAINER:
             return array(false);
         case SMWDataItem::TYPE_CONCEPT:
             return array($dataItem->getConceptQuery(), $dataItem->getDocumentation(), $dataItem->getQueryFeatures(), $dataItem->getSize(), $dataItem->getDepth());
         case SMWDataItem::TYPE_PROPERTY:
             return array($dataItem->getKey());
         case SMWDataItem::TYPE_GEO:
             $coordinateSet = $dataItem->getCoordinateSet();
             return array($coordinateSet['lat'], $coordinateSet['lon']);
         default:
             return array(false);
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:40,代码来源:SMW_CompatibilityHelpers.php


注:本文中的SMWDataItem::getSortKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。