public InferenceResult ask(Sentence aQuery) {
// Want to standardize apart the query to ensure
// it does not clash with any of the sentences
// in the database
StandardizeApartResult saResult = standardizeApart.standardizeApart(
aQuery, queryIndexical);
// Need to map the result variables (as they are standardized apart)
// to the original queries variables so that the caller can easily
// understand and use the returned set of substitutions
InferenceResult infResult = getInferenceProcedure().ask(this,
saResult.getStandardized());
for (Proof p : infResult.getProofs()) {
Map<Variable, Term> im = p.getAnswerBindings();
Map<Variable, Term> em = new LinkedHashMap<Variable, Term>();
for (Variable rev : saResult.getReverseSubstitution().keySet()) {
em.put((Variable) saResult.getReverseSubstitution().get(rev),
im.get(rev));
}
p.replaceAnswerBindings(em);
}