当前位置: 首页>>代码示例>>PHP>>正文


PHP SMWExporter::getOntologyExpData方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:56,代码来源:SMW_QP_RDF.php

示例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);
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:63,代码来源:SMW_ExportController.php


注:本文中的SMWExporter::getOntologyExpData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。