本文整理汇总了PHP中SMWExporter::findDataItemForExpElement方法的典型用法代码示例。如果您正苦于以下问题:PHP SMWExporter::findDataItemForExpElement方法的具体用法?PHP SMWExporter::findDataItemForExpElement怎么用?PHP SMWExporter::findDataItemForExpElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMWExporter
的用法示例。
在下文中一共展示了SMWExporter::findDataItemForExpElement方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeQueryResultForInstance
private function makeQueryResultForInstance(FederateResultSet $federateResultSet, Query $query)
{
$resultDataItems = array();
foreach ($federateResultSet as $resultRow) {
if (count($resultRow) > 0) {
$dataItem = Exporter::findDataItemForExpElement($resultRow[0]);
if (!is_null($dataItem)) {
$resultDataItems[] = $dataItem;
}
}
}
if ($federateResultSet->numRows() > $query->getLimit()) {
array_pop($resultDataItems);
$hasFurtherResults = true;
} else {
$hasFurtherResults = false;
}
$result = new QueryResult($query->getDescription()->getPrintrequests(), $query, $resultDataItems, $this->store, $hasFurtherResults);
switch ($federateResultSet->getErrorCode()) {
case FederateResultSet::ERROR_NOERROR:
break;
case FederateResultSet::ERROR_INCOMPLETE:
$result->addErrors(array(wfMessage('smw_db_sparqlqueryincomplete')->inContentLanguage()->text()));
break;
default:
$result->addErrors(array(wfMessage('smw_db_sparqlqueryproblem')->inContentLanguage()->text()));
break;
}
return $result;
}
示例2: getQueryResultFromSparqlResult
/**
* Build an SMWQueryResult object from a SMWSparqlResultWrapper. This
* function is used to generate instance query results, and the given
* result wrapper must have an according format (one result column that
* contains URIs of wiki pages).
*
* @param $sparqlResultWrapper SMWSparqlResultWrapper
* @param $query SMWQuery, SMWQueryResults hold a reference to original query
* @return SMWQueryResult
*/
protected function getQueryResultFromSparqlResult(SMWSparqlResultWrapper $sparqlResultWrapper, SMWQuery $query)
{
$resultDataItems = array();
foreach ($sparqlResultWrapper as $resultRow) {
if (count($resultRow) > 0) {
$dataItem = SMWExporter::findDataItemForExpElement($resultRow[0]);
if (!is_null($dataItem)) {
$resultDataItems[] = $dataItem;
}
}
}
if ($sparqlResultWrapper->numRows() > $query->getLimit()) {
array_pop($resultDataItems);
$hasFurtherResults = true;
} else {
$hasFurtherResults = false;
}
$result = new SMWQueryResult($query->getDescription()->getPrintrequests(), $query, $resultDataItems, $this->m_store, $hasFurtherResults);
switch ($sparqlResultWrapper->getErrorCode()) {
case SMWSparqlResultWrapper::ERROR_NOERROR:
break;
case SMWSparqlResultWrapper::ERROR_INCOMPLETE:
$result->addErrors(array(wfMessage('smw_db_sparqlqueryincomplete')->inContentLanguage()->text()));
break;
default:
$result->addErrors(array(wfMessage('smw_db_sparqlqueryproblem')->inContentLanguage()->text()));
break;
}
return $result;
}
示例3: testFindDataItemForExpElement
/**
* @dataProvider uriDataItemProvider
* #378
*/
public function testFindDataItemForExpElement($uri, $expectedDataItem)
{
$uri = Exporter::getNamespaceUri('wiki') . $uri;
$this->assertEquals($expectedDataItem, Exporter::findDataItemForExpElement(new ExpResource($uri)));
}