Xmla4js

  • 668 views
Uploaded on

Xmla4js is a standalone javascript library that provides basic XML for Analysis (XML/A) capabilities, allowing javascript developers to access data and metadata from OLAP provides for use in rich …

Xmla4js is a standalone javascript library that provides basic XML for Analysis (XML/A) capabilities, allowing javascript developers to access data and metadata from OLAP provides for use in rich (web) applications. Xmla4js can be used inside a webpage or in a server environment like node.js

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
668
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
4
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Roland Bouman: http://rpbouman.blogspot.com/ Xmla4js: http://code.google.com/p/xmla4js/ 1 OLAP for Web applications X4js MLA
  • 2. Roland Bouman: http://rpbouman.blogspot.com/ Xmla4js: http://code.google.com/p/xmla4js/ 2 Welcome, thanks for attending! ● Roland Bouman; Leiden, Netherlands ● Ex MySQL AB, Sun Microsystems ● Web and BI Developer ● Co-author of “Pentaho Solutions” ● Blog: http://rpbouman.blogspot.com/ ● Twitter: @rolandbouman
  • 3. Roland Bouman: http://rpbouman.blogspot.com/ Xmla4js: http://code.google.com/p/xmla4js/ 3 Program ● In a nutshell... ● XML/A overview ● Using XML/A in webpages ● Making life a little easier – Xmla4js ● Demonstration ● Questions and answers ● Links and resources
  • 4. Roland Bouman: http://rpbouman.blogspot.com/ Xmla4js: http://code.google.com/p/xmla4js/ 4 Program ● In a nutshell... ● XML/A overview ● Using XML/A in webpages ● Making life a little easier – Xmla4js ● Demonstration ● Questions and answers ● Links and resources
  • 5. Roland Bouman: http://rpbouman.blogspot.com/ Xmla4js: http://code.google.com/p/xmla4js/ 5 In a nutshell... ● XML/A = XML for Analysis ● Industry standard for OLAP over HTTP ● Xmla4js = javascript API to enable XML/A ● OLAP data for your web applications
  • 6. Roland Bouman: http://rpbouman.blogspot.com/ Xmla4js: http://code.google.com/p/xmla4js/ 6 Program ● In a nutshell... ● XML/A overview ● Using XML/A in webpages ● Making life a little easier – Xmla4js ● Demonstration ● Questions and answers ● Links and resources
  • 7. Roland Bouman: http://rpbouman.blogspot.com/ Xmla4js: http://code.google.com/p/xmla4js/ 7 XML/A Overview ● XML for Analysis is a communication protocol – SOAP Webservice: XML, HTTP ● Initiated by Microsoft ● Supported by multiple vendors and products: – Microsoft Analysis Services – Oracle Essbase – SAP BW – PALO Server (EE)
  • 8. Roland Bouman: http://rpbouman.blogspot.com/ Xmla4js: http://code.google.com/p/xmla4js/ 8 XML/A is SOAP ● Standard HTTP request/response: – Client sends a request using an URL – Server sends a response ● SOAP Webservice – simple object access protocol – request and response are XML documents – XML format is more or less predefined ● Method invocation analogy
  • 9. Roland Bouman: http://rpbouman.blogspot.com/ Xmla4js: http://code.google.com/p/xmla4js/ 9 XML/A Methods ● Discover: – Obtaining metadata – Request: request type, properties, restrictions – Response: Tabular schema rowset ● Execute: – Performing queries – Request: MDX statement, properties – Response: Multidimensional resultset
  • 10. Roland Bouman: http://rpbouman.blogspot.com/ Xmla4js: http://code.google.com/p/xmla4js/ 10 Typical XML/A Calling Sequence ServerClient Discover Schema Rowset (metadata) Model (metadata) Visualization (data) Request type, restrictions Statement (MDX) Execute Multidimensional Resultset (data)
  • 11. Roland Bouman: http://rpbouman.blogspot.com/ Xmla4js: http://code.google.com/p/xmla4js/ 11 Program ● In a nutshell... ● XML/A overview ● Using XML/A in webpages ● Making life a little easier – Xmla4js ● Demonstration ● Questions and answers ● Links and resources
  • 12. Roland Bouman: http://rpbouman.blogspot.com/ Xmla4js: http://code.google.com/p/xmla4js/ 12 Using XML/A in webpages ● Webpage client-side programming: – Javascript ● HTTP requests: AJAX – XMLHttpRequest ● Working with XML: – Document Object Model (DOM) – XPath, XSLT – Framework like jQuery
  • 13. Roland Bouman: http://rpbouman.blogspot.com/ Xmla4js: http://code.google.com/p/xmla4js/ 13 XML/A in webpages: Example SELECT [Measures].[Profit] ON COLUMNS, [Product].[All Products].Children ON ROWS FROM [Sales] Measures Profit Drink $ 29,358.98 Food $245,764.87 Non-Consumable $ 64,487.05
  • 14. Roland Bouman: http://rpbouman.blogspot.com/ Xmla4js: http://code.google.com/p/xmla4js/ 14 XML/A with raw javascript <script type=”text/javascript”> var url = "http://localhost:8080/pentaho/Xmla?userid=joe&password=password"; var datasource = "Pentaho Analysis Services"; var catalog = "FoodMart"; var mdx = "SELECT [Measures].[Profit] ON COLUMNS," + " [Product].[All Products].Children ON ROWS " + "FROM [Sales]"; var request = "<SOAP-ENV:Envelope" + " xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"" + " SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">" + " <SOAP-ENV:Body>" + " <Execute" + " xmlns="urn:schemas-microsoft-com:xml-analysis"" + " SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">" + " <Command>" + " <Statement>" + mdx + "</Statement>" + " </Command>" + " <Properties>" + " <PropertyList>" + " <DataSourceInfo>" + datasource + "</DataSourceInfo>" + " <Catalog>" + catalog + "</Catalog>" + " <Format>Tabular</Format>" + " </PropertyList>" + " </Properties>" + " </Execute>" + " </SOAP-ENV:Body>" + "</SOAP-ENV:Envelope>"; var xhr = new XMLHttpRequest(); xhr.open("POST", url, false); xhr.setRequestHeader("Content-Type", "text/xml"); xhr.send(request); var response = xhr.responseXML; var rows = response.getElementsByTagNameNS( "urn:schemas-microsoft-com:xml-analysis:rowset", "row" ); var colHeaders = response.getElementsByTagNameNS( "urn:schemas-microsoft-com:xml-analysis:rowset", "row" ); var rowArray = []; for (var i=0; i<rows.length; i++){ var row = rows.item(i); var cols = row.getElementsByTagName("*"); var rowArrayEntry = {}; rowArray.push(rowArrayEntry); for (var j=0; j<cols.length; j++){ var col = cols.item(j); rowArrayEntry[col.nodeName] = col.firstChild.data } } </script>
  • 15. Roland Bouman: http://rpbouman.blogspot.com/ Xmla4js: http://code.google.com/p/xmla4js/ 15 Program ● In a nutshell... ● XML/A overview ● Using XML/A in webpages ● Making life a little easier – Xmla4js ● Demonstration ● Questions and answers ● Links and resources
  • 16. Roland Bouman: http://rpbouman.blogspot.com/ Xmla4js: http://code.google.com/p/xmla4js/ 16 Xmla4js sample code <script type="text/javascript" src="../src/Xmla.js"></script> <script type="text/javascript"> var rowArray = new Xmla().execute({ async: false, url: "http://localhost:8080/pentaho/Xmla", statement: "SELECT [Measures].[Profit] ON COLUMNS," + " [Product].[All Products].Children ON ROWS "+ "FROM [Sales]", properties: { DataSourceInfo: "Pentaho Analysis Services", Catalog: "FoodMart", Format: "Tabular" } }).fetchAllAsObject(); </script> [ {"[Product].[Product Family].[MEMBER_CAPTION]":"Drink", "[Measures].[Profit]":29358.9754} , {"[Product].[Product Family].[MEMBER_CAPTION]":"Food", "[Measures].[Profit]":245764.86650000003} , {"[Product].[Product Family].[MEMBER_CAPTION]":"Non-Consumable", "[Measures].[Profit]":64487.0545} ]
  • 17. Roland Bouman: http://rpbouman.blogspot.com/ Xmla4js: http://code.google.com/p/xmla4js/ 17 Xmla4js Library Overview ● One file (< 20 kb minified but uncompressed) ● Cross browser ● Standalone (no dependency on framework) ● LGPL
  • 18. Roland Bouman: http://rpbouman.blogspot.com/ Xmla4js: http://code.google.com/p/xmla4js/ 18 Xmla4js API Overview ● Just three “Classes” – Xmla – Xmla.Rowset – Xmla.Exception ● YUI Doc documentation
  • 19. Roland Bouman: http://rpbouman.blogspot.com/ Xmla4js: http://code.google.com/p/xmla4js/ 19 Xmla4js Methods: ● Xmla: – addListener() – request() – discover() – execute()
  • 20. Roland Bouman: http://rpbouman.blogspot.com/ Xmla4js: http://code.google.com/p/xmla4js/ 20 Xmla4js Methods: ● Xmla.Rowset: – hasMoreRecords(), curr(), next() – getFields() – fetchAsArray(), fetchAsObject() – fetchAllAsArray(), fetchAllAsObject()
  • 21. Roland Bouman: http://rpbouman.blogspot.com/ Xmla4js: http://code.google.com/p/xmla4js/ 21 Program ● In a nutshell... ● XML/A overview ● Using XML/A in webpages ● Making life a little easier – Xmla4js ● Demonstration ● Questions and answers ● Links and resources
  • 22. Roland Bouman: http://rpbouman.blogspot.com/ Xmla4js: http://code.google.com/p/xmla4js/ 22 Program ● In a nutshell... ● XML/A overview ● Using XML/A in webpages ● Making life a little easier – Xmla4js ● Demonstration ● Questions and answers ● Links and resources
  • 23. Roland Bouman: http://rpbouman.blogspot.com/ Xmla4js: http://code.google.com/p/xmla4js/ 23 Program ● In a nutshell... ● XML/A overview ● Using XML/A in webpages ● Making life a little easier – Xmla4js ● Demonstration ● Questions and answers ● Links and resources
  • 24. Roland Bouman: http://rpbouman.blogspot.com/ Xmla4js: http://code.google.com/p/xmla4js/ 24 Links and resources ● Project: http://code.google.com/p/xmla4js/ ● Specification: http://www.xmlforanalysis.com/xmla1.1.doc ● Docs: http://msdn.microsoft.com/en-us/library/ms187178(SQL.90).aspx