예제 #1
0
 /**
  * @see SMWStore::getQueryResult()
  * @since 1.6
  */
 public function getQueryResult(SMWQuery $query)
 {
     global $smwgIgnoreQueryErrors;
     if ((!$smwgIgnoreQueryErrors || $query->getDescription() instanceof SMWThingDescription) && $query->querymode != SMWQuery::MODE_DEBUG && count($query->getErrors()) > 0) {
         return new SMWQueryResult($query->getDescription()->getPrintrequests(), $query, array(), $this, false);
     }
     if ($query->querymode == SMWQuery::MODE_NONE) {
         // don't query, but return something to printer
         return new SMWQueryResult($query->getDescription()->getPrintrequests(), $query, array(), $this, true);
     } elseif ($query->querymode == SMWQuery::MODE_DEBUG) {
         $queryEngine = new SMWSparqlStoreQueryEngine($this);
         return $queryEngine->getDebugQueryResult($query);
     } elseif ($query->querymode == SMWQuery::MODE_COUNT) {
         $queryEngine = new SMWSparqlStoreQueryEngine($this);
         return $queryEngine->getCountQueryResult($query);
     } else {
         $queryEngine = new SMWSparqlStoreQueryEngine($this);
         return $queryEngine->getInstanceQueryResult($query);
     }
 }
	public function getQueryResult( SMWQuery $query ) {
		global $smwgIgnoreQueryErrors;

		if ( !$smwgIgnoreQueryErrors &&
		     ( $query->querymode != SMWQuery::MODE_DEBUG ) &&
		     ( count( $query->getErrors() ) > 0 ) ) {
			return new SMWQueryResult( $query->getDescription()->getPrintrequests(), $query, array(), $this, false );
			// NOTE: we check this here to prevent unnecessary work, but we may need to check it after query processing below again in case more errors occurred
		}

		if ( $query->querymode == SMWQuery::MODE_NONE ) { // don't query, but return something to printer
			return new SMWQueryResult( $query->getDescription()->getPrintrequests(), $query, array(), $this, true );
		} elseif ( $query->querymode == SMWQuery::MODE_DEBUG ) {
			$queryEngine = new SMWSparqlStoreQueryEngine( $this );
			return $queryEngine->getDebugQueryResult( $query ); 
		} elseif ( $query->querymode == SMWQuery::MODE_COUNT ) {
			$queryEngine = new SMWSparqlStoreQueryEngine( $this );
			return $queryEngine->getCountQueryResult( $query ); 
		} else {
			$queryEngine = new SMWSparqlStoreQueryEngine( $this );
			return $queryEngine->getInstanceQueryResult( $query ); 
		}
	}