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


PHP DIWikiPage::getSubobjectName方法代码示例

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


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

示例1: 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

示例2: mapWikiPageToResourceElement

 /**
  * Create an ExpElement for some internal resource, given by an
  * DIWikiPage object. This is the one place in the code where URIs
  * of wiki pages and user-defined properties are determined. A modifier
  * can be given to make variants of a URI, typically done for
  * auxiliary properties. In this case, the URI is modiied by appending
  * "-23$modifier" where "-23" is the URI encoding of "#" (a symbol not
  * occuring in MW titles).
  *
  * @param DIWikiPage $diWikiPage
  * @param boolean $markForAuxiliaryUsage
  *
  * @return ExpResource
  */
 public function mapWikiPageToResourceElement(DIWikiPage $diWikiPage, $markForAuxiliaryUsage = false)
 {
     $modifier = $markForAuxiliaryUsage ? self::AUX_MARKER : '';
     $hash = $this->cachePrefix . $diWikiPage->getHash() . $modifier;
     // If a persistent cache is injected use the ExpElement serializer because
     // not all cache layers support object de/serialization
     // ExpElement::newFromSerialization
     if ($this->cache->contains($hash)) {
         return $this->cache->fetch($hash);
     }
     if ($diWikiPage->getSubobjectName() !== '') {
         $modifier = $diWikiPage->getSubobjectName();
     }
     $importDataItem = $this->tryToFindImportDataItem($diWikiPage, $modifier);
     if ($importDataItem instanceof DataItem) {
         list($localName, $namespace, $namespaceId) = $this->defineElementsForImportDataItem($importDataItem);
     } else {
         list($localName, $namespace, $namespaceId) = $this->defineElementsForDiWikiPage($diWikiPage, $modifier);
     }
     $resource = new ExpNsResource($localName, $namespace, $namespaceId, $diWikiPage);
     $this->cache->save($hash, $resource);
     return $resource;
 }
开发者ID:brandonphuong,项目名称:mediawiki,代码行数:37,代码来源:CachedDataItemToExpResourceEncoder.php

