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


PHP SMWExporter::getInstance方法代码示例

本文整理汇总了PHP中SMWExporter::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP SMWExporter::getInstance方法的具体用法?PHP SMWExporter::getInstance怎么用?PHP SMWExporter::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SMWExporter的用法示例。


在下文中一共展示了SMWExporter::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSortableDateQuery

 /**
  * #576
  */
 public function testSortableDateQuery()
 {
     $this->getStore()->updateData($this->fixturesProvider->getFactsheet('Berlin')->asEntity());
     // #576 introduced resource caching, therefore make sure that the
     // instance is cleared after data have been created before further
     // tests are carried out
     Exporter::getInstance()->clear();
     /**
      * @query {{#ask: [[Founded::SomeDistinctValue]] }}
      */
     $foundedValue = $this->fixturesProvider->getFactsheet('Berlin')->getFoundedValue();
     $description = new SomeProperty($foundedValue->getProperty(), new ValueDescription($foundedValue->getDataItem(), null, SMW_CMP_EQ));
     $propertyValue = new PropertyValue('__pro');
     $propertyValue->setDataItem($foundedValue->getProperty());
     $query = new Query($description, false, false);
     $query->querymode = Query::MODE_INSTANCES;
     $query->sortkeys = array($foundedValue->getProperty()->getLabel() => 'ASC');
     // Be aware of
     // Virtuoso 22023 Error SR353: Sorted TOP clause specifies more then
     // 10001 rows to sort. Only 10000 are allowed. Either decrease the
     // offset and/or row count or use a scrollable cursor
     $query->setLimit(100);
     $query->setExtraPrintouts(array(new PrintRequest(PrintRequest::PRINT_THIS, ''), new PrintRequest(PrintRequest::PRINT_PROP, null, $propertyValue)));
     $queryResult = $this->getStore()->getQueryResult($query);
     $this->queryResultValidator->assertThatQueryResultHasSubjects($this->fixturesProvider->getFactsheet('Berlin')->asSubject(), $queryResult);
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:29,代码来源:DatePropertyValueQueryDBIntegrationTest.php

示例2: makeQueryResultForInstance

 private function makeQueryResultForInstance(RepositoryResult $repositoryResult, Query $query)
 {
     $resultDataItems = array();
     foreach ($repositoryResult as $resultRow) {
         if (count($resultRow) > 0 && $resultRow[0] instanceof ExpElement) {
             $dataItem = Exporter::getInstance()->findDataItemForExpElement($resultRow[0]);
             if (!is_null($dataItem)) {
                 $resultDataItems[] = $dataItem;
             }
         }
     }
     if ($repositoryResult->numRows() > $query->getLimit()) {
         if (count($resultDataItems) > 1) {
             array_pop($resultDataItems);
         }
         $hasFurtherResults = true;
     } else {
         $hasFurtherResults = false;
     }
     $result = new QueryResult($query->getDescription()->getPrintrequests(), $query, $resultDataItems, $this->store, $hasFurtherResults);
     switch ($repositoryResult->getErrorCode()) {
         case RepositoryResult::ERROR_NOERROR:
             break;
         case RepositoryResult::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;
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:32,代码来源:QueryResultFactory.php

示例3: categoryProvider

 public function categoryProvider()
 {
     $stringBuilder = UtilityFactory::getInstance()->newStringBuilder();
     # 0
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\FalseCondition';
     $description = new ClassDescription(array());
     $orderByProperty = null;
     $expected = $stringBuilder->addString('<http://www.example.org> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#nothing> .')->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $conditionType, $expected);
     # 1
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition';
     $category = new DIWikiPage('Foo', NS_CATEGORY);
     $categoryName = \SMWTurtleSerializer::getTurtleNameForExpElement(\SMWExporter::getInstance()->getResourceElementForWikiPage($category));
     $description = new ClassDescription($category);
     $orderByProperty = null;
     $expected = $stringBuilder->addString("{ ?result rdf:type {$categoryName} . }")->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $conditionType, $expected);
     # 2
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition';
     $categoryFoo = new DIWikiPage('Foo', NS_CATEGORY);
     $categoryFooName = \SMWTurtleSerializer::getTurtleNameForExpElement(\SMWExporter::getInstance()->getResourceElementForWikiPage($categoryFoo));
     $categoryBar = new DIWikiPage('Bar', NS_CATEGORY);
     $categoryBarName = \SMWTurtleSerializer::getTurtleNameForExpElement(\SMWExporter::getInstance()->getResourceElementForWikiPage($categoryBar));
     $description = new ClassDescription(array($categoryFoo, $categoryBar));
     $orderByProperty = null;
     $expected = $stringBuilder->addString("{ ?result rdf:type {$categoryFooName} . }")->addNewLine()->addString('UNION')->addNewLine()->addString("{ ?result rdf:type {$categoryBarName} . }")->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $conditionType, $expected);
     # 3
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition';
     $description = new ClassDescription(array($categoryFoo, $categoryBar));
     $orderByProperty = new DIProperty('Foo');
     $expected = $stringBuilder->addString('?result swivt:wikiPageSortKey ?resultsk .')->addNewLine()->addString("{ ?result rdf:type {$categoryFooName} . }")->addNewLine()->addString('UNION')->addNewLine()->addString("{ ?result rdf:type {$categoryBarName} . }")->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $conditionType, $expected);
     return $provider;
 }
