Skip to content

Commit

Permalink
MONDRIAN: Integrate from //open/mondrian-release/3.1 changes 13189-13…
Browse files Browse the repository at this point in the history
…226.

Viz:

Change 13226 on 2009/12/11 by jhyde@jhyde.mackerel2

MONDRIAN/3.1: Change rules for generating captions and descriptions of
    hierarchies in shared dimensions that are used multiple times within the
    same cube. If the <DimensionUsage> has a name and that name is different
    from the name of the shared dimension, prefix the caption and description of
    the hierarchy with the caption of the dimension usage (which can be
    specified directly, or defaults to the name of the dimension usage).

Change 13225 on 2009/12/10 by jhyde@jhyde.mackerel2

MONDRIAN/3.1: Two changes to enable mondrian to be accessed via olap4j in the
    Pentaho platform.

1. Add method Util.convertOlap4jConnectStringToNativeMondrian to allow legacy
apps like JPivot to take olap4j connect strings and continue to use Mondrian
connections under the covers.

2. Add plugin mondrian.spi.DataSourceResolver, controlled by property
mondrian.spi.dataSourceResolverClass, to allow container to control how
Mondrian converts a data source string like "jdbc/MondrianFoodMart" into
a javax.sql.DataSource object. The default is to use JNDI. The Pentaho
platform uses its own variant of JNDI.

Change 13224 on 2009/12/10 by jhyde@jhyde.mackerel2

MONDRIAN/3.1: Add DISPLAY_FOLDER as a member property. Use it if you
    want a UI such as Analyzer to group your measures into folders.

Change 13223 on 2009/12/10 by jhyde@jhyde.mackerel2

MONDRIAN/3.1: Oops!

Change 13222 on 2009/12/10 by jhyde@jhyde.mackerel2

MONDRIAN/3.1: Add annotations (user-defined properties against metadata
    elements; MONDRIAN-652).

Change 13220 on 2009/12/09 by jhyde@jhyde.mackerel2

MONDRIAN/3.1: Add caption and description to major schema elements (schema,
    cube, virtual cube, dimension, dimension usage, hierarchy, level,
    measure, calculated member, named set) and make sure that they come out
    correctly in getCaption() and getDescription() methods. (MONDRIAN-632.)

Change 13209 on 2009/12/06 by jhyde@jhyde.atc-hp

MONDRIAN: Implement dialect for HP Neoview. All tests pass bar one.
    Change JdbcDialectImpl method supportsOrderByNullsLast to more
    powerful generateOrderByNullsLast.

Change 13201 on 2009/11/30 by jhyde@jhyde.marmalade

MONDRIAN: Change license of CacheMap to EPL (with permission of author Luis Canals, Tasecurity).

Change 13197 on 2009/11/27 by jhyde@jhyde.marmalade

MONDRIAN: Oops!

Change 13196 on 2009/11/27 by jhyde@jhyde.marmalade

MONDRIAN: Integrate @13195 to mondrian-3.1 branch: comply with latest checkFile.

Change 13189 on 2009/11/25 by jhyde@jhyde.marmalade

MONDRIAN: Implement RolapCubeLevel.getCaption (bug MONDRIAN-655).

[git-p4: depot-paths = "//open/mondrian/": change = 13227]
  • Loading branch information
