本文整理汇总了PHP中SMWExporter::getResourceElementForWikiPage方法的典型用法代码示例。如果您正苦于以下问题:PHP SMWExporter::getResourceElementForWikiPage方法的具体用法?PHP SMWExporter::getResourceElementForWikiPage怎么用?PHP SMWExporter::getResourceElementForWikiPage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMWExporter
的用法示例。
在下文中一共展示了SMWExporter::getResourceElementForWikiPage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mapCategoriesToConditionElements
private function mapCategoriesToConditionElements(array $categories, $joinVariable)
{
$condition = '';
$namespaces = array();
$instExpElement = $this->exporter->getSpecialPropertyResource('_INST');
foreach ($categories as $category) {
$categoryExpElement = $this->exporter->getResourceElementForWikiPage($category);
$categoryName = TurtleSerializer::getTurtleNameForExpElement($categoryExpElement);
$namespaces[$categoryExpElement->getNamespaceId()] = $categoryExpElement->getNamespace();
$newcondition = "{ ?{$joinVariable} " . $instExpElement->getQName() . " {$categoryName} . }\n";
if ($condition === '') {
$condition = $newcondition;
} else {
$condition .= "UNION\n{$newcondition}";
}
}
return array($condition, $namespaces);
}
示例2: doMapClassDescription
private function doMapClassDescription(ClassDescription $description, &$exact)
{
if (count($description->getCategories()) == 1) {
// single category
$categories = $description->getCategories();
$result = new ExpData($this->exporter->getResourceElementForWikiPage(end($categories)));
} else {
// disjunction of categories
$result = new ExpData(new ExpResource(''));
$elements = array();
foreach ($description->getCategories() as $cat) {
$elements[] = new ExpData($this->exporter->getResourceElementForWikiPage($cat));
}
$result->addPropertyObjectValue($this->exporter->getSpecialNsResource('owl', 'unionOf'), ExpData::makeCollection($elements));
}
$result->addPropertyObjectValue($this->exporter->getSpecialNsResource('rdf', 'type'), new ExpData($this->exporter->getSpecialNsResource('owl', 'Class')));
return $result;
}
示例3: buildClassCondition
/**
* Create an SMWSparqlCondition from an SMWClassDescription.
*
* @param $description SMWClassDescription
* @param $joinVariable string name, see buildSparqlCondition()
* @param $orderByProperty mixed SMWDIProperty or null, see buildSparqlCondition()
* @return SMWSparqlCondition
*/
protected function buildClassCondition(SMWClassDescription $description, $joinVariable, $orderByProperty)
{
$condition = '';
$namespaces = array();
$instExpElement = SMWExporter::getSpecialPropertyResource('_INST');
foreach ($description->getCategories() as $diWikiPage) {
$categoryExpElement = SMWExporter::getResourceElementForWikiPage($diWikiPage);
$categoryName = SMWTurtleSerializer::getTurtleNameForExpElement($categoryExpElement);
$namespaces[$categoryExpElement->getNamespaceId()] = $categoryExpElement->getNamespace();
$newcondition = "{ ?{$joinVariable} " . $instExpElement->getQName() . " {$categoryName} . }\n";
if ($condition === '') {
$condition = $newcondition;
} else {
$condition .= "UNION\n{$newcondition}";
}
}
if ($condition === '') {
// empty disjunction: always false, no results to order
return new SMWSparqlFalseCondition();
}
$result = new SMWSparqlWhereCondition($condition, true, $namespaces);
$this->addOrderByDataForProperty($result, $joinVariable, $orderByProperty, SMWDataItem::TYPE_WIKIPAGE);
return $result;
}