PDA

View Full Version : xmla4js



jhyde
01-14-2010, 09:30 PM
Yesterday I attended Roland Bouman's webinar introducing xmla4js (http://wiki.pentaho.com/display/COM/January+13,+2010+-+Roland+Bouman+-+OLAP+and+Analysis+for+web+applications+using+XMLA). Xmla4js is a library for connecting to OLAP servers in JavaScript. All you need is an OLAP server that speaks XMLA (and most of them do).

It's classic web 2.0 technology. It does virtually nothing, yet changes everything. There is very little code (about 20K), an old-school enterprise architect would regard it as a trivial piece of protocol glue, and yet it opens the door to all kinds of mashups. Those mashups will get powerful OLAP data into the hands, and onto the screens, of the business users who care about that data.

Roland is a practical guy and a great communicator, so the presentation (and the download from google code (http://code.google.com/p/xmla4js/)) includes several examples of those mashups. I urge you to take a look at the recorded webinar.

A few issues came up during the webinar that are worth mulling over.

1. Query model


One thing that is missing is a query model. A query model allows you to represent the state of the current query, apply a transformation (say sorting on column #3, or adding a hierarchy to an axis), then generate a new MDX statement to send to the OLAP server. The demo Roland showed had a rudimentary query model, but in order to do more complex analyses, that query model will run out of road very quickly.

It's a problem that xmla4js shares with olap4j (http://www.olap4j.org) (as the PAT (http://code.google.com/p/pentahoanalysistool/) developers know only too well). I'd like to find a way to pool resources.

We could create a query model that works both on olap4j (in Java) and on xmla4js (in JavaScript). There would be two implementations, but at least the transformations can be specified in a language-neutral way, and we could write a single test suite that could exercise both implementations.

2. Cube metadata


Roland bemoaned the fact that getting the metadata for a cube (including dimensions, hierarchies, levels, measures) takes several XMLA round-trips.

He has a good point. Those round-trips may make the page load several times slower. We could easily extend Mondrian's cube metadata request so that you can ask for those extra elements.

If it proves useful, other XMLA engines (such as PALO (http://www.jedox.com/en/about-jedox/press-ordner/press-archive/archive/Palo-Open-Source-OLAP-Server-now-supports-MDX-and-Excel-Pivot-Tables.html)) could do the same, and heck, if the XMLA council is not asleep in their castle (http://cwebbbi.spaces.live.com/blog/cns!7B84B0F2C239489A!1294.entry), they could add it to the next version of the XMLA spec. (Well, we can hope.)

3. Results in JSON


Roland pointed out that XMLA is a verbose and inconvenient data format for JavaScript to consume. The "industry standard" for that environment is JSON (http://www.json.org/). It has a similar attributes/values/nested sets structure to XML but is easier to parse: because it is syntactically valid JavaScript you just execute the JSON code to get the value.

Mondrian's XMLA servlet is written to generate elements, attributes, and nested collections of elements, and precious little of the code directly generates XML. It wouldn't be too much work to generate JSON instead. The JSON would have the same structure as the XMLA, sans the irritating namespaces that are necessary in XML.

For example, the JSON response from MDSCHEMA_CUBES could look like this:


"DiscoverResponse": {
"return": {
"root": {
"row": [
{
"CATALOG_NAME": "FoodMart",
"SCHEMA_NAME": "FoodMart",
"CUBE_NAME": "HR",
"CUBE_TYPE": "CUBE",
"IS_DRILLTHROUGH_ENABLED": true,
"IS_WRITE_ENABLED": false,
"IS_LINKABLE": false,
"IS_SQL_ENABLED": false,
"DESCRIPTION": "FoodMart Schema - HR Cube"
},
{
"CATALOG_NAME": "FoodMart",
"SCHEMA_NAME": "FoodMart",
"CUBE_NAME": "Sales",
"CUBE_TYPE": "CUBE",
"IS_DRILLTHROUGH_ENABLED": true,
"IS_WRITE_ENABLED": false,
"IS_LINKABLE": false,
"IS_SQL_ENABLED": false,
"DESCRIPTION": "FoodMart Schema - Sales Cube"
},
]
}
}

I'd like to hear Roland's (and the Mondrian, Pentaho, olap4j and PAT community's) take on these points. Thanks again Roland for an informative webinar and a great new addition to the open source BI technology stack.https://blogger.googleusercontent.com/tracker/5672165237896126100-9002652898272515547?l=julianhyde.blogspot.com


More... (http://julianhyde.blogspot.com/2010/01/xmla4js.html)