本文整理汇总了PHP中SMWExporter::getOntologyExpData方法的典型用法代码示例。如果您正苦于以下问题:PHP SMWExporter::getOntologyExpData方法的具体用法?PHP SMWExporter::getOntologyExpData怎么用?PHP SMWExporter::getOntologyExpData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMWExporter
的用法示例。
在下文中一共展示了SMWExporter::getOntologyExpData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
示例2: printWikiInfo
/**
* Print basic information about this site.
*/
public function printWikiInfo()
{
global $wgSitename, $wgLanguageCode;
$this->prepareSerialization();
$this->delay_flush = 35;
// don't do intermediate flushes with default parameters
// assemble export data:
$expData = new SMWExpData(new SMWExpResource('&wiki;#wiki'));
$ed = new SMWExpData(SMWExporter::getSpecialNsResource('swivt', 'Wikisite'));
$expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('rdf', 'type'), $ed);
// basic wiki information
$ed = new SMWExpData(new SMWExpLiteral($wgSitename));
$expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('rdfs', 'label'), $ed);
$ed = new SMWExpData(new SMWExpLiteral($wgSitename, null, 'http://www.w3.org/2001/XMLSchema#string'));
$expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('swivt', 'siteName'), $ed);
$ed = new SMWExpData(new SMWExpLiteral(SMWExporter::expandURI('&wikiurl;'), null, 'http://www.w3.org/2001/XMLSchema#string'));
$expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('swivt', 'pagePrefix'), $ed);
$ed = new SMWExpData(new SMWExpLiteral(SMW_VERSION, null, 'http://www.w3.org/2001/XMLSchema#string'));
$expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('swivt', 'smwVersion'), $ed);
$ed = new SMWExpData(new SMWExpLiteral($wgLanguageCode, null, 'http://www.w3.org/2001/XMLSchema#string'));
$expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('swivt', 'langCode'), $ed);
$mainpage = Title::newMainPage();
if (!is_null($mainpage)) {
$ed = new SMWExpData(new SMWExpResource($mainpage->getFullURL()));
$expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('swivt', 'mainPage'), $ed);
}
// statistical information
$ed = new SMWExpData(new SMWExpLiteral(SiteStats::pages(), null, 'http://www.w3.org/2001/XMLSchema#int'));
$expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('swivt', 'pageCount'), $ed);
$ed = new SMWExpData(new SMWExpLiteral(SiteStats::articles(), null, 'http://www.w3.org/2001/XMLSchema#int'));
$expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('swivt', 'contentPageCount'), $ed);
$ed = new SMWExpData(new SMWExpLiteral(SiteStats::images(), null, 'http://www.w3.org/2001/XMLSchema#int'));
$expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('swivt', 'mediaCount'), $ed);
$ed = new SMWExpData(new SMWExpLiteral(SiteStats::edits(), null, 'http://www.w3.org/2001/XMLSchema#int'));
$expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('swivt', 'editCount'), $ed);
$ed = new SMWExpData(new SMWExpLiteral(SiteStats::views(), null, 'http://www.w3.org/2001/XMLSchema#int'));
$expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('swivt', 'viewCount'), $ed);
$ed = new SMWExpData(new SMWExpLiteral(SiteStats::users(), null, 'http://www.w3.org/2001/XMLSchema#int'));
$expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('swivt', 'userCount'), $ed);
$ed = new SMWExpData(new SMWExpLiteral(SiteStats::numberingroup('sysop'), null, 'http://www.w3.org/2001/XMLSchema#int'));
$expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('swivt', 'adminCount'), $ed);
$this->serializer->startSerialization();
$this->serializer->serializeExpData(SMWExporter::getOntologyExpData(''));
$this->serializer->serializeExpData($expData);
// link to list of existing pages:
if (strpos(SMWExporter::expandURI('&wikiurl;'), '?') === false) {
// check whether we have title as a first parameter or in URL
$nexturl = SMWExporter::expandURI('&export;?offset=0');
} else {
$nexturl = SMWExporter::expandURI('&export;&offset=0');
}
$expData = new SMWExpData(new SMWExpResource($nexturl));
$ed = new SMWExpData(SMWExporter::getSpecialNsResource('owl', 'Thing'));
$expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('rdf', 'type'), $ed);
$ed = new SMWExpData(new SMWExpResource($nexturl));
$expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('rdfs', 'isDefinedBy'), $ed);
$this->serializer->serializeExpData($expData);
$this->serializer->finishSerialization();
$this->flush(true);
}