/** * @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); }
/** * @see Store::getInProperties() * @since 1.8 */ public function getInProperties(DataItem $object, $requestoptions = null) { return $this->baseStore->getInProperties($object, $requestoptions); }