julianhyde committed Dec 11, 2009
1 parent 84ac1c1 commit db75e4e
Show file tree
Hide file tree
Showing 58 changed files with 1,448 additions and 211 deletions.
16 changes: 14 additions & 2 deletions demo/FoodMart.xml
Expand Up @@ -202,9 +202,12 @@ CONCAT(CONCAT("customer"."fname", ' '), "customer"."lname")
<SQL dialect="luciddb">
"fname" || ' ' || "lname"
</SQL>
<SQL dialect="teradata">
<SQL dialect="neoview">
"customer"."fullname"
</SQL>
<SQL dialect="teradata">
"fname" || ' ' || "lname"
</SQL>
</SQL>
<SQL dialect="generic">
fullname
</SQL>
Expand All @@ -227,6 +230,9 @@ CONCAT(`customer`.`fname`, ' ', `customer`.`lname`)
</SQL>
<SQL dialect="mssql">
fname + ' ' + lname
</SQL>
<SQL dialect="neoview">
"customer"."fullname"
</SQL>
<SQL dialect="derby">
"customer"."fullname"
Expand Down Expand Up @@ -303,6 +309,9 @@ Iif("sales_fact_1997"."promotion_id" = 0, 0, "sales_fact_1997"."store_sales")
<!-- Workaround the fact that Infobright does not have a CASE operator.
The simpler expression gives wrong results, so some tests are
disabled. -->
<SQL dialect="neoview">
(case when "sales_fact_1997"."promotion_id" = 0 then 0 else "sales_fact_1997"."store_sales" end)
</SQL>
<SQL dialect="infobright">
`sales_fact_1997`.`store_sales`
</SQL>
Expand Down Expand Up @@ -628,6 +637,9 @@ CONCAT(CONCAT("customer"."fname", ' '), "customer"."lname")
</SQL>
<SQL dialect="luciddb">
"fname" || ' ' || "lname"
</SQL>
<SQL dialect="neoview">
"customer"."fullname"
</SQL>
<SQL dialect="generic">
fullname
Expand Down
15 changes: 14 additions & 1 deletion doc/configuration.html
Expand Up @@ -1163,6 +1163,19 @@ <h3>1.1 Property list<a name="Property_list">&nbsp;</a></h3>
mondrian.rolap.SqlMemberSource.ValuePoolFactory</a>.
</td>
</tr>
<tr>
<td><code>
<a href="api/mondrian/olap/MondrianProperties.html#DataSourceResolverClass">
mondrian.spi.dataSourceResolverClass</a></code></td>

<td>string</td>
<td><code><a href="api/mondrian/spi/impl/JndiDataSourceResolver.html">
mondrian.spi.impl.JndiDataSourceResolver</a></code></td>
<td>
If set, the specified plugin is used to resolve data source names in the
connect string into JDBC data source (javax.sql.DataSource) objects. If
not set, the default implementation uses JDNI to resolve.</td>
</tr>
</table>

<h3>Limit properties<a name="Limit_properties">&nbsp;</a></h3>
Expand Down Expand Up @@ -1572,7 +1585,7 @@ <h3>MDX and SQL Statement Logging<a name="Statement_Logging"></a></h3>

<hr noshade size="1"/>
<p>
Author: Julian Hyde; last modified January, 2008.<br/>
Author: Julian Hyde; last modified December, 2009.<br/>
Version: $Id$
(<a href="http://p4web.eigenbase.org/open/mondrian/doc/configuration.html?ac=22">log</a>)<br/>
Copyright (C) 2006-2009 Julian Hyde
Expand Down
103 changes: 86 additions & 17 deletions doc/schema.html
Expand Up @@ -28,7 +28,11 @@
######################## -->
<ol>
<li><a href="#What_is_a_schema">What is a schema?</a></li>
<li><a href="#Schema_files">Schema files</a></li>
<li><a href="#Schema_files">Schema files</a>
<ol>
<li><a href="#Annotation">Annotation</a></li>
</ol>
</li>
<li><a href="#Cubes_and_dimensions">Logical model</a>
<ol>
<li><a href="#Cube">Cube</a></li>
Expand Down Expand Up @@ -209,6 +213,41 @@ <h3>2. Schema files<a name="Schema_files">&nbsp;</a></h3>
<p>The content of each XML element is described in
<a href="#Appendix_A_XML_elements">Appendix A</a> and in the <a href="xml_schema.html">XML schema</a>.</p>

<!--
##########################
## 2.1 Annotations #####
########################## -->
<h1>2.1 Annotation<a name="Annotation">&nbsp;</a></h1>
<p>The major element types (schema, cube, virtual cube, shared dimension,
dimension, hierarchy, level, measure, calculated member) support annotations. An
annotation is a way of associating a user-defined property with a metadata
element, and in particular, allows tools to add metadata without extending the
official Mondrian schema.</p>

<p>Create an
<code><a href="#XML_Annotations">&lt;Annotations&gt;</a></code> element as a child of the element you wish to
annotate (generally it is the first child element, but check the schema
definition for details), then include a number of
<code><a href="#XML_Annotation">&lt;Annotation&gt;</a></code> elements.
<code><a href="#XML_Annotation">&lt;Annotation&gt;</a></code> Annotation
elements' names must be unique within their element. If you are adding
annotations to support a particular tool that you maintain, choose annotation
names carefully, to ensure that they do not clash with annotations used by other
tools.</p>

