当前位置: 首页>>代码示例>>PHP>>正文


PHP SMWQuery::getErrors方法代码示例

本文整理汇总了PHP中SMWQuery::getErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP SMWQuery::getErrors方法的具体用法?PHP SMWQuery::getErrors怎么用?PHP SMWQuery::getErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SMWQuery的用法示例。


在下文中一共展示了SMWQuery::getErrors方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getStringFrom

 /**
  * Generate textual debug output that shows an arbitrary list of informative
  * fields. Used for formatting query debug output.
  *
  * @note All strings given must be usable and safe in wiki and HTML
  * contexts.
  *
  * @param $storeName string name of the storage backend for which this is generated
  * @param $entries array of name => value of informative entries to display
  * @param $query SMWQuery or null, if given add basic data about this query as well
  *
  * @return string
  */
 public static function getStringFrom($storeName, array $entries, Query $query = null)
 {
     if ($query instanceof Query) {
         $preEntries = array();
         $preEntries['ASK Query'] = '<div class="smwpre">' . str_replace('[', '&#x005B;', $query->getDescription()->getQueryString()) . '</div>';
         $entries = array_merge($preEntries, $entries);
         $entries['Query Metrics'] = 'Query-Size:' . $query->getDescription()->getSize() . '<br />' . 'Query-Depth:' . $query->getDescription()->getDepth();
         $errors = '';
         $queryErrors = ProcessingErrorMsgHandler::normalizeMessages($query->getErrors());
         foreach ($queryErrors as $error) {
             $errors .= $error . '<br />';
         }
         if ($errors === '') {
             $errors = 'None';
         }
         $entries['Errors and Warnings'] = $errors;
     }
     $result = '<div style="border: 5px dotted #ffcc00; background: #FFF0BD; padding: 20px; ">' . "<div class='smw-column-header'><big>{$storeName} debug output</big></div>";
     foreach ($entries as $header => $information) {
         $result .= "<div class='smw-column-header'>{$header}</div>";
         if ($information !== '') {
             $result .= "{$information}";
         }
     }
     $result .= '</div>';
     return $result;
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:40,代码来源:DebugOutputFormatter.php

示例2: formatOutputFor

 /**
  * Generate textual debug output that shows an arbitrary list of informative
  * fields. Used for formatting query debug output.
  *
  * @note All strings given must be usable and safe in wiki and HTML
  * contexts.
  *
  * @param $storeName string name of the storage backend for which this is generated
  * @param $entries array of name => value of informative entries to display
  * @param $query SMWQuery or null, if given add basic data about this query as well
  *
  * @return string
  */
 public static function formatOutputFor($storeName, array $entries, Query $query = null)
 {
     if ($query instanceof Query) {
         $preEntries = array();
         $preEntries['Ask query'] = '<div class="smwpre">' . str_replace('[', '&#x005B;', $query->getDescription()->getQueryString()) . '</div>';
         $entries = array_merge($preEntries, $entries);
         $entries['Query Metrics'] = 'Query-Size:' . $query->getDescription()->getSize() . '<br />' . 'Query-Depth:' . $query->getDescription()->getDepth();
         $errors = '';
         foreach ($query->getErrors() as $error) {
             $errors .= $error . '<br />';
         }
         if ($errors === '') {
             $errors = 'None';
         }
         $entries['Errors and Warnings'] = $errors;
     }
     $result = '<div style="border: 5px dotted #A1FB00; background: #FFF0BD; padding: 20px; ">' . "<h3>Debug Output by {$storeName}</h3>";
     foreach ($entries as $header => $information) {
         $result .= "<h4>{$header}</h4>";
         if ($information !== '') {
             $result .= "{$information}";
         }
     }
     $result .= '</div>';
     return $result;
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:39,代码来源:DebugOutputFormatter.php

示例3: getFormattedErrorString

 /**
  * @since 2.5
  *
  * @param Query|null $query
  *
  * @return string
  */
 public function getFormattedErrorString(Query $query = null)
 {
     if ($query === null || !is_array($query->getErrors()) || $query->getErrors() === array()) {
         return '';
     }
     $errors = array();
     foreach (ProcessingErrorMsgHandler::normalizeMessages($query->getErrors()) as $value) {
         if ($value === '') {
             continue;
         }
         if (is_array($value)) {
             $value = implode(" ", $value);
         }
         $errors[] = $value;
     }
     if (count($errors) > 1) {
         $error = '<ul><li>' . implode('</li><li>', $errors) . '</li></ul>';
     } else {
         $error = implode(' ', $errors);
     }
     return Html::rawElement('div', array('class' => 'smw-callout smw-callout-error'), $error);
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:29,代码来源:HtmlContentBuilder.php

示例4: getQueryResult

 /**
  * @since  2.0
  * @param  Query $query
  *
  * @return QueryResult|string
  */
 public function getQueryResult(Query $query)
 {
     if ((!$this->engineOptions->get('smwgIgnoreQueryErrors') || $query->getDescription() instanceof ThingDescription) && $query->querymode != Query::MODE_DEBUG && count($query->getErrors()) > 0) {
         return $this->queryResultFactory->newEmptyQueryResult($query, false);
     }
     // don't query, but return something to the printer
     if ($query->querymode == Query::MODE_NONE) {
         return $this->queryResultFactory->newEmptyQueryResult($query, true);
     }
     if ($query->querymode == Query::MODE_DEBUG) {
         return $this->getDebugQueryResult($query);
     } elseif ($query->querymode == Query::MODE_COUNT) {
         return $this->getCountQueryResult($query);
     }
     return $this->getInstanceQueryResult($query);
 }
开发者ID:Rikuforever,项目名称:wiki,代码行数:22,代码来源:QueryEngine.php

示例5: getQueryResult

 /**
  * @since  2.0
  * @param  Query $query
  *
  * @return QueryResult|string
  */
 public function getQueryResult(Query $query)
 {
     if ((!$this->engineOptions->get('smwgIgnoreQueryErrors') || $query->getDescription() instanceof ThingDescription) && $query->querymode != Query::MODE_DEBUG && count($query->getErrors()) > 0) {
         return $this->queryResultFactory->newEmptyQueryResult($query, false);
     }
     // don't query, but return something to the printer
     if ($query->querymode == Query::MODE_NONE || $query->getLimit() < 1) {
         return $this->queryResultFactory->newEmptyQueryResult($query, true);
     }
     $this->compoundConditionBuilder->setSortKeys($query->sortkeys);
     $compoundCondition = $this->compoundConditionBuilder->buildCondition($query->getDescription());
     $query->addErrors($this->compoundConditionBuilder->getErrors());
     if ($query->querymode == Query::MODE_DEBUG) {
         return $this->getDebugQueryResult($query, $compoundCondition);
     } elseif ($query->querymode == Query::MODE_COUNT) {
         return $this->getCountQueryResult($query, $compoundCondition);
     }
     return $this->getInstanceQueryResult($query, $compoundCondition);
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:25,代码来源:QueryEngine.php

示例6: getErrors

 /**
  * Return error array, possibly empty.
  *
  * @return array
  */
 public function getErrors()
 {
     // Just use query errors, as no errors generated in this class at the moment.
     return $this->mQuery->getErrors();
 }
开发者ID:Rikuforever,项目名称:wiki,代码行数:10,代码来源:SMW_QueryResult.php

示例7: getQueryResult

 /**
  * The new SQL store's implementation of query answering. This function
  * works in two stages: First, the nested conditions of the given query
  * object are preprocessed to compute an abstract representation of the
  * SQL query that is to be executed. Since query conditions correspond to
  * joins with property tables in most cases, this abstract representation
  * is essentially graph-like description of how property tables are joined.
  * Moreover, this graph is tree-shaped, since all query conditions are
  * tree-shaped. Each part of this abstract query structure is represented
  * by an SMWSQLStore3Query object in the array m_queries.
  *
  * As a second stage of processing, the thus prepared SQL query is actually
  * executed. Typically, this means that the joins are collapsed into one
  * SQL query to retrieve results. In some cases, such as in dbug mode, the
  * execution might be restricted and not actually perform the whole query.
  *
  * The two-stage process helps to separate tasks, and it also allows for
  * better optimisations: it is left to the execution engine how exactly the
  * query result is to be obtained. For example, one could pre-compute
  * partial suib-results in temporary tables (or even cache them somewhere),
  * instead of passing one large join query to the DB (of course, it might
  * be large only if the configuration of SMW allows it). For some DBMS, a
  * step-wise execution of the query might lead to better performance, since
  * it exploits the tree-structure of the joins, which is important for fast
  * processing -- not all DBMS might be able in seeing this by themselves.
  *
  * @param SMWQuery $query
  *
  * @return mixed: depends on $query->querymode
  */
 public function getQueryResult(SMWQuery $query)
 {
     global $smwgIgnoreQueryErrors, $smwgQSortingSupport;
     if ((!$smwgIgnoreQueryErrors || $query->getDescription() instanceof SMWThingDescription) && $query->querymode != SMWQuery::MODE_DEBUG && count($query->getErrors()) > 0) {
         return new SMWQueryResult($query->getDescription()->getPrintrequests(), $query, array(), $this->m_store, false);
         // NOTE: we check this here to prevent unnecessary work, but we check
         // it after query processing below again in case more errors occurred.
     } elseif ($query->querymode == SMWQuery::MODE_NONE) {
         // don't query, but return something to printer
         return new SMWQueryResult($query->getDescription()->getPrintrequests(), $query, array(), $this->m_store, true);
     }
     $this->m_qmode = $query->querymode;
     $this->m_queries = array();
     $this->m_hierarchies = array();
     $this->m_querylog = array();
     $this->m_errors = array();
     SMWSQLStore3Query::$qnum = 0;
     $this->m_sortkeys = $query->sortkeys;
     // *** First compute abstract representation of the query (compilation) ***//
     wfProfileIn('SMWSQLStore3Queries::compileMainQuery (SMW)');
     $qid = $this->compileQueries($query->getDescription());
     // compile query, build query "plan"
     wfProfileOut('SMWSQLStore3Queries::compileMainQuery (SMW)');
     if ($qid < 0) {
         // no valid/supported condition; ensure that at least only proper pages are delivered
         $qid = SMWSQLStore3Query::$qnum;
         $q = new SMWSQLStore3Query();
         $q->jointable = SMWSql3SmwIds::tableName;
         $q->joinfield = "{$q->alias}.smw_id";
         $q->where = "{$q->alias}.smw_iw!=" . $this->m_dbs->addQuotes(SMW_SQL3_SMWIW_OUTDATED) . " AND {$q->alias}.smw_iw!=" . $this->m_dbs->addQuotes(SMW_SQL3_SMWREDIIW) . " AND {$q->alias}.smw_iw!=" . $this->m_dbs->addQuotes(SMW_SQL3_SMWBORDERIW) . " AND {$q->alias}.smw_iw!=" . $this->m_dbs->addQuotes(SMW_SQL3_SMWINTDEFIW);
         $this->m_queries[$qid] = $q;
     }
     if ($this->m_queries[$qid]->jointable != SMWSql3SmwIds::tableName) {
         // manually make final root query (to retrieve namespace,title):
         $rootid = SMWSQLStore3Query::$qnum;
         $qobj = new SMWSQLStore3Query();
         $qobj->jointable = SMWSql3SmwIds::tableName;
         $qobj->joinfield = "{$qobj->alias}.smw_id";
         $qobj->components = array($qid => "{$qobj->alias}.smw_id");
         $qobj->sortfields = $this->m_queries[$qid]->sortfields;
         $this->m_queries[$rootid] = $qobj;
     } else {
         // not such a common case, but worth avoiding the additional inner join:
         $rootid = $qid;
     }
     // Include order conditions (may extend query if needed for sorting):
     if ($smwgQSortingSupport) {
         $this->applyOrderConditions($rootid);
     }
     // Possibly stop if new errors happened:
     if (!$smwgIgnoreQueryErrors && $query->querymode != SMWQuery::MODE_DEBUG && count($this->m_errors) > 0) {
         $query->addErrors($this->m_errors);
         return new SMWQueryResult($query->getDescription()->getPrintrequests(), $query, array(), $this->m_store, false);
     }
     // *** Now execute the computed query ***//
     wfProfileIn('SMWSQLStore3Queries::executeMainQuery (SMW)');
     $this->executeQueries($this->m_queries[$rootid]);
     // execute query tree, resolve all dependencies
     wfProfileOut('SMWSQLStore3Queries::executeMainQuery (SMW)');
     switch ($query->querymode) {
         case SMWQuery::MODE_DEBUG:
             $result = $this->getDebugQueryResult($query, $rootid);
             break;
         case SMWQuery::MODE_COUNT:
             $result = $this->getCountQueryResult($query, $rootid);
             break;
         default:
             $result = $this->getInstanceQueryResult($query, $rootid);
             break;
     }
//.........这里部分代码省略.........
开发者ID:seedbank,项目名称:old-repo,代码行数:101,代码来源:SMW_SQLStore3_Queries.php

示例8: getQueryResult

 /**
  * The new SQL store's implementation of query answering. This function
  * works in two stages: First, the nested conditions of the given query
  * object are preprocessed to compute an abstract representation of the
  * SQL query that is to be executed. Since query conditions correspond to
  * joins with property tables in most cases, this abstract representation
  * is essentially graph-like description of how property tables are joined.
  * Moreover, this graph is tree-shaped, since all query conditions are
  * tree-shaped. Each part of this abstract query structure is represented
  * by an QuerySegment object in the array m_queries.
  *
  * As a second stage of processing, the thus prepared SQL query is actually
  * executed. Typically, this means that the joins are collapsed into one
  * SQL query to retrieve results. In some cases, such as in dbug mode, the
  * execution might be restricted and not actually perform the whole query.
  *
  * The two-stage process helps to separate tasks, and it also allows for
  * better optimisations: it is left to the execution engine how exactly the
  * query result is to be obtained. For example, one could pre-compute
  * partial suib-results in temporary tables (or even cache them somewhere),
  * instead of passing one large join query to the DB (of course, it might
  * be large only if the configuration of SMW allows it). For some DBMS, a
  * step-wise execution of the query might lead to better performance, since
  * it exploits the tree-structure of the joins, which is important for fast
  * processing -- not all DBMS might be able in seeing this by themselves.
  *
  * @param Query $query
  *
  * @return mixed depends on $query->querymode
  */
 public function getQueryResult(Query $query)
 {
     if ((!$this->engineOptions->get('smwgIgnoreQueryErrors') || $query->getDescription() instanceof ThingDescription) && $query->querymode != Query::MODE_DEBUG && count($query->getErrors()) > 0) {
         return new QueryResult($query->getDescription()->getPrintrequests(), $query, array(), $this->store, false);
         // NOTE: we check this here to prevent unnecessary work, but we check
         // it after query processing below again in case more errors occurred.
     } elseif ($query->querymode == Query::MODE_NONE) {
         // don't query, but return something to printer
         return new QueryResult($query->getDescription()->getPrintrequests(), $query, array(), $this->store, true);
     }
     $db = $this->store->getConnection('mw.db');
     $this->queryMode = $query->querymode;
     $this->querySegments = array();
     $this->errors = array();
     QuerySegment::$qnum = 0;
     $this->sortKeys = $query->sortkeys;
     // *** First compute abstract representation of the query (compilation) ***//
     $this->queryBuilder->setSortKeys($this->sortKeys);
     $this->queryBuilder->buildQuerySegmentFor($query->getDescription());
     // compile query, build query "plan"
     $qid = $this->queryBuilder->getLastQuerySegmentId();
     $this->querySegments = $this->queryBuilder->getQuerySegments();
     $this->errors = $this->queryBuilder->getErrors();
     if ($qid < 0) {
         // no valid/supported condition; ensure that at least only proper pages are delivered
         $qid = QuerySegment::$qnum;
         $q = new QuerySegment();
         $q->joinTable = SMWSql3SmwIds::tableName;
         $q->joinfield = "{$q->alias}.smw_id";
         $q->where = "{$q->alias}.smw_iw!=" . $db->addQuotes(SMW_SQL3_SMWIW_OUTDATED) . " AND {$q->alias}.smw_iw!=" . $db->addQuotes(SMW_SQL3_SMWREDIIW) . " AND {$q->alias}.smw_iw!=" . $db->addQuotes(SMW_SQL3_SMWBORDERIW) . " AND {$q->alias}.smw_iw!=" . $db->addQuotes(SMW_SQL3_SMWINTDEFIW);
         $this->querySegments[$qid] = $q;
     }
     if ($this->querySegments[$qid]->joinTable != SMWSql3SmwIds::tableName) {
         // manually make final root query (to retrieve namespace,title):
         $rootid = QuerySegment::$qnum;
         $qobj = new QuerySegment();
         $qobj->joinTable = SMWSql3SmwIds::tableName;
         $qobj->joinfield = "{$qobj->alias}.smw_id";
         $qobj->components = array($qid => "{$qobj->alias}.smw_id");
         $qobj->sortfields = $this->querySegments[$qid]->sortfields;
         $this->querySegments[$rootid] = $qobj;
     } else {
         // not such a common case, but worth avoiding the additional inner join:
         $rootid = $qid;
     }
     // Include order conditions (may extend query if needed for sorting):
     if ($this->engineOptions->get('smwgQSortingSupport')) {
         $this->applyOrderConditions($rootid);
     }
     // Possibly stop if new errors happened:
     if (!$this->engineOptions->get('smwgIgnoreQueryErrors') && $query->querymode != Query::MODE_DEBUG && count($this->errors) > 0) {
         $query->addErrors($this->errors);
         return new QueryResult($query->getDescription()->getPrintrequests(), $query, array(), $this->store, false);
     }
     // *** Now execute the computed query ***//
     $this->querySegmentListResolver->setQueryMode($this->queryMode);
     $this->querySegmentListResolver->setQuerySegmentList($this->querySegments);
     // execute query tree, resolve all dependencies
     $this->querySegmentListResolver->resolveForSegmentId($rootid);
     switch ($query->querymode) {
         case Query::MODE_DEBUG:
             $result = $this->getDebugQueryResult($query, $rootid);
             break;
         case Query::MODE_COUNT:
             $result = $this->getCountQueryResult($query, $rootid);
             break;
         default:
             $result = $this->getInstanceQueryResult($query, $rootid);
             break;
     }
//.........这里部分代码省略.........
开发者ID:bogota,项目名称:SemanticMediaWiki,代码行数:101,代码来源:QueryEngine.php

示例9: getQueryResult

 /**
  * @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);
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:24,代码来源:SMW_SparqlStore.php

示例10: getQueryResult

	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 ); 
		}
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:23,代码来源:SMW_SparqlStore.php


注:本文中的SMWQuery::getErrors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。