开发者ID:brandonphuong,项目名称:mediawiki,代码行数:35,代码来源:ClassDescriptionInterpreterTest.php

示例4: __construct

 /**
  * @since 2.4
  *
  * @param Exporter|null $exporter
  */
 public function __construct(Exporter $exporter = null)
 {
     $this->exporter = $exporter;
     if ($this->exporter === null) {
         $this->exporter = Exporter::getInstance();
     }
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:12,代码来源:ConceptToExpDataMapper.php

示例5: serializeHeader

 protected function serializeHeader()
 {
     $this->namespaces_are_global = true;
     $this->namespace_block_started = true;
     $this->pre_ns_buffer = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" . "<!DOCTYPE rdf:RDF[\n" . "\t<!ENTITY rdf " . $this->makeValueEntityString(SMWExporter::getInstance()->expandURI('&rdf;')) . ">\n" . "\t<!ENTITY rdfs " . $this->makeValueEntityString(SMWExporter::getInstance()->expandURI('&rdfs;')) . ">\n" . "\t<!ENTITY owl " . $this->makeValueEntityString(SMWExporter::getInstance()->expandURI('&owl;')) . ">\n" . "\t<!ENTITY swivt " . $this->makeValueEntityString(SMWExporter::getInstance()->expandURI('&swivt;')) . ">\n" . "\t<!ENTITY wiki " . $this->makeValueEntityString(SMWExporter::getInstance()->expandURI('&wiki;')) . ">\n" . "\t<!ENTITY property " . $this->makeValueEntityString(SMWExporter::getInstance()->expandURI('&property;')) . ">\n" . "\t<!ENTITY wikiurl " . $this->makeValueEntityString(SMWExporter::getInstance()->expandURI('&wikiurl;')) . ">\n" . "]>\n\n" . "<rdf:RDF\n" . "\txmlns:rdf=\"&rdf;\"\n" . "\txmlns:rdfs=\"&rdfs;\"\n" . "\txmlns:owl =\"&owl;\"\n" . "\txmlns:swivt=\"&swivt;\"\n" . "\txmlns:wiki=\"&wiki;\"\n" . "\txmlns:property=\"&property;\"";
     $this->global_namespaces = array('rdf' => true, 'rdfs' => true, 'owl' => true, 'swivt' => true, 'wiki' => true, 'property' => true);
     $this->post_ns_buffer .= ">\n\n";
 }
开发者ID:brandonphuong,项目名称:mediawiki,代码行数:8,代码来源:SMW_Serializer_RDFXML.php

示例6: __construct

 /**
  * @since 2.5
  *
  * @param Exporter|null $exporter
  */
 public function __construct(Exporter $exporter = null)
 {
     $this->exporter = $exporter;
     if ($this->exporter === null) {
         $this->exporter = Exporter::getInstance();
     }
     $this->inMemoryPoolCache = ApplicationFactory::getInstance()->getInMemoryPoolCache()->getPoolCacheFor(Exporter::POOLCACHE_ID);
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:13,代码来源:PropertyValueResourceBuilder.php

示例7: tearDown

 protected function tearDown()
 {
     ApplicationFactory::clear();
     NamespaceExaminer::clear();
     PropertyRegistry::clear();
     Settings::clear();
     Exporter::getInstance()->clear();
     parent::tearDown();
 }
开发者ID:brandonphuong,项目名称:mediawiki,代码行数:9,代码来源:MwDBaseUnitTestCase.php

示例8: testChunkedTriples

 public function testChunkedTriples()
 {
     $expNsResource = new ExpNsResource('Redirect', Exporter::getInstance()->getNamespaceUri('wiki'), 'Redirect');
     $semanticData = new SemanticData(new DIWikiPage('Foo', NS_MAIN));
     $redirectLookup = $this->getMockBuilder('\\SMW\\SPARQLStore\\RedirectLookup')->disableOriginalConstructor()->getMock();
     $redirectLookup->expects($this->atLeastOnce())->method('findRedirectTargetResource')->will($this->returnValue($expNsResource));
     $instance = new TurtleTriplesBuilder($semanticData, $redirectLookup);
     $instance->setTriplesChunkSize(1);
     $this->assertInternalType('array', $instance->getChunkedTriples());
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:10,代码来源:TurtleTriplesBuilderTest.php

示例9: testExportPageWithNumericProperty

 public function testExportPageWithNumericProperty()
 {
     $semanticData = $this->semanticDataFactory->newEmptySemanticData(__METHOD__);
     $property = new DIProperty('123');
     $semanticData->addPropertyObjectValue($property, new DIWikiPage('345', NS_MAIN));
     $exportData = Exporter::makeExportData($semanticData);
     $expectedProperty = new ExpNsResource(Exporter::getInstance()->getEncodedPropertyNamespace() . '123', Exporter::getNamespaceUri('wiki'), 'wiki', new DIWikiPage('123', SMW_NS_PROPERTY));
     $this->assertCount(1, $exportData->getValues($expectedProperty));
     $this->exportDataValidator->assertThatExportDataContainsProperty($expectedProperty, $exportData);
     $expectedResourceElement = new ExpNsResource('345', Exporter::getNamespaceUri('wiki'), 'wiki', new DIWikiPage('345', NS_MAIN));
     $this->exportDataValidator->assertThatExportDataContainsResource($expectedResourceElement, $expectedProperty, $exportData);
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:12,代码来源:ExportSemanticDataTest.php

示例10: tearDown

 protected function tearDown()
 {
     // If setUp is skipped early this might not be initialized
     if ($this->testEnvironment !== null) {
         $this->testEnvironment->tearDown();
     }
     ApplicationFactory::clear();
     NamespaceExaminer::clear();
     PropertyRegistry::clear();
     Settings::clear();
     Exporter::getInstance()->clear();
     parent::tearDown();
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:13,代码来源:MwDBaseUnitTestCase.php

示例11: addListenersToCollection

 private function addListenersToCollection()
 {
     $this->eventListenerCollection->registerCallback('exporter.reset', function () {
         Exporter::getInstance()->clear();
     });
     $this->eventListenerCollection->registerCallback('property.spec.change', function ($dispatchContext) {
         $subject = $dispatchContext->get('subject');
         $updateDispatcherJob = ApplicationFactory::getInstance()->newJobFactory()->newUpdateDispatcherJob($subject->getTitle());
         $updateDispatcherJob->run();
         Exporter::getInstance()->resetCacheFor($subject);
         $dispatchContext->set('propagationstop', true);
     });
     return $this->eventListenerCollection;
 }
开发者ID:brandonphuong,项目名称:mediawiki,代码行数:14,代码来源:EventListenerRegistry.php

示例12: testDeleteSubjectOnMockBaseStore

 public function testDeleteSubjectOnMockBaseStore()
 {
     $title = Title::newFromText('DeleteSubjectOnMockBaseStore');
     $expResource = Exporter::getInstance()->getDataItemExpElement(DIWikiPage::newFromTitle($title));
     $resourceUri = TurtleSerializer::getTurtleNameForExpElement($expResource);
     $extraNamespaces = array($expResource->getNamespaceId() => $expResource->getNamespace());
     $baseStore = $this->getMockBuilder('\\SMWStore')->disableOriginalConstructor()->getMockForAbstractClass();
     $baseStore->expects($this->once())->method('deleteSubject')->with($this->equalTo($title))->will($this->returnValue(true));
     $sparqlDatabase = $this->getMockBuilder('\\SMWSparqlDatabase')->disableOriginalConstructor()->getMock();
     $sparqlDatabase->expects($this->once())->method('deleteContentByValue')->will($this->returnValue(true));
     $sparqlDatabase->expects($this->once())->method('delete')->with($this->equalTo("{$resourceUri} ?p ?o"), $this->equalTo("{$resourceUri} ?p ?o"), $this->equalTo($extraNamespaces))->will($this->returnValue(true));
     $connectionManager = $this->getMockBuilder('\\SMW\\ConnectionManager')->disableOriginalConstructor()->getMock();
     $connectionManager->expects($this->any())->method('getConnection')->will($this->returnValue($sparqlDatabase));
     $instance = new SPARQLStore($baseStore);
     $instance->setConnectionManager($connectionManager);
     $instance->deleteSubject($title);
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:17,代码来源:SPARQLStoreTest.php

示例13: registerStateChangeEvents

 private function registerStateChangeEvents()
 {
     /**
      * Emitted during PropertySpecificationChangeNotifier::notifyDispatcher
      */
     $this->eventListenerCollection->registerCallback('property.specification.change', function ($dispatchContext) {
         $applicationFactory = ApplicationFactory::getInstance();
         $subject = $dispatchContext->get('subject');
         $updateDispatcherJob = $applicationFactory->newJobFactory()->newUpdateDispatcherJob($subject->getTitle());
         $updateDispatcherJob->run();
         Exporter::getInstance()->resetCacheBy($subject);
         $applicationFactory->getPropertySpecificationLookup()->resetCacheBy($subject);
         $dispatchContext->set('propagationstop', true);
     });
     /**
      * Emitted during Store::updateData
      */
     $this->eventListenerCollection->registerCallback('on.before.semanticdata.update.complete', function ($dispatchContext) {
         $subject = $dispatchContext->get('subject');
         $hash = $subject->getHash();
         $applicationFactory = ApplicationFactory::getInstance();
         $poolCache = $applicationFactory->getInMemoryPoolCache()->getPoolCacheFor('store.redirectTarget.lookup');
         $poolCache->delete($hash);
         $dispatchContext->set('propagationstop', true);
     });
     /**
      * Emitted during Store::updateData
      */
     $this->eventListenerCollection->registerCallback('on.after.semanticdata.update.complete', function ($dispatchContext) {
         $applicationFactory = ApplicationFactory::getInstance();
         $subject = $dispatchContext->get('subject');
         $pageUpdater = $applicationFactory->newMwCollaboratorFactory()->newPageUpdater();
         if ($GLOBALS['smwgAutoRefreshSubject'] && $pageUpdater->canUpdate()) {
             $pageUpdater->addPage($subject->getTitle());
             $deferredCallableUpdate = $applicationFactory->newDeferredCallableUpdate(function () use($pageUpdater) {
                 $pageUpdater->doPurgeParserCache();
                 $pageUpdater->doPurgeHtmlCache();
             });
             $deferredCallableUpdate->setOrigin('Event on.after.semanticdata.update.complete doPurgeParserCache for ' . $subject->getHash());
             $deferredCallableUpdate->pushToUpdateQueue();
         }
         $dispatchContext->set('propagationstop', true);
     });
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:44,代码来源:EventListenerRegistry.php

示例14: addListenersToCollection

 private function addListenersToCollection()
 {
     $this->eventListenerCollection->registerCallback('factbox.cache.delete', function ($dispatchContext) {
         $title = $dispatchContext->get('title');
         $cache = ApplicationFactory::getInstance()->getCache();
         $cache->delete(ApplicationFactory::getInstance()->newCacheFactory()->getFactboxCacheKey($title->getArticleID()));
     });
     $this->eventListenerCollection->registerCallback('exporter.reset', function () {
         Exporter::getInstance()->clear();
     });
     $this->eventListenerCollection->registerCallback('query.comparator.reset', function () {
         QueryComparator::getInstance()->clear();
     });
     $this->eventListenerCollection->registerCallback('property.spec.change', function ($dispatchContext) {
         $subject = $dispatchContext->get('subject');
         $updateDispatcherJob = ApplicationFactory::getInstance()->newJobFactory()->newUpdateDispatcherJob($subject->getTitle());
         $updateDispatcherJob->run();
         Exporter::getInstance()->resetCacheFor($subject);
         $dispatchContext->set('propagationstop', true);
     });
     return $this->eventListenerCollection;
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:22,代码来源:EventListenerRegistry.php

示例15: diWikiPageProvider

 public function diWikiPageProvider()
 {
     // Constant
     $wiki = \SMWExporter::getInstance()->getNamespaceUri('wiki');
     $property = \SMWExporter::getInstance()->getNamespaceUri('property');
     #0
     $provider[] = array(new DIWikiPage('Foo', NS_MAIN, '', ''), '', array('type' => Element::TYPE_NSRESOURCE, 'uri' => "Foo|{$wiki}|wiki", 'dataitem' => array('type' => 9, 'item' => 'Foo#0#')));
     #1
     $provider[] = array(new DIWikiPage('Foo', NS_MAIN, 'bar', ''), '', array('type' => Element::TYPE_NSRESOURCE, 'uri' => "bar-3AFoo|{$wiki}|wiki", 'dataitem' => array('type' => 9, 'item' => 'Foo#0#bar')));
     #2
     $provider[] = array(new DIWikiPage('Foo', NS_MAIN, 'bar', '1234'), '', array('type' => Element::TYPE_NSRESOURCE, 'uri' => "bar-3AFoo-231234|{$wiki}|wiki", 'dataitem' => array('type' => 9, 'item' => 'Foo#0#bar#1234')));
     #3 Extra modififer doesn't not alter the object when a subobject is used
     $provider[] = array(new DIWikiPage('Foo', NS_MAIN, 'bar', '1234'), 'abc', array('type' => Element::TYPE_NSRESOURCE, 'uri' => "bar-3AFoo-231234|{$wiki}|wiki", 'dataitem' => array('type' => 9, 'item' => 'Foo#0#bar#1234')));
     #4
     $provider[] = array(new DIWikiPage('Foo', SMW_NS_PROPERTY, '', ''), '', array('type' => Element::TYPE_NSRESOURCE, 'uri' => "Foo|{$property}|property", 'dataitem' => array('type' => 9, 'item' => 'Foo#102#')));
     #5
     $provider[] = array(new DIWikiPage('Foo', SMW_NS_PROPERTY, '', ''), true, array('type' => Element::TYPE_NSRESOURCE, 'uri' => "Foo-23aux|{$property}|property", 'dataitem' => array('type' => 9, 'item' => 'Foo#102#')));
     #6
     $name = Escaper::encodePage(new DIWikiPage('-Foo', SMW_NS_PROPERTY, '', ''));
     $provider[] = array(new DIWikiPage('-Foo', SMW_NS_PROPERTY, '', ''), true, array('type' => Element::TYPE_NSRESOURCE, 'uri' => "{$name}-23aux|{$wiki}|wiki", 'dataitem' => array('type' => 9, 'item' => '-Foo#102#')));
     return $provider;
 }
开发者ID:jdforrester,项目名称:SemanticMediaWiki,代码行数:22,代码来源:DataItemToExpResourceEncoderTest.php


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