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


PHP SMW\DIProperty类代码示例

本文整理汇总了PHP中SMW\DIProperty的典型用法代码示例。如果您正苦于以下问题:PHP DIProperty类的具体用法?PHP DIProperty怎么用?PHP DIProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testCorrectInversePrefixForPredefinedProperty

 public function testCorrectInversePrefixForPredefinedProperty()
 {
     $property = new DIProperty('_SOBJ', true);
     $this->assertTrue($property->isInverse());
     $label = $property->getLabel();
     $this->assertEquals('-', $label[0]);
 }
开发者ID:Rikuforever,项目名称:wiki,代码行数:7,代码来源:DIPropertyTest.php

示例2: testPredefinedProperty

 public function testPredefinedProperty()
 {
     $instance = new HashBuilder();
     $property = new DIProperty('_MDAT');
     $dataItem = $property->getDiWikiPage();
     $this->assertEquals($dataItem, $instance->newDiWikiPageFromHash($instance->getHashIdForDiWikiPage($dataItem)));
     $this->assertEquals($dataItem, $instance->newDiWikiPageFromHash($instance->createHashIdFromSegments($property->getKey(), SMW_NS_PROPERTY)));
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:8,代码来源:HashBuilderTest.php

示例3: findBasePropertyToRedirectFor

 private function findBasePropertyToRedirectFor($label)
 {
     $property = new DIProperty(PropertyRegistry::getInstance()->findPropertyIdByLabel($label));
     if ($property->getLabel() !== '' && $label !== $property->getLabel()) {
         $outputPage = $this->getContext()->getOutput();
         $outputPage->redirect($property->getDiWikiPage()->getTitle()->getFullURL());
     }
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:8,代码来源:SMW_OrderedListPage.php

示例4: testAddUserDefinedBlobPropertyAsObjectToSemanticDataForStorage

 public function testAddUserDefinedBlobPropertyAsObjectToSemanticDataForStorage()
 {
     $property = new DIProperty('SomeBlobProperty');
     $property->setPropertyTypeId('_txt');
     $this->subjects[] = $subject = DIWikiPage::newFromTitle(Title::newFromText(__METHOD__));
     $semanticData = new SemanticData($subject);
     $semanticData->addPropertyObjectValue($property, new DIBlob('SomePropertyBlobValue'));
     $this->getStore()->updateData($semanticData);
     $this->assertArrayHasKey($property->getKey(), $this->getStore()->getSemanticData($subject)->getProperties());
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:10,代码来源:SemanticDataStorageDBIntegrationTest.php

示例5: getContainerFor

 /**
  * @since 2.4
  *
  * @param DIProperty $property
  * @param array|string $errorMsg
  *
  * @return DIContainer
  */
 public function getContainerFor(DIProperty $property = null, $errorMsg = '')
 {
     if ($property !== null && $property->isInverse()) {
         $property = new DIProperty($property->getKey());
     }
     $errorMsg = is_array($errorMsg) ? implode(' ', $errorMsg) : $errorMsg;
     $subject = new DIWikiPage($this->subject->getDBkey(), $this->subject->getNamespace(), $this->subject->getInterwiki(), '_ERR' . md5(($property !== null ? $property->getKey() : 'UNKNOWN') . $errorMsg));
     // Encode brackets to avoid an annotion is created/included
     return $this->newDiContainer($subject, $property, InTextAnnotationParser::obscureAnnotation($errorMsg));
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:18,代码来源:Error.php

示例6: testDescendingOrderedQueryResult

 public function testDescendingOrderedQueryResult()
 {
     $expectedSubjects = array(new DIWikiPage('AA', NS_MAIN), new DIWikiPage('AB', NS_MAIN), new DIWikiPage('AC', NS_MAIN));
     $property = new DIProperty('SomeDescendingPageProperty');
     $property->setPropertyTypeId('_wpg');
     $query = $this->createQueryForSamplePagesThatContain($property, $expectedSubjects);
     $query->sort = true;
     $query->sortkeys = array($property->getKey() => 'DESC');
     $query->setUnboundLimit(50);
     $this->assertResultOrder(array_reverse($expectedSubjects), $this->getStore()->getQueryResult($query)->getResults());
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:11,代码来源:SortableQueryDBIntegrationTest.php

示例7: testUserDefinedPropertyUsedForInvalidValueAssignment

 public function testUserDefinedPropertyUsedForInvalidValueAssignment()
 {
     $property = new DIProperty('SomePropertyWithInvalidValueAssignment');
     $property->setPropertyTypeId('_tem');
     $dataValue = $this->dataValueFactory->newDataValueByProperty($property, '1 Jan 1970');
     $semanticData = $this->semanticDataFactory->newEmptySemanticData(__METHOD__);
     $semanticData->addDataValue($dataValue);
     $this->getStore()->updateData($semanticData);
     $this->assertEquals(0, $this->searchForResultsThatCompareEqualToOnlySingularPropertyOf($property)->getCount());
     $this->subjectsToBeCleared = array($semanticData->getSubject());
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:11,代码来源:GeneralQueryDBIntegrationTest.php

示例8: tryToFindAtLeastOneReferenceForProperty

 /**
  * @since 2.4
  *
  * @param DIProperty $property
  *
  * @return DataItem|false
  */
 public function tryToFindAtLeastOneReferenceForProperty(DIProperty $property)
 {
     $dataItem = $property->getDiWikiPage();
     $sid = $this->store->getObjectIds()->getSMWPageID($dataItem->getDBkey(), $dataItem->getNamespace(), $dataItem->getInterwiki(), '');
     // Lets see if we have some lower/upper case matching for
     // when wgCapitalLinks setting was involved
     if (!$this->usesCapitalLinks && $sid == 0) {
         $sid = $this->store->getObjectIds()->getSMWPageID(lcfirst($dataItem->getDBkey()), $dataItem->getNamespace(), $dataItem->getInterwiki(), '');
     }
     return $this->tryToFindAtLeastOneReferenceForId($sid);
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:18,代码来源:PropertyTableIdReferenceFinder.php

示例9: getPropertyValues

 /**
  * @since 2.4
  *
  * @param DIWikiPage $subject
  * @param DIProperty $property
  * @param RequestOptions|null $requestOptions
  *
  * @return array
  */
 public function getPropertyValues(DIWikiPage $subject, DIProperty $property, RequestOptions $requestOptions = null)
 {
     $key = $property->getKey() . ':' . $subject->getSubobjectName() . ':' . ($requestOptions !== null ? $requestOptions->getHash() : null);
     $container = $this->blobStore->read($this->getRootHashFrom($subject));
     if ($container->has($key)) {
         return $container->get($key);
     }
     $dataItems = $this->store->getPropertyValues($subject, $property, $requestOptions);
     $container->set($key, $dataItems);
     $this->blobStore->save($container);
     return $dataItems;
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:21,代码来源:CachedPropertyValuesPrefetcher.php

示例10: doCheckInternalPropertyIndices

 /**
  * Create some initial DB entries for important built-in properties. Having the DB contents predefined
  * allows us to safe DB calls when certain data is needed. At the same time, the entries in the DB
  * make sure that DB-based functions work as with all other properties.
  */
 private function doCheckInternalPropertyIndices($connection)
 {
     $this->messageReporter->reportMessage("\nSetting up internal property indices ...\n");
     $this->doCheckPredefinedPropertyBorder($connection);
     // now write actual properties; do that each time, it is cheap enough and we can update sortkeys by current language
     $this->messageReporter->reportMessage("   ... writing entries for internal properties ...\n");
     foreach (SMWSql3SmwIds::$special_ids as $prop => $id) {
         $property = new DIProperty($prop);
         $connection->replace(SQLStore::ID_TABLE, array('smw_id'), array('smw_id' => $id, 'smw_title' => $property->getKey(), 'smw_namespace' => SMW_NS_PROPERTY, 'smw_iw' => $this->store->getObjectIds()->getPropertyInterwiki($property), 'smw_subobject' => '', 'smw_sortkey' => $property->getCanonicalLabel()), __METHOD__);
     }
     $this->messageReporter->reportMessage("   ... done.\n");
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:17,代码来源:TableIntegrityExaminer.php

示例11: testFindSubpropertyList

 public function testFindSubpropertyList()
 {
     $property = new DIProperty('Foo');
     $store = $this->getMockBuilder('\\SMW\\Store')->disableOriginalConstructor()->getMockForAbstractClass();
     $store->expects($this->once())->method('getPropertySubjects')->with($this->equalTo(new DIProperty('_SUBP')), $this->equalTo($property->getDiWikiPage()), $this->anything())->will($this->returnValue(array(DIWikiPage::newFromText('Bar', SMW_NS_PROPERTY))));
     $cache = $this->getMockBuilder('\\Onoi\\Cache\\Cache')->disableOriginalConstructor()->getMock();
     $cache->expects($this->once())->method('contains')->will($this->returnValue(false));
     $cache->expects($this->once())->method('save')->with($this->equalTo('_SUBP#Foo#-1#0##1##1#'), $this->anything());
     $instance = new PropertyHierarchyLookup($store, $cache);
     $expected = array(DIWikiPage::newFromText('Bar', SMW_NS_PROPERTY));
     $this->assertEquals($expected, $instance->findSubpropertListFor($property));
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:12,代码来源:PropertyHierarchyLookupTest.php

示例12: addResourceValue

 /**
  * @since 2.5
  *
  * {@inheritDoc}
  */
 public function addResourceValue(ExpData $expData, DIProperty $property, DataItem $dataItem)
 {
     $diSubject = $expData->getSubject()->getDataItem();
     if ($diSubject === null) {
         return;
     }
     $expNsResource = $this->exporter->getSpecialPropertyResource($property->getKey(), $diSubject->getNamespace());
     $expElement = $this->exporter->getDataItemExpElement($dataItem);
     if ($expElement === null || $expNsResource === null) {
         return;
     }
     $expData->addPropertyObjectValue($expNsResource, $expElement);
     $this->addResourceHelperValue($expData, $property, $dataItem);
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:19,代码来源:PredefinedPropertyValueResourceBuilder.php

示例13: newDataValueForPagePropertyValue

 private function newDataValueForPagePropertyValue($property, $value)
 {
     $property = DIProperty::newFromUserLabel($property);
     $property->setPropertyTypeId('_wpg');
     $dataItem = new DIWikiPage($value, NS_MAIN, '');
     return $this->dataValueFactory->newDataItemValue($dataItem, $property);
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:7,代码来源:InversePropertyRelationshipDBIntegrationTest.php

示例14: testCreatePropertyFromLabelThatContainsInverseMarker

 public function testCreatePropertyFromLabelThatContainsInverseMarker()
 {
     $property = DIProperty::newFromUserLabel('-Foo');
     $property->setInterwiki('bar');
     $this->assertTrue($property->isInverse());
     $this->assertEquals(new DiWikiPage('Foo', SMW_NS_PROPERTY, 'bar'), $property->getDiWikiPage());
 }
开发者ID:jdforrester,项目名称:SemanticMediaWiki,代码行数:7,代码来源:DIPropertyTest.php

示例15: testRegister

 public function testRegister()
 {
     $instance = new PropertyRegistry();
     $instance->register();
     $this->assertNotEmpty(DIProperty::findPropertyLabel(PropertyRegistry::SBL_PARENTPAGE));
     $this->assertSame(SBL_PROP_PARENTPAGE, DIProperty::findPropertyLabel(PropertyRegistry::SBL_PARENTPAGE));
 }
开发者ID:brandonphuong,项目名称:mediawiki,代码行数:7,代码来源:PropertyRegistryTest.php


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