/**
  * @since 2.2
  *
  * @return QueryEngine
  */
 public function newMasterQueryEngine()
 {
     $engineOptions = new EngineOptions();
     $propertyHierarchyLookup = new PropertyHierarchyLookup($this->store, $this->applicationFactory->newCacheFactory()->newFixedInMemoryCache(500));
     $propertyHierarchyLookup->setSubcategoryDepth($this->applicationFactory->getSettings()->get('smwgQSubcategoryDepth'));
     $propertyHierarchyLookup->setSubpropertyDepth($this->applicationFactory->getSettings()->get('smwgQSubpropertyDepth'));
     $circularReferenceGuard = new CircularReferenceGuard('sparql-query');
     $circularReferenceGuard->setMaxRecursionDepth(2);
     $compoundConditionBuilder = new CompoundConditionBuilder($engineOptions);
     $compoundConditionBuilder->setCircularReferenceGuard($circularReferenceGuard);
     $compoundConditionBuilder->setPropertyHierarchyLookup($propertyHierarchyLookup);
     $queryEngine = new QueryEngine($this->store->getConnection('sparql'), $compoundConditionBuilder, new QueryResultFactory($this->store), $engineOptions);
     return $queryEngine;
 }
예제 #2
0
 /**
  * @note Article purge: In case an article was manually purged/moved
  * the store is updated as well; for all other cases LinksUpdateConstructed
  * will handle the store update
  *
  * @note The purge action is isolated from any other request therefore using
  * a static variable or any other messaging that is not persistent will not
  * work hence the reliance on the cache as temporary persistence marker
  */
 private function checkForRequestedUpdateByPagePurge($parserData)
 {
     $cache = $this->applicationFactory->getCache();
     $key = $this->applicationFactory->newCacheFactory()->getPurgeCacheKey($this->parser->getTitle()->getArticleID());
     if ($cache->contains($key)) {
         $cache->delete($key);
         $parserData->updateStore();
     }
     return true;
 }
 /**
  * @since 2.5
  *
  * @return EntityLookup
  */
 public function newEntityLookup()
 {
     $settings = $this->applicationFactory->getSettings();
     $directEntityLookup = new DirectEntityLookup($this->store);
     if ($settings->get('smwgValueLookupCacheType') === CACHE_NONE) {
         return $directEntityLookup;
     }
     $circularReferenceGuard = new CircularReferenceGuard('vl:store');
     $circularReferenceGuard->setMaxRecursionDepth(2);
     $cacheFactory = $this->applicationFactory->newCacheFactory();
     $blobStore = $cacheFactory->newBlobStore('smw:vl:store', $settings->get('smwgValueLookupCacheType'), $settings->get('smwgValueLookupCacheLifetime'));
     $cachedEntityLookup = new CachedEntityLookup($directEntityLookup, new RedirectTargetLookup($this->store, $circularReferenceGuard), $blobStore);
     $cachedEntityLookup->setCachedLookupFeatures($settings->get('smwgValueLookupFeatures'));
     return $cachedEntityLookup;
 }
예제 #4
0
 /**
  * @note Article purge: In case an article was manually purged/moved
  * the store is updated as well; for all other cases LinksUpdateConstructed
  * will handle the store update
  *
  * @note The purge action is isolated from any other request therefore using
  * a static variable or any other messaging that is not persistent will not
  * work hence the reliance on the cache as temporary persistence marker
  */
 private function checkForRequestedUpdateByPagePurge($parserData)
 {
     // Only carry out a purge where InTextAnnotationParser have set
     // an appropriate context reference otherwise it is assumed that the hook
     // call is part of another non SMW related parse
     if ($parserData->getSemanticData()->getSubject()->getContextReference() === null) {
         return true;
     }
     $cache = $this->applicationFactory->getCache();
     $key = $this->applicationFactory->newCacheFactory()->getPurgeCacheKey($this->parser->getTitle()->getArticleID());
     if ($cache->contains($key) && $cache->fetch($key)) {
         $cache->delete($key);
         $parserData->updateStore();
     }
     return true;
 }
 /**
  * @note Article purge: In case an article was manually purged/moved
  * the store is updated as well; for all other cases LinksUpdateConstructed
  * will handle the store update
  *
  * @note The purge action is isolated from any other request therefore using
  * a static variable or any other messaging that is not persistent will not
  * work hence the reliance on the cache as temporary persistence marker
  */
 private function checkForRequestedUpdateByPagePurge($parserData)
 {
     // Only carry out a purge where InTextAnnotationParser have set
     // an appropriate context reference otherwise it is assumed that the hook
     // call is part of another non SMW related parse
     if ($parserData->getSemanticData()->getSubject()->getContextReference() === null) {
         return true;
     }
     $cache = $this->applicationFactory->getCache();
     $key = $this->applicationFactory->newCacheFactory()->getPurgeCacheKey($this->parser->getTitle()->getArticleID());
     if ($cache->contains($key) && $cache->fetch($key)) {
         $cache->delete($key);
         // Set a timestamp explicitly to create a new hash for the property
         // table change row differ and force a data comparison (this doesn't
         // change the _MDAT annotation)
         $parserData->getSemanticData()->setLastModified(wfTimestamp(TS_UNIX));
         $parserData->updateStore();
     }
     return true;
 }