<p>The following example shows &quot;Author&quot; and &quot;Date&quot; annotations attached to a <code><a href="#XML_Schema">&lt;Schema&gt;</a></code> object.</p>

<blockquote style="text-indent: -20px">
<code>
<div style="padding-left:20px;">&lt;<a href="#XML_Schema">Schema</a> name=&quot;Rock Sales&quot;&gt;</div>
<div style="padding-left:40px;;">&lt;<a href="#XML_Annotations">Annotations</a>&gt;</div>
<div style="padding-left:60px;;">&lt;<a href="#XML_Annotation">Annotation</a> name="Author"&gt;Fred Flintstone&lt;/<a href="#XML_Annotation">Annotation</a>&gt;</div>
<div style="padding-left:60px;;">&lt;<a href="#XML_Annotation">Annotation</a> name="Date"&gt;10,000 BC&lt;/<a href="#XML_Annotation">Annotation</a>&gt;</div>
<div style="padding-left:40px;;">&lt;/<a href="#XML_Annotations">Annotations</a>&gt;</div>
<div style="padding-left:40px;;">&lt;<a href="#XML_Cube">Cube</a> name="Sales"&gt;</div>
<div style="padding-left:60px;;">...</div>
</code>
</blockquote>
<!--
###########################
## 3. Logical model #####
Expand Down Expand Up @@ -303,6 +342,7 @@ <h3>3. Logical model<a name="Cubes_and_dimensions">&nbsp;</a></h3>
</table>
</blockquote>
<p>Now let's look at the schema definition in more detail.</p>

<!--
########################
## 3.1 Cube #####
Expand Down Expand Up @@ -2550,14 +2590,19 @@ <h3>7. Internationalization<a name="I18n">&nbsp;</a></h3>

<p>It is unwise to translate the actual names of the schema objects, because then the MDX
statements would need to be changed also. All that you need to change is the caption. Every
schema object (schema, cube, dimension, level, measure) has a caption attribute, and user
interfaces such as JPivot display the caption rather than the real name. Additionally:</p>
schema object (schema, cube, virtual cube, dimension, hierarchy, level, measure,
named set) has a caption attribute, and user
interfaces such as JPivot and Pentaho Analyzer display the caption rather than the real name. Additionally:</p>

<ul>
<li>A hierarchy can have an <code>allMemberCaption</code> attribute
<li>Every schema object has a description attribute.</li>
<li>A hierarchy can have an <code>allMemberCaption</code> attribute
as display value of the "All" member. </li>
<li>For the schema we can set a display value of the "measures"
dimension by the <code>measuresCaption</code> attribute. </li>
<li>A calculated member has properties CAPTION and DESCRIPTION that appear
as caption and description if the member is a measure (that is, a member of
the <code>Measures</code> dimension).</li>
</ul>

<p>One way to create an internationalized application is to create a
Expand All @@ -2573,21 +2618,33 @@ <h3>7. Internationalization<a name="I18n">&nbsp;</a></h3>
<h1>7.1 Localizing schema processor</h1>

<p>First, write your schema using variables as values for <code>caption</code>,
<code>description</code>,
<code>allMemberCaption</code> and <code>measuresCaption</code> attributes as follows:</p>

