本文整理汇总了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);
}
}
示例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;
}
示例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;
}