/**
  * @since 2.1
  *
  * @param integer $id
  *
  * @return DIWikiPage|null
  */
 public function getDataItemForId($id)
 {
     $poolCache = $this->inMemoryPoolCache->getPoolCacheFor('sql.store.dataitem.finder');
     if (!$poolCache->contains($id)) {
         $row = $this->connection->selectRow(\SMWSQLStore3::ID_TABLE, array('smw_title', 'smw_namespace', 'smw_iw', 'smw_subobject'), array('smw_id' => $id), __METHOD__);
         if ($row === false) {
             return null;
         }
         $hash = HashBuilder::createHashIdFromSegments($row->smw_title, $row->smw_namespace, $row->smw_iw, $row->smw_subobject);
         $this->saveToCache($id, $hash);
     }
     return HashBuilder::newDiWikiPageFromHash($poolCache->fetch($id));
 }
 /**
  * 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;
 }
 /**
  * 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;
 }
 /**
  * @since 2.1
  *
  * @param string $title
  * @param integer $namespace
  */
 public function deleteRedirectEntry($title, $namespace)
 {
     $this->delete($title, $namespace);
     $hash = HashBuilder::createHashIdFromSegments($title, $namespace);
     $this->inMemoryPoolCache->getPoolCacheFor('sql.store.redirect.infostore')->delete($hash);
 }