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


PHP SMWDataItem类代码示例

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


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


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