This docker image demonstrates the use of Mondrian for performing online analytical processing (OLAP) queries of files in data.world datasets. It uses a REST API wrapper for Mondrian and the data.world JDBC driver to do the heavy lifting.
One nice benefit of this approach is that the REST API returns results in a format conducive to visualization by Vega-Lite. The demo includes a static html page that presents data from the 2016 US presidential election, which resides in a publicly available data.world dataset:
The files involved in construction of the image are:
Dockerfile
: The dockerfile for the image, derived from the stock Tomcat 8 imagefiles/application.properties
: Spring properties file to configure the REST API (the REST API is implemented as a Spring Boot application)files/demo.js
: Javascript file for the static /demo page; mostly handles submission of the MDX query to the API and creation of the Vega-Lite spec for visualizationfiles/index.html
: Simple Bootstrap 4 html page that provides a visualization demo (available in the container at http://[host]/demo)files/launch-tomcat-with-token.sh
: shell script used as theCMD
that is run in containers; sets the data.world API token on the REST API's connection configuration to authenticate data.world JDBC callsfiles/mondrian-connections.json
: REST API connection configurationfiles/PresidentialElectionResults2016.xml
: Mondrian Schema that defines the OLAP cubes on top of the sample dataset file
Build the image from inside the folder containing the Dockerfile and files subdirectory with: docker build -t data.world-mondrian-demo .
The image is also publicly available on DockerHub.
To run in detatched mode and listen on host port 80 (leave off the scottcame/
prefix if you've built it locally):
docker run -d -p 80:80 --name dw-mondrian-demo -e DW_TOKEN=[api token goes here] scottcame/data.world-mondrian-demo
Note that you need to supply your data.world API token as a container environment variable. To obtain a token, first # for a data.world account (if you don't already have one) and then visit https://data.world/settings/advanced.
Then (assuming the container is running on localhost), the following are available:
- The demo page: http://localhost/demo
- The mondrian-rest API: http://localhost/mondrian-rest (see https://github.com/ojbc/mondrian-rest for API documentation)
- The simple MDX query interface included with the API: http://localhost/mondrian-rest/query-ui/