public function prune( &$maxsize, &$maxdepth, &$log ) {
		if ( $maxsize <= 0 ) {
			$log[] = $this->getQueryString();
			return new SMWThingDescription();
		}
		
		$prunelog = array();
		$newdepth = $maxdepth;
		$result = new SMWConjunction();
		
		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 conjunctions!
				$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;
		}
	}
 /**
  * Recursively create an SMWSparqlCondition from an SMWConjunction.
  *
  * @param $description SMWConjunction
  * @param $joinVariable string name, see buildSparqlCondition()
  * @param $orderByProperty mixed SMWDIProperty or null, see buildSparqlCondition()
  * @return SMWSparqlCondition
  */
 protected function buildConjunctionCondition(SMWConjunction $description, $joinVariable, $orderByProperty)
 {
     $subDescriptions = $description->getDescriptions();
     if (count($subDescriptions) == 0) {
         // empty conjunction: true
         return $this->buildTrueCondition($joinVariable, $orderByProperty);
     } elseif (count($subDescriptions) == 1) {
         // conjunction with one element
         return $this->buildSparqlCondition(reset($subDescriptions), $joinVariable, $orderByProperty);
     }
     $condition = '';
     $filter = '';
     $namespaces = $weakConditions = $orderVariables = array();
     $singletonMatchElement = null;
     $singletonMatchElementName = '';
     $hasSafeSubconditions = false;
     foreach ($subDescriptions as $subDescription) {
         $subCondition = $this->buildSparqlCondition($subDescription, $joinVariable, null);
         if ($subCondition instanceof SMWSparqlFalseCondition) {
             return new SMWSparqlFalseCondition();
         } elseif ($subCondition instanceof SMWSparqlTrueCondition) {
             // ignore true conditions in a conjunction
         } elseif ($subCondition instanceof SMWSparqlWhereCondition) {
             $condition .= $subCondition->condition;
         } elseif ($subCondition instanceof SMWSparqlFilterCondition) {
             $filter .= ($filter ? ' && ' : '') . $subCondition->filter;
         } elseif ($subCondition instanceof SMWSparqlSingletonCondition) {
             $matchElement = $subCondition->matchElement;
             $matchElementName = SMWTurtleSerializer::getTurtleNameForExpElement($matchElement);
             if ($matchElement instanceof SMWExpNsResource) {
                 $namespaces[$matchElement->getNamespaceId()] = $matchElement->getNamespace();
             }
             if (!is_null($singletonMatchElement) && $singletonMatchElementName !== $matchElementName) {
                 return new SMWSparqlFalseCondition();
             }
             $condition .= $subCondition->condition;
             $singletonMatchElement = $subCondition->matchElement;
             $singletonMatchElementName = $matchElementName;
         }
         $hasSafeSubconditions = $hasSafeSubconditions || $subCondition->isSafe();
         $namespaces = array_merge($namespaces, $subCondition->namespaces);
         $weakConditions = array_merge($weakConditions, $subCondition->weakConditions);
         $orderVariables = array_merge($orderVariables, $subCondition->orderVariables);
     }
     if (!is_null($singletonMatchElement)) {
         if ($filter !== '') {
             $condition .= "FILTER( {$filter} )";
         }
         $result = new SMWSparqlSingletonCondition($singletonMatchElement, $condition, $hasSafeSubconditions, $namespaces);
     } elseif ($condition === '') {
         $result = new SMWSparqlFilterCondition($filter, $namespaces);
     } else {
         if ($filter !== '') {
             $condition .= "FILTER( {$filter} )";
         }
         $result = new SMWSparqlWhereCondition($condition, $hasSafeSubconditions, $namespaces);
     }
     $result->weakConditions = $weakConditions;
     $result->orderVariables = $orderVariables;
     $this->addOrderByDataForProperty($result, $joinVariable, $orderByProperty);
     return $result;
 }
 /**
  * Returns whether the concepts of the group cover the specified page.
  *
  * @since 0.1
  *
  * @param Title $title
  *
  * @return boolean
  */
 public function conceptsCoverPage(Title $title)
 {
     if (count($this->concepts) == 0) {
         return true;
     }
     $foundMatch = false;
     foreach ($this->concepts as $groupConcept) {
         $queryDescription = new SMWConjunction();
         $conceptTitle = Title::newFromText($groupConcept, SMW_NS_CONCEPT);
         if (!$conceptTitle->exists()) {
             continue;
         }
         $queryDescription->addDescription(new SMWConceptDescription(SMWDIWikiPage::newFromTitle($conceptTitle)));
         $queryDescription->addDescription(new SMWValueDescription(SMWDIWikiPage::newFromTitle($title)));
         $query = new SMWQuery($queryDescription);
         $query->querymode = SMWQuery::MODE_COUNT;
         /* SMWQueryResult */
         $result = smwfGetStore()->getQueryResult($query);
         $foundMatch = $result instanceof SMWQueryResult ? $result->getCount() > 0 : $result > 0;
         if ($foundMatch) {
             break;
         }
     }
     return $foundMatch;
 }