<blockquote style="text-indent: -20px">
<code>
<div style="padding-left:20px;">&lt;<a href="#XML_Schema">Schema</a> measuresCaption="%{foodmart.measures.caption}"&gt;</div>
<div style="padding-left:40px;">&lt;<a href="#XML_Dimension">Dimension</a> name="Store" caption="%{foodmart.dimension.store.caption}"&gt;</div>
<div style="padding-left:60px;">&lt;<a href="#XML_Hierarchy">Hierarchy</a> hasAll="true" allMemberName="All Stores" allMemberCaption="%{foodmart.dimension.store.allmember.caption =All Stores}" primaryKey="store_id"&gt;</div>
<div style="padding-left:40px;">&lt;<a href="#XML_Dimension">Dimension</a> name="Store" caption="%{foodmart.dimension.store.caption}"
description=&quot;%{foodmart.dimension.store.description}&quot;&gt;</div>
<div style="padding-left:60px;">&lt;<a href="#XML_Hierarchy">Hierarchy</a> hasAll="true" allMemberName="All Stores" allMemberCaption="%{foodmart.dimension.store.allmember.caption =All Stores}" primaryKey="store_id"&nbsp;
caption=&quot;%{foodmart.hierarchy.store.country.caption}"
description=&quot;%{foodmart.hierararchy.store.country.description}&gt;</div>
<div style="padding-left:80px">&lt;<a href="#XML_Table">Table</a> name="store"/&gt;</div>
<div style="padding-left:80px;">&lt;<a href="#XML_Level">Level</a> name="Store Country" column="store_country" uniqueMembers="true" caption="%{foodmart.dimension.store.country.caption}"/&gt;</div>
<div style="padding-left:80px;">&lt;<a href="#XML_Level">Level</a> name="Store State" column="store_state" uniqueMembers="true" caption="%{foodmart.dimension.store.state.caption}"/&gt;</div>
<div style="padding-left:80px;">&lt;<a href="#XML_Level">Level</a> name="Store City" column="store_city" uniqueMembers="false" caption="%{foodmart.dimension.store.city.caption}"/&gt;</div>
<div style="padding-left:80px;">&lt;<a href="#XML_Level">Level</a> name="Store Name" column="store_name" uniqueMembers="true" caption="%{foodmart.dimension.store.name.caption}"&gt;</div>
<div style="padding-left:100px">&lt;<a href="#XML_Property">Property</a> name="Store Type" column="store_type" caption="%{foodmart.dimension.store. name.property_type.caption}"/&gt;</div>
<div style="padding-left:100px">&lt;<a href="#XML_Property">Property</a> name="Store Manager" column="store_manager" caption="%{foodmart.dimension.store. name.property_manager.caption}"/&gt;</div>
<div style="padding-left:100px">&lt;<a href="#XML_Property">Property</a> name="Store Sqft" column="store_sqft" type="Numeric" caption="%{foodmart.dimension.store. name.property_storesqft.caption}"/&gt;</div>
<div style="padding-left:80px;">&lt;<a href="#XML_Level">Level</a> name="Store Country" column="store_country" uniqueMembers="true" caption="%{foodmart.dimension.store.country.caption}"
description=&quot;%{foodmart.dimension.store.country.description}&quot;/&gt;</div>
<div style="padding-left:80px;">&lt;<a href="#XML_Level">Level</a> name="Store State" column="store_state" uniqueMembers="true" caption="%{foodmart.dimension.store.state.caption}"
description=&quot;%{foodmart.dimension.store.state.description}&quot;/&gt;</div>
<div style="padding-left:80px;">&lt;<a href="#XML_Level">Level</a> name="Store City" column="store_city" uniqueMembers="false" caption="%{foodmart.dimension.store.city.caption}"
description=&quot;%{foodmart.dimension.store.city.description}&quot;/&gt;</div>
<div style="padding-left:80px;">&lt;<a href="#XML_Level">Level</a> name="Store Name" column="store_name" uniqueMembers="true" caption="%{foodmart.dimension.store.name.caption}"
description=&quot;%{foodmart.dimension.store.name.description}&quot;&gt;</div>
<div style="padding-left:100px">&lt;<a href="#XML_Property">Property</a> name="Store Type" column="store_type" caption="%{foodmart.dimension.store. name.property_type.caption}"
description=&quot;%{foodmart.dimension.store. name.property_type.description}&quot;/&gt;</div>
<div style="padding-left:100px">&lt;<a href="#XML_Property">Property</a> name="Store Manager" column="store_manager" caption="%{foodmart.dimension.store. name.property_manager.caption}"
description=&quot;%{foodmart.dimension.store. name.property_manager.description}&quot;/&gt;</div>
<div style="padding-left:100px">&lt;<a href="#XML_Property">Property</a> name="Store Sqft" column="store_sqft" type="Numeric" caption="%{foodmart.dimension.store. name.property_storesqft.caption}"
description=&quot;%{foodmart.dimension.store.
name.property_storesqft.description}&quot;/&gt;</div>
<div style="padding-left:100px">&lt;<a href="#XML_Property">Property</a> name="Grocery Sqft" column="grocery_sqft" type="Numeric"/&gt;</div>
<div style="padding-left:100px">&lt;<a href="#XML_Property">Property</a> name="Frozen Sqft" column="frozen_sqft" type="Numeric"/&gt;</div>
<div style="padding-left:100px">&lt;<a href="#XML_Property">Property</a> name="Meat Sqft" column="meat_sqft" type="Numeric"/&gt;</div>
Expand All @@ -2597,11 +2654,15 @@ <h1>7.1 Localizing schema processor</h1>
<div style="padding-left:60px">&lt;/<a href="#XML_Hierarchy">Hierarchy</a>&gt;</div>
<div style="padding-left:40px;">&lt;/<a href="#XML_Dimension">Dimension</a>&gt;</div>
<br>
<div style="padding-left:40px;">&lt;<a href="#XML_Cube">Cube</a> name="Sales" caption="%{foodmart.cube.sales.caption}"&gt;</div>
<div style="padding-left:40px;">&lt;<a href="#XML_Cube">Cube</a> name="Sales" caption="%{foodmart.cube.sales.caption}"
description=&quot;%{foodmart.cube.sales.description}&quot;&gt;</div>
<div style="padding-left:60px;">...</div>
<div style="padding-left:60px">&lt;<a href="#XML_DimensionUsage">DimensionUsage</a> name="Store" source="Store" foreignKey="store_id"/&gt;</div>
<div style="padding-left:60px">&lt;<a href="#XML_DimensionUsage">DimensionUsage</a> name="Store" source="Store" foreignKey="store_id"&nbsp;
caption=&quot;%{foodmart.cube.sales.name.caption}&quot;
description=&quot;%{foodmart.cube.sales.name.description}&quot;/&gt;</div>
<div style="padding-left:60px;">...</div>
<div style="padding-left:60px">&lt;<a href="#XML_Measure">Measure</a> name="Unit Sales" column="unit_sales" caption="%{foodmart.cube.sales.measure.unitsales}"&gt;</div>
<div style="padding-left:60px">&lt;<a href="#XML_Measure">Measure</a> name="Unit Sales" column="unit_sales" caption="%{foodmart.cube.sales.measure.unitsales.caption}"
description=&quot;%{foodmart.cube.sales.measure.unitsales.description}&quot;/&gt;</div>
<div style="padding-left:40px;">&lt;/<a href="#XML_Cube">Cube</a>&gt;</div>
<div style="padding-left:10px;">&lt;/<a href="#XML_Schema">Schema</a>&gt;</div>
</code>
Expand Down Expand Up @@ -3266,6 +3327,14 @@ <h3>10. Appendix A: XML elements<a name="Appendix_A_XML_elements">&nbsp;</a></h3
<tr>
<td colspan="2"><i><br>Miscellaneous</i></td>
</tr>
<tr>
<td><code>&lt;<a href="xml_schema.html#Annotations" name="XML_Annotations">Annotations</a>&gt;</code></td>
<td>Holder for annotations.</td>
</tr>
<tr>
<td><code>&lt;<a href="xml_schema.html#Annotation" name="XML_Annotation">Annotation</a>&gt;</code></td>
<td>User-defined property attached to a metadata element.</td>
</tr>
<tr>
<td><code>&lt;<a href="xml_schema.html#Parameter" name="XML_Parameter">Parameter</a>&gt;</code></td>
<td>Part of the definition of a Hierarchy; passed to a MemberReader, if present.</td>
Expand Down Expand Up @@ -3310,7 +3379,7 @@ <h3>10. Appendix A: XML elements<a name="Appendix_A_XML_elements">&nbsp;</a></h3
<br />
<br />

