本文整理汇总了PHP中SMWExporter::makeExportDataForSubject方法的典型用法代码示例。如果您正苦于以下问题:PHP SMWExporter::makeExportDataForSubject方法的具体用法?PHP SMWExporter::makeExportDataForSubject怎么用?PHP SMWExporter::makeExportDataForSubject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMWExporter
的用法示例。
在下文中一共展示了SMWExporter::makeExportDataForSubject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testExportDataForPropertyPage
public function testExportDataForPropertyPage()
{
$propertyPage = new DIWikiPage('Foo', SMW_NS_PROPERTY);
$expData = Exporter::makeExportDataForSubject($propertyPage);
$this->assertInstanceOf('\\SMWExpData', $expData);
$this->assertInstanceOf('\\SMWExpNsResource', $expData->getSubject());
}
示例2: getResultText
protected function getResultText(SMWQueryResult $res, $outputmode)
{
if ($outputmode == SMW_OUTPUT_FILE) {
// make RDF file
$serializer = $this->syntax == 'turtle' ? new SMWTurtleSerializer() : new SMWRDFXMLSerializer();
$serializer->startSerialization();
$serializer->serializeExpData(SMWExporter::getOntologyExpData(''));
while ($row = $res->getNext()) {
$subjectDi = reset($row)->getResultSubject();
$data = SMWExporter::makeExportDataForSubject($subjectDi);
foreach ($row as $resultarray) {
$printreq = $resultarray->getPrintRequest();
$property = null;
switch ($printreq->getMode()) {
case SMWPrintRequest::PRINT_PROP:
$property = $printreq->getData()->getDataItem();
break;
case SMWPrintRequest::PRINT_CATS:
$property = new SMWDIProperty('_TYPE');
break;
case SMWPrintRequest::PRINT_CCAT:
// not serialised right now
break;
case SMWPrintRequest::PRINT_THIS:
// ignored here (object is always included in export)
break;
}
if (!is_null($property)) {
SMWExporter::addPropertyValues($property, $resultarray->getContent(), $data, $subjectDi);
}
}
$serializer->serializeExpData($data);
}
$serializer->finishSerialization();
return $serializer->flushContent();
} else {
// just make link to feed
if ($this->getSearchLabel($outputmode)) {
$label = $this->getSearchLabel($outputmode);
} else {
$label = wfMsgForContent('smw_rdf_link');
}
$link = $res->getQueryLink($label);
$link->setParameter('rdf', 'format');
$link->setParameter($this->syntax, 'syntax');
if (array_key_exists('limit', $this->params)) {
$link->setParameter($this->params['limit'], 'limit');
} else {
// use a reasonable default limit
$link->setParameter(100, 'limit');
}
$this->isHTML = $outputmode == SMW_OUTPUT_HTML;
// yes, our code can be viewed as HTML if requested, no more parsing needed
return $link->getText($outputmode, $this->mLinker);
}
}
示例3: expandUpdateExpResource
/**
* Find a normalized representation of the given SMWExpResource that can
* be used in an update of the stored data. Normalization uses
* redirects. The type of the ExpElement might change, especially into
* SMWExpData in order to store auxiliary properties.
* Moreover, the method records any auxiliary data that should be
* written to the store when including this SMWExpElement into updates.
* This auxiliary data is collected in a call-by-ref array.
*
* @since 1.6
* @param $expResource SMWExpResource object containing the update data
* @param $auxiliaryExpData array of SMWExpData
* @return SMWExpElement
*/
protected function expandUpdateExpResource(SMWExpResource $expResource, array &$auxiliaryExpData)
{
$exists = true;
if ($expResource instanceof SMWExpNsResource) {
$elementTarget = $this->getSparqlRedirectTarget($expResource, $exists);
} else {
$elementTarget = $expResource;
}
if (!$exists && $elementTarget->getDataItem() instanceof SMWDIWikiPage) {
$diWikiPage = $elementTarget->getDataItem();
$hash = $diWikiPage->getHash();
if (!array_key_exists($hash, $auxiliaryExpData)) {
$auxiliaryExpData[$hash] = SMWExporter::makeExportDataForSubject($diWikiPage, null, true);
}
}
return $elementTarget;
}