Skip to Content

A couple of weeks ago, I insinuated in a The BI Java SDK:  What’s in it for you? that the new BI Java SDK was built with ease-of-use in mind:

We provide examples, a complete documentation set, and simplified command interfaces that help you build complicated MDX or SQL statements without having to write them from scratch.

Allow me to elaborate! In this post, I’m going to introduce the concept of command interfaces in the SDK, demonstrating their power and their contribution to ease-of-use of our APIs. To do this, I’ll also rely on the assistance of the built-in documentation set. Perhaps this will provide you with a head start to using both.

To begin, consider a typical business question:

Show me the total sales — in quantity and cost — for all distribution channels of the Hi-Tech division.

A simple business question with a simple result. In the OLAP domain, underlying such a result is an MDX statement like the following:

SELECT NON EMPTY {[Measures].[0D_QUANT_B], [Measures].[0D_COSTVALS]} ON AXIS(0), NON EMPTY {[0D_DIS_CHAN].[All]} ON AXIS(1) FROM [$0D_SD_C03] WHERE ([0D_DIV].[7], [0D_VERSION].[000], [0D_VTYPE].[010]) CELL PROPERTIES CELL_ORDINAL, VALUE, FORMATTED_VALUE

That’s long enough as it is for such a simple result. Do you want to code that by hand?

The command interfaces of the BI Java SDK — the OLAP Command Processor and the Relational Command Processor — offer an alternative. These interfaces hide the complexity of such low-level protocols as MDX and SQL by providing sets of “macro-like” methods in plain language that help you build the dimensions and create the layout of a query (among other things).

To illustrate the power and simplicity of these interfaces, consider that you could generate the MDX above using just two of the OLAP Command Processor’s methods:

moveDimensionToRows(Dimension)
addMember(IBIMember)

After you’ve connected to your data source, retrieved its metadata, and created the query and OLAP Command Processor objects using the SDK’s APIs, you only need to use simple methods in the command processor to build out the query for this business question, moving the distribution channel dimension to rows and adding the members you want, such as the Hi-Tech division, cost, and quantity members.

But that’s not all the command interfaces help with. As you know if you are familiar with business questions, you typically don’t stop there. You want to analyze a result – navigate further into it to find out the salient business reason behind it. The command interfaces also help with further manipulating the result in this way, offering additional simple methods to drill up and down, zoom in and out, sort, and swap axes, just to name a few. All without coding any MDX.

For example, you want to take our business question above, and zoom in on the distribution channel to see which channels contribute the most. Just use the following method of the OLAP Command Processor:

zoomInMember(IBIMember)

Want to zoom back out?

zoomOutMember(IBIMember)

Want to drill down instead?

drillDownMember(IBIMember)

Drill back up?

drillUpMember(IBIMember)

You get the picture: simple, easy-to-understand methods. Now, take a look at the picture – the result sets of each of the above activities. These are included in the SDK’s built-in documentation set. I’ve just stepped you through the SDK’s OLAP 8 example, and in the doc set you can also view the Java source code that builds these tables.

Do you have a relational data source? Is it not MDX, but SQL you need? For one more example, see Relational 5 for how to get out of having to code SQL like this by hand:

SELECT "C"."CARRNAME" AS "Carrier Name", "P"."CONNID" AS "Flight", "P"."CITYFROM" AS "From", "P"."CITYTO" AS "To", "A"."FLDATE" AS "Date", "P"."DEPTIME" AS "Departs", "A"."PRICE" AS "Price", "A"."CURRENCY" AS "Curr" FROM "TEST_CARRIERS" "C", "TEST_PLANFLI" "P", "TEST_ACTFLI" "A" WHERE ((("C"."MANDT" = "P"."MANDT") AND ("C"."CARRID" = "P"."CARRID")) AND (("P"."MANDT" = "A"."MANDT") AND ("P"."CARRID" = "A"."CARRID"))) AND ("P"."CONNID" = "A"."CONNID") ORDER BY "C"."CARRNAME" ASC, "P"."CITYFROM" ASC, "P"."CITYTO" ASC, "A"."FLDATE" ASC, "P"."DEPTIME" ASC

With a few simple methods of the Relational Command Processor, concern yourself instead with building a meaningful, easy-to-read result:

Carrier Name
Flight
From
To
Date
Departs
Price
Curr
ABC Airlines 1000 Frankfurt Paris 19991230
081000
200
DEM
ABC Airlines 1234 Paris Frankfurt 19991230
175500
500
DEM
ABC Airlines 1234 Paris Frankfurt 19991231
175500
300
DEM
XYZ Flights 0007 Frankfurt Madrid 19990505
093500
110
USD
XYZ Flights 0006 Madrid Moscow 19990606
163000
100
USD

See the Java source code and result for this example, Relational 5, in the documentation set.

Also, take a look at the full list of examples included with the SDK documentation set.

And finally, read the complete documentation in the Javadocs for the command interfaces:

Of course, if you want do delve deeply into the query models beneath these interfaces, we open that up for you in the SDK as well — but I hope I’ve demonstrated how easy it is to get jump-started into building real value using simple plain-language commands in the methods of the SDK’s command interfaces.

Download the BI Java SDK from the SDN downloads page today! Have fun.

P.S.: By the way, did you notice the parameter of the OLAP Command Processor methods above called IBIMember? What’s the IBI for? "IBI" stands for interface business intelligence – meaning extensions we have created in the SDK. But what about the Dimension parameter (without the IBI)? That’s a hint that we’ve leveraged some powerful new open-standards concepts within our architecture – in this case, the Common Warehouse Metamodel. But that’s a different story…

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Michael Cavanaugh
    Hi Moya,

    Any idea how to connect to the BI interfaces using the login information from the portal?  I would like to use the command objects you referenced, but without having the user reenter the user name / password information.  I know the SSO process is available, but how do I link that to the Java connection object?

    Regards,
    Michael

    (0) 
    1. Moya Watson Post author
      hi michael –
      i understand from our engineers you can use SSO and user mapping to retrieve login information from the portal. hope that helps you set it up –
      thanks for reading / writing.
      -m
      (0) 

Leave a Reply