elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/stages/AbstractReasonerState.java
private boolean computeQuery(final ElkClassExpression classExpression,
			final boolean computeInstanceTaxonomy)
			throws ElkInconsistentOntologyException, ElkException {

		// Load the query
		classExpressionQueryState_.registerQuery(classExpression);
		ensureLoading();

		// Complete all stages
		if (computeInstanceTaxonomy) {
			restoreInstanceTaxonomy();
		} else {
			restoreTaxonomy();
		}

		if (!classExpressionQueryState_.isIndexed(classExpression)) {
			return false;
		}

		/*
		 * If query result is cashed, but there were some changes to the
		 * ontology, it may not be up to date. Whether it is is checked during
		 * stages that clean contexts. These are run, if necessary, by the call
		 * above.
		 */
		if (classExpressionQueryState_.isComputed(classExpression)) {
			return true;
		}
		stageManager.classExpressionQueryStage.invalidateRecursive();
		try {
			complete(stageManager.classExpressionQueryStage);
		} catch (final ElkInterruptedException e) {
			if (classExpressionQueryState_.isComputed(classExpression)) {
				/*
				 * If the stage was interrupted, but the query is already
				 * computed, completing the stage will not be attempted during
				 * the next call. We need to call postExecute() manually, so
				 * that the stage wouldn't stay initialized with computation
				 * that already processed all its inputs (or at least the
				 * queried class).
				 */
				stageManager.classExpressionQueryStage.postExecute();
			} else {
				throw e;
			}
		}

		return true;
	}
private boolean computeQuery(final ElkClassExpression classExpression,
			final boolean computeInstanceTaxonomy)
			throws ElkInconsistentOntologyException, ElkException {

		// Load the query
		classExpressionQueryState_.registerQuery(classExpression);
		ensureLoading();

		// Complete all stages
		if (computeInstanceTaxonomy) {
			restoreInstanceTaxonomy();
		} else {
			restoreTaxonomy();
		}

		if (!classExpressionQueryState_.isIndexed(classExpression)) {
			return false;
		}

		/*
		 * If query result is cashed, but there were some changes to the
		 * ontology, it may not be up to date. Whether it is is checked during
		 * stages that clean contexts. These are run, if necessary, by the call
		 * above.
		 */
		if (classExpressionQueryState_.isComputed(classExpression)) {
			return true;
		}
		stageManager.classExpressionQueryStage.invalidateRecursive();
		try {
			complete(stageManager.classExpressionQueryStage);
		} catch (final ElkInterruptedException e) {
			if (classExpressionQueryState_.isComputed(classExpression)) {
				/*
				 * If the stage was interrupted, but the query is already
				 * computed, completing the stage will not be attempted during
				 * the next call. We need to call postExecute() manually, so
				 * that the stage wouldn't stay initialized with computation
				 * that already processed all its inputs (or at least the
				 * queried class).
				 */
				stageManager.classExpressionQueryStage.postExecute();
			} else {
				throw e;
			}
		}

		return true;
	}
If the query results are not cached yet, indexes the supplied class
expression and, if successful, computes the query so that the results for
this expressions are ready in {@link #classExpressionQueryState_}.

@param classExpression
@param computeInstanceTaxonomy
if {@code false}, only class taxonomy is computed, if
{@code true}, also instance taxonomy is computed.
@return <code>true</code> if the query was indexed successfully,
<code>false</code> otherwise, i.e., when the class expression is
not supported
@throws ElkInconsistentOntologyException
@throws ElkException