示例3: getProperties

 /**
  * @see Store::getProperties
  *
  * @param DIWikiPage $subject
  * @param SMWRequestOptions|null $requestOptions
  *
  * @return SMWDataItem[]
  */
 public function getProperties(DIWikiPage $subject, SMWRequestOptions $requestOptions = null)
 {
     $sid = $this->store->smwIds->getSMWPageID($subject->getDBkey(), $subject->getNamespace(), $subject->getInterwiki(), $subject->getSubobjectName());
     if ($sid == 0) {
         // no id, no page, no properties
         return array();
     }
     $db = $this->store->getConnection();
     $result = array();
     // potentially need to get more results, since options apply to union
     if ($requestOptions !== null) {
         $suboptions = clone $requestOptions;
         $suboptions->limit = $requestOptions->limit + $requestOptions->offset;
         $suboptions->offset = 0;
     } else {
         $suboptions = null;
     }
     foreach ($this->store->getPropertyTables() as $propertyTable) {
         if ($propertyTable->usesIdSubject()) {
             $where = 's_id=' . $db->addQuotes($sid);
         } elseif ($subject->getInterwiki() === '') {
             $where = 's_title=' . $db->addQuotes($subject->getDBkey()) . ' AND s_namespace=' . $db->addQuotes($subject->getNamespace());
         } else {
             // subjects with non-emtpy interwiki cannot have properties
             continue;
         }
         if ($propertyTable->isFixedPropertyTable()) {
             // just check if subject occurs in table
             $res = $db->select($propertyTable->getName(), '*', $where, __METHOD__, array('LIMIT' => 1));
             if ($db->numRows($res) > 0) {
                 $result[] = new SMW\DIProperty($propertyTable->getFixedProperty());
             }
         } else {
             // select all properties
             $from = $db->tableName($propertyTable->getName());
             $from .= " INNER JOIN " . $db->tableName(SMWSql3SmwIds::TABLE_NAME) . " ON smw_id=p_id";
             $res = $db->select($from, 'DISTINCT smw_title,smw_sortkey', $where . $this->store->getSQLConditions($suboptions, 'smw_sortkey', 'smw_sortkey'), __METHOD__, $this->store->getSQLOptions($suboptions, 'smw_sortkey'));
             foreach ($res as $row) {
                 $result[] = new SMW\DIProperty($row->smw_title);
             }
         }
         $db->freeResult($res);
     }
     // apply options to overall result
     $result = $this->store->applyRequestOptions($result, $requestOptions);
     return $result;
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:55,代码来源:SMW_SQLStore3_Readers.php

示例4: updateInterwikiField

 /**
  * @since  2.1
  *
  * @param integer $sid
  * @param DIWikiPage $subject
  * @param integer|string|null $interWiki
  */
 public function updateInterwikiField($sid, DIWikiPage $subject, $interWiki = null)
 {
     $this->store->getConnection()->update(self::tableName, array('smw_iw' => $interWiki !== null ? $interWiki : $subject->getInterWiki()), array('smw_id' => $sid), __METHOD__);
     $this->setCache($subject->getDBKey(), $subject->getNamespace(), $subject->getInterWiki(), $subject->getSubobjectName(), $sid, $subject->getSortKey());
 }
开发者ID:bogota,项目名称:SemanticMediaWiki,代码行数:12,代码来源:SMW_Sql3SmwIds.php

示例5: addPropertyObjectValue

 /**
  * Store a value for a property identified by its SMWDataItem object.
  *
  * @note There is no check whether the type of the given data item
  * agrees with the type of the property. Since property types can
  * change, all parts of SMW are prepared to handle mismatched data item
  * types anyway.
  *
  * @param $property DIProperty
  * @param $dataItem SMWDataItem
  */
 public function addPropertyObjectValue(DIProperty $property, SMWDataItem $dataItem)
 {
     $this->hash = null;
     if ($dataItem instanceof SMWDIContainer) {
         $this->addSubSemanticData($dataItem->getSemanticData());
         $dataItem = $dataItem->getSemanticData()->getSubject();
     }
     if ($property->isInverse()) {
         // inverse properties cannot be used for annotation
         return;
     }
     if (!array_key_exists($property->getKey(), $this->mPropVals)) {
         $this->mPropVals[$property->getKey()] = array();
         $this->mProperties[$property->getKey()] = $property;
     }
     if ($this->mNoDuplicates) {
         $this->mPropVals[$property->getKey()][$dataItem->getHash()] = $dataItem;
     } else {
         $this->mPropVals[$property->getKey()][] = $dataItem;
     }
     if (!$property->isUserDefined()) {
         if ($property->isShown()) {
             $this->mHasVisibleSpecs = true;
             $this->mHasVisibleProps = true;
         }
     } else {
         $this->mHasVisibleProps = true;
     }
     // Inherit the sortkey from the root if not explicitly given
     if ($this->mSubject->getSubobjectName() === '' && $property->getKey() === DIProperty::TYPE_SORTKEY) {
         foreach ($this->subSemanticData as $subSemanticData) {
             if (!$subSemanticData->hasProperty($property)) {
                 $subSemanticData->addPropertyObjectValue($property, $dataItem);
             }
         }
     }
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:48,代码来源:SemanticData.php

示例6: mapWikiPageToResourceElement

 /**
  * Create an ExpElement for some internal resource, given by an
  * DIWikiPage object. This is the one place in the code where URIs
  * of wiki pages and user-defined properties are determined. A modifier
  * can be given to make variants of a URI, typically done for
  * auxiliary properties. In this case, the URI is modiied by appending
  * "-23$modifier" where "-23" is the URI encoding of "#" (a symbol not
  * occuring in MW titles).
  *
  * @param DIWikiPage $diWikiPage
  * @param boolean $useAuxiliaryModifier
  *
  * @return ExpResource
  */
 public function mapWikiPageToResourceElement(DIWikiPage $diWikiPage, $useAuxiliaryModifier = false)
 {
     $modifier = $useAuxiliaryModifier ? self::AUX_MARKER : '';
     $hash = $diWikiPage->getHash() . $modifier;
     $poolCache = $this->inMemoryPoolCache->getPoolCacheFor('exporter.dataitem.resource.encoder');
     if ($poolCache->contains($hash)) {
         return $poolCache->fetch($hash);
     }
     if ($diWikiPage->getSubobjectName() !== '') {
         $modifier = $diWikiPage->getSubobjectName();
     }
     $importDataItem = $this->tryToFindImportDataItem($diWikiPage, $modifier);
     if ($importDataItem instanceof DataItem) {
         list($localName, $namespace, $namespaceId) = $this->defineElementsForImportDataItem($importDataItem);
     } else {
         list($localName, $namespace, $namespaceId) = $this->defineElementsForDiWikiPage($diWikiPage, $modifier);
     }
     $resource = new ExpNsResource($localName, $namespace, $namespaceId, $diWikiPage);
     $poolCache->save($hash, $resource);
     return $resource;
 }
开发者ID:Rikuforever,项目名称:wiki,代码行数:35,代码来源:DataItemToExpResourceEncoder.php

示例7: getHashIdForDiWikiPage

 /**
  * @since 2.1
  *
  * @param DIWikiPage $dataItem
  *
  * @return string
  */
 public static function getHashIdForDiWikiPage(DIWikiPage $dataItem)
 {
     return self::createFromSegments($dataItem->getDBKey(), $dataItem->getNamespace(), $dataItem->getInterwiki(), $dataItem->getSubobjectName());
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:11,代码来源:HashBuilder.php

示例8: mapWikiPageToResourceElement

 /**
  * Create an ExpElement for some internal resource, given by an
  * DIWikiPage object. This is the one place in the code where URIs
  * of wiki pages and user-defined properties are determined. A modifier
  * can be given to make variants of a URI, typically done for
  * auxiliary properties. In this case, the URI is modiied by appending
  * "-23$modifier" where "-23" is the URI encoding of "#" (a symbol not
  * occuring in MW titles).
  *
  * @param DIWikiPage $diWikiPage
  * @param boolean $useAuxiliaryModifier
  *
  * @return ExpResource
  */
 public function mapWikiPageToResourceElement(DIWikiPage $diWikiPage, $useAuxiliaryModifier = false)
 {
     $modifier = $useAuxiliaryModifier ? self::AUX_MARKER : '';
     $hash = $diWikiPage->getHash() . $modifier;
     $poolCache = $this->inMemoryPoolCache->getPoolCacheFor('exporter.dataitem.resource.encoder');
     if ($poolCache->contains($hash)) {
         return $poolCache->fetch($hash);
     }
     if ($diWikiPage->getSubobjectName() !== '') {
         $modifier = $diWikiPage->getSubobjectName();
     }
     $resource = $this->newExpNsResource($diWikiPage, $modifier);
     $poolCache->save($hash, $resource);
     return $resource;
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:29,代码来源:DataItemToExpResourceEncoder.php


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