Java 应用程序中应包含哪个 pentaho mondrian 库以将 MDX 映射到 SQL

发布于 2024-09-24 18:04:00 字数 270 浏览 0 评论 0 原文

我想实现一个为 MDX 查询提供支持的应用程序。为此,我想使用 pentaho mondrian 中的一个库(带有 MDX 接口的开源 OLTP 服务器) )将 MDX 查询转换为下划线数据库的 SQL(基于 xml 描述),不幸的是,我找不到任何信息,我需要在我的项目中包含哪些库以及如何使用它们,以使 MDX 到 SQL 映射工作。

有人有在她/他的应用程序中重用蒙德里安组件的经验吗?

I want to implement an application that provides support for MDX queries. For this purpose I would like to use one of libraries from pentaho mondrian (an open source OLTP server with the MDX interface) that transforms MDX queries into SQL of underlining database (based on a xml description), unfortunately I can not find any information which libraries I need to include -- and how to use them -- in my project to have MDX to SQL mapping working.

Does anybody have some experience in reusing mondrian components in her/his application?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

焚却相思 2024-10-01 18:04:00

我建议下载 Mondrian 的最新 3.2.0 版本,它随其所有依赖项一起分发。发行版中还包含一个 ivy 文件,它描述了其依赖项。

最新版本:

文档也可以在 Pentaho 的网站上找到。祝你好运!

I recommend downloading the latest 3.2.0 build of Mondrian, it is distributed with all of its dependencies. Also included in the distribution is an ivy file which describes its dependencies.

Latest Release:
http://forums.pentaho.com/showthread.php?77035-Mondrian-3.2-GA-Schema-Workbench-and-Agg-Designer-stable-available-on-SourceForge&p=239443#poststop

Documentation can be found on Pentaho's Website as well. Good luck!

明月夜 2024-10-01 18:04:00

Olap4j 现在是 pentaho mondrian 的一部分。
也许您可以在olap4j API 中找到信息? http://www.olap4j.org/

在此页面上我看到:

org.olap4j.mdx .parser
MDX 查询语言的解析器。

olap4j 是一个用于 OLAP 的开放 Java API。

可以将其想象为 JDBC,但是对于
访问多维数据。

olap4j 被设计为通用 API
对于任何 OLAP 服务器,因此您可以编写
一台 OLAP 服务器上的应用程序以及
轻松将其切换到另一个。并建成
在该 API 上,将会有越来越多的
工具和组件的集合。

Olap4j is part of pentaho mondrian now .
Perhaps you can find information into olap4j API ? http://www.olap4j.org/

On this page i see :

org.olap4j.mdx.parser :
Parser for the MDX query language.

olap4j is an open Java API for OLAP.

Think of it like JDBC, but for
accessing multi-dimensional data.

olap4j is designed to be a common API
for any OLAP server, so you can write
an application on one OLAP server and
easily switch it to another. And built
on that API, there will be a growing
collection of tools and components.

怀中猫帐中妖 2024-10-01 18:04:00

看起来 mondrian.rolap.agg.AggregationManager 有一些与之相关的代码,但它并不直接。

parseTree = this.olap4jConnection.getMondrianConnection().parseStatement(mdx);
DrillThrough plan1 = (DrillThrough)parseTree;
Query query = plan1.getQuery();
query.setResultStyle(ResultStyle.LIST);
this.setQuery(query);
CellSet cellSet = this.executeOlapQueryInternal(
    query, 
    (MondrianOlap4jCellSetMetaData) null
);
List coords = Collections.nCopies(cellSet.getAxes().size(), Integer.valueOf(0));
MondrianOlap4jCell cell = (MondrianOlap4jCell) cellSet.getCell(coords);
ResultSet resultSet = cell.drillThroughInternal(
    plan1.getMaxRowCount(), 
    plan1.getFirstRowOrdinal(), 
    plan1.getReturnList(), 
    true, 
    (Logger)null, 
    rowCountSlot
);

如果你遵循最后一行,

cell.drillThroughInternal(...)

你会在这里结束

字符串sql = this.getDrillThroughSQL(fields, ExtendedContext);

但我不太确定 mondrian 是否只为 mdx 生成一个 SQL。我认为通过 XMLA(大多数工具将其用作接口),您可以请求在单个轴上进行钻取,其中完整的查询不会被重写。

希望这个答案。

It looks like mondrian.rolap.agg.AggregationManager has some code related to it but its not straight forward.

parseTree = this.olap4jConnection.getMondrianConnection().parseStatement(mdx);
DrillThrough plan1 = (DrillThrough)parseTree;
Query query = plan1.getQuery();
query.setResultStyle(ResultStyle.LIST);
this.setQuery(query);
CellSet cellSet = this.executeOlapQueryInternal(
    query, 
    (MondrianOlap4jCellSetMetaData) null
);
List coords = Collections.nCopies(cellSet.getAxes().size(), Integer.valueOf(0));
MondrianOlap4jCell cell = (MondrianOlap4jCell) cellSet.getCell(coords);
ResultSet resultSet = cell.drillThroughInternal(
    plan1.getMaxRowCount(), 
    plan1.getFirstRowOrdinal(), 
    plan1.getReturnList(), 
    true, 
    (Logger)null, 
    rowCountSlot
);

If you follow the last line,

cell.drillThroughInternal(...)

you will end up here

String sql = this.getDrillThroughSQL(fields, extendedContext);

But I am not so sure if mondrian generates only one SQL for an mdx. I think through XMLA (which most tools use as interface), you can request a drill through on a single axis, in which the complete query is not rewritten.

Hope this answers.

完美的未来在梦里 2024-10-01 18:04:00

我使用 hsqldb 支持的 Mondrian,以便开发人员针对内存数据库进行工作,但当我们部署到实际环境时,切换到非 Mondrian OLAP 实现。意味着我们可以做一些更灵活的开发,本质上只是使用 Mondrian 将 MDX 转换为 sql。

我创建了一个 SpringBoot/mvn 测试用例并使用 此处评论之一中的 MondrianDaoSupport 模板。同一页面还对所需的 mvn 依赖项提供了一些帮助(注意:我必须将 jflex 1.4.1 与 mondrian 3.2.0 一起使用才能解决 NPE 问题)。使用 SpringBoot 和 hsqldb,我使用测试启动时的数据创建 ROLAP 模式。然后我将架构文件作为类路径资源注入,数据源就是自动装配的 hsqldb 数据源。到目前为止,它运行良好 - 只需约一秒钟即可运行 Junit 测试,该测试用数据引导新的数据库并执行 MDX 查询。我预计在尝试使用更复杂的 MDX 查询时会出现一些问题 - 但让我们看看。

I’m using Mondrian backed by hsqldb so that developers work against in-memory dbs, but then switch to non-Mondrian OLAP implementation when we deploy to real environment. Means we can do some more nimble development, essentially just using Mondrian to convert MDX to sql.

I have created a SpringBoot/mvn test case and used this page to get started – copying the ROLAP ddl and Mondrian mapping schema. I used the MondrianDaoSupport template from one of the comments here. Same page also has some help on mvn dependencies required (nb: i had to use jflex 1.4.1 with mondrian 3.2.0 in order to get past a NPE issue). Using SpringBoot with hsqldb i create the ROLAP schema with data on test start up. Then I inject the schema file as a classpath resource, and Datasource is then the autowired hsqldb datasource. It’s working well so far – taking just ~second to run Junit test that bootstraps a fresh db with data and executes an MDX query. I expect some problems when trying to use more complex MDX queries – but let’s see.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文