<p>Author: Julian Hyde; last modified July 2009.<br/>
<p>Author: Julian Hyde; last modified December 2009.<br/>
Version: $Id$
(<a href="http://p4web.eigenbase.org/open/mondrian/doc/schema.html?ac=22">log</a>)<br/>
Copyright (C) 2001-2002 Kana Software, Inc..<br/>
Expand Down
16 changes: 16 additions & 0 deletions mondrian.properties
Expand Up @@ -88,6 +88,13 @@ RoleXX='California manager';
#mondrian.foodmart.jdbcPassword=pgAdmin
#mondrian.jdbcDrivers=org.postgresql.Driver

# Neoview
#mondrian.foodmart.jdbcURL=jdbc:hpt4jdbc://localhost:18650/:schema=PENTAHO;serverDataSource=PENTAHO_DataSource
#mondrian.foodmart.jdbcUser=<user>
#mondrian.foodmart.jdbcPassword=<password>
#mondrian.jdbcDrivers=com.hp.t4jdbc.HPT4Driver
#driver.classpath=<PATH>/hpt4jdbc.jar

# Netezza: mimics Postgres
#mondrian.foodmart.jdbcURL=jdbc:netezza://127.0.1.10/foodmart
#mondrian.foodmart.jdbcUser=<user>
Expand Down Expand Up @@ -467,6 +474,15 @@ mondrian.rolap.iterationLimit=0
#
#mondrian.rolap.SolveOrderMode=scoped

