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


PHP SMWExporter::getNamespaceUri方法代码示例

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


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

示例1: testBuildTriplesForEmptySemanticDataContainer

 public function testBuildTriplesForEmptySemanticDataContainer()
 {
     $expNsResource = new ExpNsResource('Redirect', Exporter::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);
     $this->assertTrue($instance->doBuild()->hasTriplesForUpdate());
     $this->assertInternalType('string', $instance->getTriples());
     $this->assertInternalType('array', $instance->getPrefixes());
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:11,代码来源:TurtleTriplesBuilderTest.php

示例2: getPrefixString

	/**
	 * Create the standard PREFIX declarations for SPARQL or Turtle,
	 * possibly with additional namespaces involved.
	 *
	 * @param $extraNamespaces array (associative) of namespaceId => namespaceUri
	 * @param $forSparql boolean true to use SPARQL prefix syntax, false to use Turtle prefix syntax
	 */
	public static function getPrefixString( $extraNamespaces = array(), $forSparql = true ) {
		$prefixString = '';
		$prefixIntro = $forSparql ? 'PREFIX ' : '@prefix ';
		$prefixOutro = $forSparql ? "\n" : " .\n";
		foreach ( array( 'wiki', 'rdf', 'rdfs', 'owl', 'swivt', 'property', 'xsd' ) as $shortname ) {
			$prefixString .= "{$prefixIntro}{$shortname}: <" . SMWExporter::getNamespaceUri( $shortname ) . ">$prefixOutro";
			unset( $extraNamespaces[$shortname] ); // avoid double declaration
		}
		foreach ( $extraNamespaces as $shortname => $uri ) {
			$prefixString .= "{$prefixIntro}{$shortname}: <$uri>$prefixOutro";
		}
		return $prefixString;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:20,代码来源:SMW_SparqlDatabase.php

示例3: getSparqlRedirectTarget

 /**
  * Find the redirect target of an SMWExpNsResource.
  * Returns an SMWExpNsResource object the input redirects to,
  * the input itself if there is no redirect (or it cannot be
  * used for making a resource with a prefix).
  *
  * @since 1.6
  * @param $expNsResource string URI to check
  * @param $exists boolean that is set to true if $expNsResource is in the
  * store; always false for blank nodes; always true for subobjects
  * @return SMWExpNsResource
  */
 protected function getSparqlRedirectTarget(SMWExpNsResource $expNsResource, &$exists)
 {
     if ($expNsResource->isBlankNode()) {
         $exists = false;
         return $expNsResource;
     } elseif ($expNsResource->getDataItem() instanceof SMWDIWikiPage && $expNsResource->getDataItem()->getSubobjectName() !== '') {
         $exists = true;
         return $expNsResource;
     }
     $resourceUri = SMWTurtleSerializer::getTurtleNameForExpElement($expNsResource);
     $rediUri = SMWTurtleSerializer::getTurtleNameForExpElement(SMWExporter::getSpecialPropertyResource('_REDI'));
     $skeyUri = SMWTurtleSerializer::getTurtleNameForExpElement(SMWExporter::getSpecialPropertyResource('_SKEY'));
     $sparqlResult = smwfGetSparqlDatabase()->select('*', "{$resourceUri} {$skeyUri} ?s  OPTIONAL { {$resourceUri} {$rediUri} ?r }", array('LIMIT' => 1), array($expNsResource->getNamespaceId() => $expNsResource->getNamespace()));
     $firstRow = $sparqlResult->current();
     if ($firstRow === false) {
         $exists = false;
         return $expNsResource;
     } elseif (count($firstRow) > 1 && !is_null($firstRow[1])) {
         $exists = true;
         $rediTargetElement = $firstRow[1];
         $rediTargetUri = $rediTargetElement->getUri();
         $wikiNamespace = SMWExporter::getNamespaceUri('wiki');
         if (strpos($rediTargetUri, $wikiNamespace) === 0) {
             return new SMWExpNsResource(substr($rediTargetUri, 0, strlen($wikiNamespace)), $wikiNamespace, 'wiki');
         } else {
             return $expNsResource;
         }
     } else {
         $exists = true;
         return $expNsResource;
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:44,代码来源:SMW_SparqlStore.php

示例4: resourceProvider

 public function resourceProvider()
 {
     $provider[] = array(Exporter::getSpecialNsResource('rdf', 'type'));
     $provider[] = array(new ExpNsResource('FooRedirectLookup', Exporter::getNamespaceUri('property'), 'property', new DIWikiPage('FooRedirectLookup', SMW_NS_PROPERTY, '')));
     return $provider;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:6,代码来源:RedirectLookupIntegrationTest.php

示例5: getResourceForTargetElement

 private function getResourceForTargetElement(ExpNsResource $expNsResource, $rediTargetElement)
 {
     if (!$rediTargetElement instanceof ExpResource) {
         throw new RuntimeException('Expected a ExpResource instance');
     }
     $rediTargetUri = $rediTargetElement->getUri();
     $wikiNamespace = Exporter::getNamespaceUri('wiki');
     if (strpos($rediTargetUri, $wikiNamespace) === 0) {
         return new ExpNsResource(substr($rediTargetUri, strlen($wikiNamespace)), $wikiNamespace, 'wiki');
     }
     return $expNsResource;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:12,代码来源:RedirectLookup.php

示例6: testExportSubobject

 public function testExportSubobject()
 {
     $semanticData = $this->semanticDataFactory->newEmptySemanticData(__METHOD__);
     $subobject = new Subobject($semanticData->getSubject()->getTitle());
     $subobject->setEmptyContainerForId('Foo');
     $semanticData->addPropertyObjectValue($subobject->getProperty(), $subobject->getContainer());
     $exportData = Exporter::makeExportData($semanticData);
     $expectedProperty = new ExpNsResource($this->transformPropertyLabelToAuxiliary($subobject->getProperty()), Exporter::getNamespaceUri('property'), 'property', new DIWikiPage('Has_subobject', SMW_NS_PROPERTY));
     $this->assertTrue(Exporter::hasHelperExpElement($subobject->getProperty()));
     $this->assertCount(1, $exportData->getValues($expectedProperty));
     $this->exportDataValidator->assertThatExportDataContainsProperty($expectedProperty, $exportData);
     $expectedResource = new ExpNsResource(Exporter::getEncodedPageName($subobject->getSemanticData()->getSubject()) . '-23' . 'Foo', Exporter::getNamespaceUri('wiki'), 'wiki', $subobject->getSemanticData()->getSubject());
     $this->exportDataValidator->assertThatExportDataContainsResource($expectedResource, $expectedProperty, $exportData);
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:14,代码来源:ExportSemanticDataTest.php

示例7: testFindDataItemForExpElement

 /**
  * @dataProvider uriDataItemProvider
  * #378
  */
 public function testFindDataItemForExpElement($uri, $expectedDataItem)
 {
     $uri = Exporter::getNamespaceUri('wiki') . $uri;
     $this->assertEquals($expectedDataItem, Exporter::findDataItemForExpElement(new ExpResource($uri)));
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:9,代码来源:SMWExporterTest.php

示例8: testRedirectTragetForDBLookupWithMultipleEntriesForcesNewResource

 public function testRedirectTragetForDBLookupWithMultipleEntriesForcesNewResource()
 {
     $propertyPage = new DIWikiPage('Foo', SMW_NS_PROPERTY);
     $resource = new ExpNsResource('Foo', Exporter::getNamespaceUri('property'), 'property', $propertyPage);
     $sparqlDatabase = $this->createMockSparqlDatabaseFor(array($resource, $resource));
     $instance = new RedirectLookup($sparqlDatabase);
     $instance->clear();
     $dataItem = new DIWikiPage('Foo', 1, '', '');
     $expNsResource = new ExpNsResource('Foo', 'Bar', '', $dataItem);
     $exists = null;
     $targetResource = $instance->findRedirectTargetResource($expNsResource, $exists);
     $this->assertNotSame($expNsResource, $targetResource);
     $expectedResource = new ExpNsResource(Exporter::getInstance()->getEncodedPageName($propertyPage), Exporter::getNamespaceUri('wiki'), 'wiki');
     $this->assertEquals($expectedResource, $targetResource);
     $this->assertTrue($exists);
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:16,代码来源:RedirectLookupTest.php


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