/**
  * @see SMWStore::getPropertyValues
  *
  * @param $subject mixed SMWDIWikiPage or null
  * @param $property SMWDIProperty
  * @param $requestoptions SMWRequestOptions
  *
  * @return array of SMWDataItem
  */
 public function getPropertyValues($subject, SMWDIProperty $property, $requestoptions = null)
 {
     wfProfileIn("SMWSQLStore2::getPropertyValues (SMW)");
     if ($property->isInverse()) {
         // inverses are working differently
         $noninverse = new SMWDIProperty($property->getKey(), false);
         $result = $this->getPropertySubjects($noninverse, $subject, $requestoptions);
     } elseif (!is_null($subject)) {
         // subject given, use semantic data cache
         $sd = $this->getSemanticData($subject, array($property->findPropertyTypeID()));
         $result = $this->applyRequestOptions($sd->getPropertyValues($property), $requestoptions);
     } else {
         // no subject given, get all values for the given property
         $pid = $this->getSMWPropertyID($property);
         $tableid = self::findPropertyTableID($property);
         if ($pid == 0 || $tableid === '') {
             wfProfileOut("SMWSQLStore2::getPropertyValues (SMW)");
             return array();
         }
         $proptables = self::getPropertyTables();
         $data = $this->fetchSemanticData($pid, $property, $proptables[$tableid], false, $requestoptions);
         $result = array();
         $propertyTypeId = $property->findPropertyTypeID();
         $propertyDiId = SMWDataValueFactory::getDataItemId($propertyTypeId);
         if ($propertyDiId == SMWDataItem::TYPE_CONTAINER) {
             foreach ($data as $dbkeys) {
                 try {
                     $diSubWikiPage = SMWCompatibilityHelpers::dataItemFromDBKeys('_wpg', $dbkeys);
                     $semanticData = new SMWContainerSemanticData($diSubWikiPage);
                     $semanticData->copyDataFrom($this->getSemanticData($diSubWikiPage));
                     $result[] = new SMWDIContainer($semanticData);
                 } catch (SMWDataItemException $e) {
                     // maybe type assignment changed since data was stored;
                     // don't worry, but we can only drop the data here
                 }
             }
         } else {
             foreach ($data as $dbkeys) {
                 try {
                     $result[] = SMWCompatibilityHelpers::dataItemFromDBKeys($propertyTypeId, $dbkeys);
                 } catch (SMWDataItemException $e) {
                     // maybe type assignment changed since data was stored;
                     // don't worry, but we can only drop the data here
                 }
             }
         }
     }
     wfProfileOut("SMWSQLStore2::getPropertyValues (SMW)");
     return $result;
 }
 /**
  * Get the array of all stored values for some property.
  *
  * @param $property SMWDIProperty
  * @return array of SMWDataItem
  */
 public function getPropertyValues(SMWDIProperty $property)
 {
     if ($property->isInverse()) {
         // we never have any data for inverses
         return array();
     }
     if (array_key_exists($property->getKey(), $this->mStubPropVals)) {
         $this->unstubProperty($property->getKey(), $property);
         $propertyTypeId = $property->findPropertyTypeID();
         $propertyDiId = SMWDataValueFactory::getDataItemId($propertyTypeId);
         foreach ($this->mStubPropVals[$property->getKey()] as $dbkeys) {
             try {
                 if ($propertyDiId == SMWDataItem::TYPE_CONTAINER) {
                     $diSubWikiPage = SMWCompatibilityHelpers::dataItemFromDBKeys('_wpg', $dbkeys);
                     $semanticData = new SMWContainerSemanticData($diSubWikiPage);
                     $semanticData->copyDataFrom(smwfGetStore()->getSemanticData($diSubWikiPage));
                     $di = new SMWDIContainer($semanticData);
                 } else {
                     $di = SMWCompatibilityHelpers::dataItemFromDBKeys($propertyTypeId, $dbkeys);
                 }
                 if ($this->mNoDuplicates) {
                     $this->mPropVals[$property->getKey()][$di->getHash()] = $di;
                 } else {
                     $this->mPropVals[$property->getKey()][] = $di;
                 }
             } catch (SMWDataItemException $e) {
                 // ignore data
             }
         }
         unset($this->mStubPropVals[$property->getKey()]);
     }
     return parent::getPropertyValues($property);
 }