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


PHP SemanticData::getSubSemanticData方法代码示例

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


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

示例1: createFromSemanticData

 /**
  * @since 2.4
  *
  * @param SemanticData $semanticData
  *
  * @return string
  */
 public static function createFromSemanticData(SemanticData $semanticData)
 {
     $hash = array();
     $hash[] = $semanticData->getSubject()->getSerialization();
     foreach ($semanticData->getProperties() as $property) {
         $hash[] = $property->getKey();
         foreach ($semanticData->getPropertyValues($property) as $di) {
             $hash[] = $di->getSerialization();
         }
     }
     foreach ($semanticData->getSubSemanticData() as $data) {
         $hash[] = $data->getHash();
     }
     sort($hash);
     return md5(implode('#', $hash));
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:23,代码来源:HashBuilder.php

示例2: testAddAndRemoveSubSemanticData

 public function testAddAndRemoveSubSemanticData()
 {
     $title = Title::newFromText(__METHOD__);
     $instance = new SemanticData(DIWikiPage::newFromTitle($title));
     // Adds only a subobject reference to the container
     $subobject = $this->newSubobject($title);
     $instance->addSubobject($subobject);
     $this->assertInternalType('array', $instance->getSubSemanticData());
     foreach ($instance->getSubSemanticData() as $subSemanticData) {
         $this->assertInstanceOf('SMWContainerSemanticData', $subSemanticData);
         $this->assertEquals($subSemanticData, $subobject->getSemanticData());
     }
     $instance->removeSubSemanticData($subobject->getSemanticData());
     $this->assertNotInstanceOf('SMWContainerSemanticData', $instance->getSubSemanticData());
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:15,代码来源:SemanticDataTest.php

示例3: removeDataFrom

 /**
  * Removes data from the given SMWSemanticData.
  * If the subject of the data that is to be removed is not equal to the
  * subject of this SMWSemanticData, it will just be ignored (nothing to
  * remove). Likewise, removing data that is not present does not change
  * anything.
  *
  * @since 1.8
  *
  * @param SemanticData $semanticData
  */
 public function removeDataFrom(SemanticData $semanticData)
 {
     if (!$this->mSubject->equals($semanticData->getSubject())) {
         return;
     }
     foreach ($semanticData->getProperties() as $property) {
         $values = $semanticData->getPropertyValues($property);
         foreach ($values as $dataItem) {
             $this->removePropertyObjectValue($property, $dataItem);
         }
     }
     foreach ($semanticData->getSubSemanticData() as $semData) {
         $this->removeSubSemanticData($semData);
     }
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:26,代码来源:SemanticData.php


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