###############################################################################
# Property that defines
# the name of the plugin class that resolves data source names to
# javax.sql.DataSource objects. The class must implement the
# mondrian.spi.DataSourceResolver interface. If not specified,
# the default implementation uses JNDI to perform resolution.
#
#mondrian.spi.dataSourceResolverClass=mondrian.spi.impl.JndiDataSourceResolver

###############################################################################
# Property that controls the maximum number of results contained in a
# NativizeSet result set.
Expand Down
1 change: 1 addition & 0 deletions src/main/META-INF/services/mondrian.spi.Dialect
Expand Up @@ -11,6 +11,7 @@ mondrian.spi.impl.InterbaseDialect
mondrian.spi.impl.LucidDbDialect
mondrian.spi.impl.MicrosoftSqlServerDialect
mondrian.spi.impl.MySqlDialect
mondrian.spi.impl.NeoviewDialect
mondrian.spi.impl.NetezzaDialect
mondrian.spi.impl.OracleDialect
mondrian.spi.impl.PostgreSqlDialect
Expand Down
32 changes: 32 additions & 0 deletions src/main/mondrian/olap/Annotated.java
@@ -0,0 +1,32 @@
/*
// $Id$
// This software is subject to the terms of the Eclipse Public License v1.0
// Agreement, available at the following URL:
// http://www.eclipse.org/legal/epl-v10.html.
// Copyright (C) 2009-2009 Julian Hyde and others
// All Rights Reserved.
// You must accept the terms of that agreement to use this software.
*/

package mondrian.olap;

import java.util.Map;

/**
* An element that has annotations.
*
* @version $Id$
* @author jhyde
*/
public interface Annotated {
/**
* Returns a list of annotations.
*
* <p>The map may be empty, never null.
*
* @return Map from annotation name to annotations.
*/
Map<String, Annotation> getAnnotationMap();
}

// End Annotated.java
37 changes: 37 additions & 0 deletions src/main/mondrian/olap/Annotation.java
@@ -0,0 +1,37 @@
/*
// $Id$
// This software is subject to the terms of the Eclipse Public License v1.0
// Agreement, available at the following URL:
// http://www.eclipse.org/legal/epl-v10.html.
// Copyright (C) 2009-2009 Julian Hyde and others
// All Rights Reserved.
// You must accept the terms of that agreement to use this software.
*/

package mondrian.olap;

/**
* User-defined property on a metadata element.
*
* @see mondrian.olap.Annotated
*
* @version $Id$
* @author jhyde
*/
public interface Annotation {
/**
* Returns the name of this annotation. Must be unique within its element.
*
* @return Annotation name
*/
String getName();

/**
* Returns the value of this annotation. Usually a string.
*
* @return Annotation value
*/
Object getValue();
}

// End Annotation.java
13 changes: 9 additions & 4 deletions src/main/mondrian/olap/Cube.java
Expand Up @@ -13,10 +13,15 @@

package mondrian.olap;

import java.util.List;
import java.util.Set;

public interface Cube extends OlapElement {
import java.util.*;

/**
* Cube.
*
* @version $Id$
* @author jhyde
*/
public interface Cube extends OlapElement, Annotated {

String getName();

Expand Down

0 comments on commit db75e4e

Please sign in to comment.