/**
     * Handle the onDataChanged hook of SMW >1.6, which gets called
     * every time the value of a propery changes somewhere.
     *
     * @since 0.1
     *
     * @param SMWStore $store
     * @param SMWChangeSet $changes
     * 
     * @return true
     */
	public static function onDataUpdate( SMWStore $store, SMWSemanticData $newData ) {
		$subject = $newData->getSubject();
		$oldData = $store->getSemanticData( $subject );
		$title = Title::makeTitle( $subject->getNamespace(), $subject->getDBkey() );
		
		$groups = SWLGroups::getMatchingWatchGroups( $title );
		
		$edit = false;
		
		foreach ( $groups as /* SWLGroup */ $group ) {
			$changeSet = SWLChangeSet::newFromSemanticData( $oldData, $newData, $group->getProperties() );
			
			if ( $changeSet->hasUserDefinedProperties() ) {
				if ( $edit === false ) {
					$edit = new SWLEdit(
						$title->getArticleID(), 
						$GLOBALS['wgUser']->getName(),
						wfTimestampNow()
					);
					
					$edit->writeToDB();
				}
				
				$changeSet->setEdit( $edit );
				$setId = $changeSet->writeToStore( $groups, $edit->getId() );
				
				if ( $setId != 0 ) {
					$group->notifyWatchingUsers( $changeSet );
				}	
			}
		}
		
		return true;
	}
 /**
  * Serializes the object as an associative array, which can be passed
  * to newFromArray to create a new instance.
  * 
  * @since 0.1
  * 
  * @return array
  */
 public function toArray()
 {
     $changeSet = array('id' => $this->id, 'user_name' => $this->edit->getUserName(), 'page_id' => $this->edit->getPageID(), 'time' => $this->edit->getTime(), 'editid' => $this->edit->getId(), 'changes' => array());
     foreach ($this->getAllProperties() as $property) {
         $propChanges = array();
         foreach ($this->getAllPropertyChanges($property) as $change) {
             $propChange = array();
             if (is_object($change->getOldValue())) {
                 $propChange['old'] = $change->getOldValue()->getSerialization();
             }
             if (is_object($change->getNewValue())) {
                 $propChange['new'] = $change->getNewValue()->getSerialization();
             }
             $propChanges[] = $propChange;
         }
         $changeSet['changes'][$property->getSerialization()] = $propChanges;
     }
     return $changeSet;
 }