• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP SMWDataItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: equals

 public function equals(SMWDataItem $di)
 {
     if (!$di instanceof SMWDIBlob) {
         return false;
     }
     return $di->getString() === $this->m_string;
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:7,代码来源:SMW_DI_Blob.php


示例2: equals

 public function equals(SMWDataItem $di)
 {
     if ($di->getDIType() !== SMWDataItem::TYPE_NUMBER) {
         return false;
     }
     return $di->getNumber() === $this->m_number;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:7,代码来源:SMW_DI_Number.php


示例3: getSerialization

 /**
  * 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;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:44,代码来源:QueryResultSerializer.php


示例4: equals

 public function equals(SMWDataItem $di)
 {
     if ($di->getDIType() !== SMWDataItem::TYPE_ERROR) {
         return false;
     }
     return $di->getSerialization() === $this->getSerialization();
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:7,代码来源:SMW_DI_Error.php


示例5: equals

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


示例6: loadDataItem

	/**
	 * @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;
		}
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:14,代码来源:SMW_DV_Concept.php


示例7: loadDataItem

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


示例8: loadDataItem

 /**
  * @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;
     }
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:20,代码来源:SM_GeoCoordsValue.php


示例9: loadDataItem

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


示例10: loadDataItem

 /**
  * @see SMWDataValue::loadDataItem()
  * @param $dataitem SMWDataItem
  * @return boolean
  */
 protected function loadDataItem(SMWDataItem $dataItem)
 {
     if ($dataItem instanceof SMWDIUri && $dataItem->getScheme() == 'http' && $dataItem->getHierpart() == 'semantic-mediawiki.org/swivt/1.0' && $dataItem->getQuery() === '') {
         $this->m_isAlias = false;
         $this->m_typeId = $dataItem->getFragment();
         $this->m_realLabel = SMWDataValueFactory::findTypeLabel($this->m_typeId);
         $this->m_caption = $this->m_givenLabel = $this->m_realLabel;
         $this->m_dataitem = $dataItem;
         return true;
     } else {
         return false;
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:18,代码来源:SMW_DV_Types.php


示例11: getSerialization

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


示例12: loadDataItem

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


示例13: newFromSerialization

 /**
  * Creates and returns a new SWLPropertyChange instance from a serialization.
  *
  * @param string|null $oldValue
  * @param string|null $newValue
  *
  * @return SWLPropertyChange
  */
 public static function newFromSerialization(SMWDIProperty $property, $oldValue, $newValue)
 {
     $diType = SMWDataValueFactory::getDataItemId($property->findPropertyTypeID());
     //var_dump($property);
     //if($diType!=7) {throw new Exception();exit;}
     return new self(is_null($oldValue) ? null : SMWDataItem::newFromSerialization($diType, $oldValue), is_null($newValue) ? null : SMWDataItem::newFromSerialization($diType, $newValue));
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:15,代码来源:SWL_PropertyChange.php


示例14: newFromSerialization

	/**
	 * Creates and returns a new SWLPropertyChange instance from a serialization.
	 *
	 * @param string|null $oldValue
	 * @param string|null $newValue
	 *
	 * @return SWLPropertyChange
	 */
	public static function newFromSerialization( SMWDIProperty $property, $oldValue, $newValue ) {
		$diType = SMWDataValueFactory::getDataItemId( $property->findPropertyTypeID() );

		return new self(
			is_null( $oldValue ) ? null : SMWDataItem::newFromSerialization( $diType, $oldValue ),
			is_null( $newValue ) ? null : SMWDataItem::newFromSerialization( $diType, $newValue )
		);
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:16,代码来源:SWL_PropertyChange.php


示例15: loadDataItem

 /**
  * @see SMWDataValue::loadDataItem()
  *
  * @param $dataitem SMWDataItem
  *
  * @return boolean
  */
 protected function loadDataItem(SMWDataItem $dataItem)
 {
     if ($dataItem instanceof SMWDIBlob) {
         $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(wfMessage('smw_parseerror')->inContentLanguage()->text());
             }
         }
         $this->m_caption = false;
         return true;
     } else {
         return false;
     }
 }
开发者ID:Rikuforever,项目名称:wiki,代码行数:26,代码来源:SMW_DV_PropertyList.php


示例16: loadDataItem

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


示例17: loadDataItem

 /**
  * @see SMWDataValue::loadDataItem()
  *
  * @param $dataitem SMWDataItem
  *
  * @return boolean
  */
 protected function loadDataItem(SMWDataItem $dataItem)
 {
     if (!$dataItem instanceof SMWDIBlob) {
         return false;
     }
     $this->m_dataitem = $dataItem;
     $this->m_diProperties = array();
     foreach (explode(';', $dataItem->getString()) as $propertyKey) {
         $property = null;
         try {
             $property = new SMWDIProperty($propertyKey);
         } catch (SMWDataItemException $e) {
             $property = new SMWDIProperty('Error');
             $this->addError(wfMessage('smw_parseerror')->inContentLanguage()->text());
         }
         if ($property instanceof SMWDIProperty) {
             // Find a possible redirect
             $this->m_diProperties[] = StoreFactory::getStore()->getRedirectTarget($property);
         }
     }
     $this->m_caption = false;
     return true;
 }
开发者ID:hangya,项目名称:SemanticMediaWiki,代码行数:30,代码来源:SMW_DV_PropertyList.php


示例18: getSerialization

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


示例19: loadDataItem

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


示例20: getInProperties

 /**
  * 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;
 }
开发者ID:nischayn22,项目名称:SemanticMediawiki,代码行数:63,代码来源:SMW_SQLStore2.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP SMWDataValueFactory类代码示例发布时间:2022-05-23
下一篇:
PHP SMWDIProperty类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap