private function hasMatchFor($id, $key, DIWikiPage $subject)
 {
     $key = $id . '#' . $key;
     if ($this->cache->contains($key)) {
         return $this->cache->fetch($key);
     }
     $requestOptions = new RequestOptions();
     $requestOptions->limit = 1;
     $result = $this->store->getPropertySubjects(new DIProperty($id), $subject, $requestOptions);
     $this->cache->save($key, $result !== array());
     return $result !== array();
 }
 /**
  * @since 2.0
  *
  * @return SemanticData
  */
 public function getSemanticData(DIWikiPage $subject)
 {
     $requestOptions = new RequestOptions();
     $requestOptions->sort = true;
     $semanticData = new SemanticData($subject);
     $incomingProperties = $this->store->getInProperties($subject, $requestOptions);
     foreach ($incomingProperties as $property) {
         $values = $this->store->getPropertySubjects($property, null);
         foreach ($values as $value) {
             $semanticData->addPropertyObjectValue($property, $value);
         }
     }
     return $semanticData;
 }
 /**
  * Creates a Semantic Data object with the incoming properties instead of the
  * usual outproperties.
  *
  * @return array(SMWSemanticData, bool)  The semantic data including all inproperties, and if there are more inproperties left
  */
 private function getInData()
 {
     $indata = new SemanticData($this->subject->getDataItem());
     $propRequestOptions = new RequestOptions();
     $propRequestOptions->sort = true;
     $propRequestOptions->limit = $this->incomingPropertiesCount;
     if ($this->offset > 0) {
         $propRequestOptions->offset = $this->offset;
     }
     $incomingProperties = $this->store->getInProperties($this->subject->getDataItem(), $propRequestOptions);
     $more = false;
     if (count($incomingProperties) == $this->incomingPropertiesCount) {
         $more = true;
         array_pop($incomingProperties);
         // drop the last one
     }
     $valRequestOptions = new RequestOptions();
     $valRequestOptions->sort = true;
     $valRequestOptions->limit = $this->incomingValuesCount;
     foreach ($incomingProperties as $property) {
         $values = $this->store->getPropertySubjects($property, $this->subject->getDataItem(), $valRequestOptions);
         foreach ($values as $value) {
             $indata->addPropertyObjectValue($property, $value);
         }
     }
     // Added in 2.3
     // Whether to show a more link or not can be set via
     // SMW::Browse::BeforeIncomingPropertyValuesFurtherLinkCreate
     \Hooks::run('SMW::Browse::AfterIncomingPropertiesLookupComplete', array($this->store, $indata, $valRequestOptions));
     return array($indata, $more);
 }
 private function findMatchesWith($id, $key, DIWikiPage $subject, $requestOptions)
 {
     $key = $id . '#' . $key . '#' . $requestOptions->getHash();
     if ($this->cache->contains($key)) {
         return $this->cache->fetch($key);
     }
     $result = $this->store->getPropertySubjects(new DIProperty($id), $subject, $requestOptions);
     $this->cache->save($key, $result);
     wfDebugLog('smw', __METHOD__ . " {$id} and " . $subject->getDBKey() . "\n");
     return $result;
 }
Exemplo n.º 5
0
 private function findMatchesFor($id, $key, DIWikiPage $subject)
 {
     $key = 'f#' . $id . '#' . $key;
     if ($this->cache->contains($key)) {
         return unserialize($this->cache->fetch($key));
     }
     $requestOptions = new RequestOptions();
     $result = $this->store->getPropertySubjects(new DIProperty($id), $subject, $requestOptions);
     $this->cache->save($key, serialize($result));
     wfDebugLog('smw', __METHOD__ . " {$id} and " . $subject->getDBKey() . "\n");
     return $result;
 }
Exemplo n.º 6
0
 private function doQueryForExactValue(PageRequestOptions $pageRequestOptions, RequestOptions $requestOptions)
 {
     return $this->store->getPropertySubjects($pageRequestOptions->property->getDataItem(), $pageRequestOptions->value->getDataItem(), $requestOptions);
 }
Exemplo n.º 7
0
 /**
  * @see Store::getPropertySubjects()
  * @since 1.8
  */
 public function getPropertySubjects(DIProperty $property, $value, $requestoptions = null)
 {
     return $this->baseStore->getPropertySubjects($property, $value, $requestoptions);
 }