/**
  * @see SMWDescription:prune
  * 
  * @since 0.6
  */
 public function prune(&$maxsize, &$maxdepth, &$log)
 {
     if ($maxsize < $this->getSize() || $maxdepth < $this->getDepth()) {
         $log[] = $this->getQueryString();
         $result = new SMWThingDescription();
         $result->setPrintRequests($this->getPrintRequests());
         return $result;
     } else {
         $maxsize = $maxsize - $this->getSize();
         $maxdepth = $maxdepth - $this->getDepth();
         return $this;
     }
 }
	public function prune( &$maxsize, &$maxdepth, &$log ) {
		if ( $maxsize <= 0 ) {
			$log[] = $this->getQueryString();
			return new SMWThingDescription();
		}

		$prunelog = array();
		$newdepth = $maxdepth;
		$result = new SMWDisjunction();

		foreach ( $this->m_descriptions as $desc ) {
			$restdepth = $maxdepth;
			$result->addDescription( $desc->prune( $maxsize, $restdepth, $prunelog ) );
			$newdepth = min( $newdepth, $restdepth );
		}

		if ( count( $result->getDescriptions() ) > 0 ) {
			$log = array_merge( $log, $prunelog );
			$maxdepth = $newdepth;
			
			if ( count( $result->getDescriptions() ) == 1 ) { // simplify unary disjunctions!
				$descriptions = $result->getDescriptions();
				$result = array_shift( $descriptions );
			}

			$result->setPrintRequests( $this->getPrintRequests() );

			return $result;
		} else {
			$log[] = $this->getQueryString();

			$result = new SMWThingDescription();
			$result->setPrintRequests( $this->getPrintRequests() );

			return $result;
		}
	}