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


PHP SMWDataItem::getHash方法代码示例

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


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

示例1: checkAllowedValues

 /**
  * Check if property is range restricted and, if so, whether the current value is allowed.
  * Creates an error if the value is illegal.
  */
 protected function checkAllowedValues()
 {
     if (!is_null($this->m_property)) {
         $propertyDiWikiPage = $this->m_property->getDiWikiPage();
     }
     if (is_null($this->m_property) || is_null($propertyDiWikiPage) || !isset($this->m_dataitem)) {
         return;
         // no property known, or no data to check
     }
     $allowedvalues = \SMW\StoreFactory::getStore()->getPropertyValues($propertyDiWikiPage, new SMWDIProperty('_PVAL'));
     if (count($allowedvalues) == 0) {
         return;
     }
     $hash = $this->m_dataitem->getHash();
     $testdv = DataValueFactory::getInstance()->newTypeIDValue($this->getTypeID());
     $accept = false;
     $valuestring = '';
     foreach ($allowedvalues as $di) {
         if ($di instanceof SMWDIBlob) {
             $testdv->setUserValue($di->getString());
             if ($hash === $testdv->getDataItem()->getHash()) {
                 $accept = true;
                 break;
             } else {
                 if ($valuestring !== '') {
                     $valuestring .= ', ';
                 }
                 $valuestring .= $di->getString();
             }
         }
     }
     if (!$accept) {
         $this->addError(wfMessage('smw_notinenum', $this->getWikiValue(), $valuestring)->inContentLanguage()->text());
     }
 }
开发者ID:ReachingOut,项目名称:SemanticMediaWiki,代码行数:39,代码来源:SMW_DataValue.php

示例2: getHash

 /**
  * Return a string that identifies the value of the object, and that can
  * be used to compare different value objects.
  * Possibly overwritten by subclasses (e.g. to ensure that returned
  * value is normalized first)
  *
  * @return string
  */
 public function getHash()
 {
     return $this->isValid() ? $this->m_dataitem->getHash() : implode("\t", $this->mErrors);
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:12,代码来源:SMW_DataValue.php

示例3: addPropertyObjectValue

 /**
  * Store a value for a property identified by its SMWDataItem object.
  *
  * @note There is no check whether the type of the given data item
  * agrees with the type of the property. Since property types can
  * change, all parts of SMW are prepared to handle mismatched data item
  * types anyway.
  *
  * @param $property SMWDIProperty
  * @param $dataItem SMWDataItem
  */
 public function addPropertyObjectValue(SMWDIProperty $property, SMWDataItem $dataItem)
 {
     if ($property->isInverse()) {
         // inverse properties cannot be used for annotation
         return;
     }
     if (!array_key_exists($property->getKey(), $this->mPropVals)) {
         $this->mPropVals[$property->getKey()] = array();
         $this->mProperties[$property->getKey()] = $property;
     }
     if ($this->mNoDuplicates) {
         $this->mPropVals[$property->getKey()][$dataItem->getHash()] = $dataItem;
     } else {
         $this->mPropVals[$property->getKey()][] = $dataItem;
     }
     if (!$property->isUserDefined()) {
         if ($property->isShown()) {
             $this->mHasVisibleSpecs = true;
             $this->mHasVisibleProps = true;
         }
     } else {
         $this->mHasVisibleProps = true;
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:35,代码来源:SMW_SemanticData.php

示例4: addToEntityList

 /**
  * @since  2.4
  *
  * @param DataItem $dataItem
  * @param DIProperty|null $property
  */
 public function addToEntityList(DataItem $dataItem, DIProperty $property = null)
 {
     $queryID = $this->getQueryId();
     if (!isset($this->entityList[$queryID])) {
         $this->entityList[$queryID] = array();
     }
     if ($dataItem instanceof DIWikiPage) {
         $this->entityList[$queryID][$dataItem->getHash()] = $dataItem;
     }
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:16,代码来源:EntityListAccumulator.php


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