public String getMdx() {
final Writer writer = new StringWriter();
if (SaikuProperties.OLAPCONVERTQUERY) {
try {
SelectNode s = QueryConverter.convert(query);
s.unparse(new ParseTreeWriter(new PrintWriter(writer)));
} catch (SaikuIncompatibleException se) {
LOG.debug("Cannot convert to new query model mdx, falling back to old version", se);
this.query.getSelect().unparse(new ParseTreeWriter(new PrintWriter(writer)));
} catch (Exception e) {
throw new SaikuServiceException("Cannot convert to new query model", e);