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


PHP SMWExporter::getDataItemHelperExpElement方法代码示例

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


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

示例1: addResourceHelperValue

 protected function addResourceHelperValue(ExpData $expData, DIProperty $property, DataItem $dataItem)
 {
     $expElementHelper = $this->exporter->getDataItemHelperExpElement($dataItem);
     if ($expElementHelper !== null) {
         $expData->addPropertyObjectValue($this->getResourceElementHelperForProperty($property), $expElementHelper);
     }
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:7,代码来源:PropertyValueResourceBuilder.php

示例2: createFilterConditionForAnyOtherComparator

 private function createFilterConditionForAnyOtherComparator($dataItem, $joinVariable, $orderByProperty, $comparator)
 {
     $result = new FilterCondition('', array());
     $this->compoundConditionBuilder->addOrderByData($result, $joinVariable, $dataItem->getDIType());
     $orderByVariable = $result->orderByVariable;
     if ($dataItem instanceof DIWikiPage) {
         $expElement = $this->exporter->getDataItemExpElement($dataItem->getSortKeyDataItem());
     } else {
         $expElement = $this->exporter->getDataItemHelperExpElement($dataItem);
         if (is_null($expElement)) {
             $expElement = $this->exporter->getDataItemExpElement($dataItem);
         }
     }
     $valueName = TurtleSerializer::getTurtleNameForExpElement($expElement);
     if ($expElement instanceof ExpNsResource) {
         $result->namespaces[$expElement->getNamespaceId()] = $expElement->getNamespace();
     }
     $result->filter = "?{$orderByVariable} {$comparator} {$valueName}";
     return $result;
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:20,代码来源:ValueDescriptionInterpreter.php

示例3: buildValueCondition

 /**
  * Create an SMWSparqlCondition from an SMWValueDescription.
  *
  * @param $description SMWValueDescription
  * @param $joinVariable string name, see buildSparqlCondition()
  * @param $orderByProperty mixed SMWDIProperty or null, see buildSparqlCondition()
  * @return SMWSparqlCondition
  */
 protected function buildValueCondition(SMWValueDescription $description, $joinVariable, $orderByProperty)
 {
     $dataItem = $description->getDataItem();
     switch ($description->getComparator()) {
         case SMW_CMP_EQ:
             $comparator = '=';
             break;
         case SMW_CMP_LESS:
             $comparator = '<';
             break;
         case SMW_CMP_GRTR:
             $comparator = '>';
             break;
         case SMW_CMP_LEQ:
             $comparator = '<=';
             break;
         case SMW_CMP_GEQ:
             $comparator = '>=';
             break;
         case SMW_CMP_NEQ:
             $comparator = '!=';
             break;
         case SMW_CMP_LIKE:
             $comparator = 'regex';
             break;
         case SMW_CMP_NLKE:
             $comparator = '!regex';
             break;
         default:
             $comparator = '';
             // unkown, unsupported
     }
     if ($comparator === '') {
         $result = $this->buildTrueCondition($joinVariable, $orderByProperty);
     } elseif ($comparator == '=') {
         $expElement = SMWExporter::getDataItemHelperExpElement($dataItem);
         if (is_null($expElement)) {
             $expElement = SMWExporter::getDataItemExpElement($dataItem);
         }
         $result = new SMWSparqlSingletonCondition($expElement);
         $this->addOrderByDataForProperty($result, $joinVariable, $orderByProperty, $dataItem->getDIType());
     } elseif ($comparator == 'regex' || $comparator == '!regex') {
         if ($dataItem instanceof SMWDIBlob) {
             $pattern = '^' . str_replace(array('^', '.', '\\', '+', '{', '}', '(', ')', '|', '^', '$', '[', ']', '*', '?'), array('\\^', '\\.', '\\\\', '\\+', '\\{', '\\}', '\\(', '\\)', '\\|', '\\^', '\\$', '\\[', '\\]', '.*', '.'), $dataItem->getString()) . '$';
             $result = new SMWSparqlFilterCondition("{$comparator}( ?{$joinVariable}, \"{$pattern}\", \"s\")", array());
             $this->addOrderByDataForProperty($result, $joinVariable, $orderByProperty, $dataItem->getDIType());
         } else {
             $result = $this->buildTrueCondition($joinVariable, $orderByProperty);
         }
     } else {
         $result = new SMWSparqlFilterCondition('', array());
         $this->addOrderByData($result, $joinVariable, $dataItem->getDIType());
         $orderByVariable = $result->orderByVariable;
         if ($dataItem instanceof SMWDIWikiPage) {
             $expElement = SMWExporter::getDataItemExpElement($dataItem->getSortKeyDataItem());
         } else {
             $expElement = SMWExporter::getDataItemHelperExpElement($dataItem);
             if (is_null($expElement)) {
                 $expElement = SMWExporter::getDataItemExpElement($dataItem);
             }
         }
         $valueName = SMWTurtleSerializer::getTurtleNameForExpElement($expElement);
         if ($expElement instanceof SMWExpNsResource) {
             $result->namespaces[$expElement->getNamespaceId()] = $expElement->getNamespace();
         }
         $result->filter = "?{$orderByVariable} {$comparator} {$valueName}";
     }
     return $result;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:77,代码来源:SMW_SparqlStoreQueryEngine.php


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