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


PHP SMWDataItem::getTitle方法代码示例

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


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

示例1: 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

示例2: 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

示例3: tryToFindRedirectVariableForDataItem

 /**
  * @since 2.3
  *
  * @param DataItem|null $dataItem
  *
  * @return string|null
  */
 public function tryToFindRedirectVariableForDataItem(DataItem $dataItem = null)
 {
     if (!$dataItem instanceof DIWikiPage || !$this->canUseQFeature(SMW_SPARQL_QF_REDI)) {
         return null;
     }
     // Maybe there is a better way to verify the "isRedirect" state other
     // than by using the Title object
     if ($dataItem->getTitle() === null || !$dataItem->getTitle()->isRedirect()) {
         return null;
     }
     $redirectExpElement = Exporter::getInstance()->getResourceElementForWikiPage($dataItem);
     $valueName = TurtleSerializer::getTurtleNameForExpElement($redirectExpElement);
     // Add unknow redirect target/variable for value
     if (!isset($this->redirectByVariableReplacementMap[$valueName])) {
         $namespaces[$redirectExpElement->getNamespaceId()] = $redirectExpElement->getNamespace();
         $redirectByVariable = '?' . $this->getNextVariable('r');
         $this->redirectByVariableReplacementMap[$valueName] = array($redirectByVariable, $namespaces);
     }
     // Reuse an existing variable for the value to allow to be used more than
     // once when referring to the same property/value redirect
     list($redirectByVariable, $namespaces) = $this->redirectByVariableReplacementMap[$valueName];
     return $redirectByVariable;
 }
开发者ID:bogota,项目名称:SemanticMediaWiki,代码行数:30,代码来源:CompoundConditionBuilder.php


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