public function getPropertyValues($subject, SMWDIProperty $property, $requestoptions = null, $outputformat = '') { wfProfileIn("SMWSQLStoreLight::getPropertyValues (SMW)"); if ($property->isInverse()) { // inverses are working differently $noninverse = clone $property; $noninverse->setInverse(false); $result = $this->getPropertySubjects($noninverse, $subject, $requestoptions); } elseif ($subject !== null) { // subject given, use semantic data cache: $sd = $this->getSemanticData($subject, array($property->getPropertyTypeID())); $result = $this->applyRequestOptions($sd->getPropertyValues($property), $requestoptions); if ($outputformat !== '') { // reformat cached values $newres = array(); foreach ($result as $dv) { $ndv = clone $dv; $ndv->setOutputFormat($outputformat); $newres[] = $ndv; } $result = $newres; } } else { // no subject given, get all values for the given property $tablename = SMWSQLStoreLight::findPropertyTableName($property); $db = wfGetDB(DB_SLAVE); $res = $db->select($tablename, array('value'), array('propname' => $property->getDBkey()), 'SMW::getPropertyValues', $this->getSQLOptions($requestoptions, 'value') + array('DISTINCT')); $result = array(); foreach ($res as $row) { $dv = SMWDataValueFactory::newPropertyObjectValue($property); if ($outputformat !== '') { $dv->setOutputFormat($outputformat); } $dv->setDBkeys($tablename == 'smwsimple_special' ? array($row->value) : unserialize($row->value)); $result[] = $dv; } $db->freeResult($res); } wfProfileOut("SMWSQLStoreLight::getPropertyValues (SMW)"); return $result; }