/** * Compare and find changes related to conversion factor * * @since 1.9 */ protected function compareConversionTypedFactors() { Profiler::In(__METHOD__, true); $pconversion = new DIProperty(DIProperty::TYPE_CONVERSION); $newfactors = $this->semanticData->getPropertyValues($pconversion); $oldfactors = $this->store->getPropertyValues($this->semanticData->getSubject(), $pconversion); $this->notifyUpdateDispatcher(!$this->isEqual($oldfactors, $newfactors)); Profiler::Out(__METHOD__, true); }
/** * Updates propertyCounts using the diff ( old SemanticData and new SemanticData for a subject ) * Old SemanticData is data before the page was edited and new SemanticData is data after edit. * new SemanticData is optional sometimes (as for deleting data) * * @since 1.8 * * @param SemanticData $oldData * @param SemanticData or null $newData */ protected function doDiffandUpdateCount($oldData, $newData = null) { //Update Property Counts $updates = array(); if (!is_null($newData)) { foreach ($newData->getProperties() as $diKey => $diProp) { $updates[$diKey] = array($diProp, count($newData->getPropertyValues($diProp))); } } foreach ($oldData->getProperties() as $diKey => $diProp) { if (array_key_exists($diKey, $updates)) { $updates[$diKey][1] = $updates[$diKey][1] - count($oldData->getPropertyValues($diProp)); } else { $updates[$diKey] = array($diProp, -count($oldData->getPropertyValues($diProp))); } } foreach ($updates as $update) { if ($update[1] == 0) { continue; } // HOW to do this query using MW functions ?? /* $dbw->update( 'smw_stats', array( 'usage_count' => 'usage_count + '.$update[1] ), array( 'pid' => $this->store->smwIds->getSMWPropertyID( $update[0] ) ), __METHOD__ ); */ $this->addToUsageCount($this->store->smwIds->getSMWPropertyID($update[0]), $update[1]); } }