***  This interface is subject to change.  ***

com.sas.iquery.metadata.business
Interface BusinessQuery

All Superinterfaces:
java.util.EventListener, com.sas.iquery.intelligentquery.IntelligentQueryInterface, PropertyChangeListenee, java.beans.PropertyChangeListener
All Known Subinterfaces:
DataSelection

public interface BusinessQuery
extends com.sas.iquery.intelligentquery.IntelligentQueryInterface, java.beans.PropertyChangeListener, PropertyChangeListenee

Specifies the interface that models the information that is necessary to request a result set based on business items that are contained in business models that are managed by the Intelligent Query Metadata Service. The BusinessQuery helps define and manipulate a query based on business metadata. It supports multiple views and the ability to let each view be notified when the model changes.

Relational sorting of data items

Sort Direction

To specify how a particular data item's values are to be sorted, one may specify the sort direction for the data item. The sort direction attribute for a DataItemReference is inherited from its parent (base) data item if it is not explicitly set (overridden) in the DataItemReference.

Sort Order Precedence

To specify the precedence order of the data items to be sorted on, one may specify the "sort order precedence" list of data items for a business query.

OLAP Sorting for a business query

Sorting is applied to either a data item or a business query. Sorting is applied to the data item using methods in the DataItem class.

The sort criteria is defined for a data item is based either on the value of category data item label or the value of a measure defined in the definition of that category.

The sort criteria is defined for a business query is based on the value of a measure in the crossing of a set or tuples (which would generate a MDX phrase:

 CROSSJOIN({[TIME].[YEAR].MEMBERS}, {[GEOGRAPHIC].[COUNTRY].MEMBERS}),  [Measures].[ACTUAL_AVG], DESC) ) ON ROWS.
 

This type of sort would be achieved by defining the following:


 List sortCriteria = new ArrayList();
 String[]  measures = { measure };<<== where name is [ACTUAL_AVG]
 sortCriteria.put(measures);
 businessQuery.setSortCriteria(sortCriteria,com.sas.iquery.metadata.business.Role.ROW)
 businessQuery.setSortDirection(BusinessQueryActionType.SORT_HIERARCHY_DESCENDING, com.sas.iquery.metadata.business.Role.ROW);

If sorting has been defined for both a data item and a business query, both will be honored if the BusinessQueryProperty.BUSINESS_QUERY_OLAP_SORT_PRECEDENCE property has been set to FALSE. If we applied the following:

businessQuery.setQueryProperty(BusinessQueryProperty.BUSINESS_QUERY_OLAP_SORT_PRECEDENCE, true);

then, we would generate a MDX phrase:

 generate ( ORDER([TIME].[YEAR].MEMBERS, [TIME].CURRENTMEMBER.NAME, bdesc),
 CrossJoin ( {[TIME].CURRENTMEMBER  },
 order( [GEOGRAPHIC].[COUNTRY].MEMBERS, [Measures].[ACTUAL_SUM],BDESC) ) )
 

OLAP Filtering for a business query

Business Query can be filtered by a particular value threshold in a measure, a particular value range or list in a catergory, or a particular ranking of value in a measure. This filtering is performed by applying steps to a business query. To determine out how steps can be applied to a business query for OLAP filtering and ranking, see com.sas.iquery.metadata.business.step.

OLAP Totaling

One can look at total in two different modes:

Totals can be applied on one of the two modes in one of the following defintions:

Totals can be applied as coalesced or not coalesced. Coalesced means where most crossings with non-leaf members on outer dimensions are removed. Specifically, the rule for removing crossings is: For each outer dimension on an axis, starting with the outermost dimension and working in, remove crossings with that dimension's non-leaf members. The exception is where the member for the dimension nested within the current dimension is the common ancestor of all other members in that dimension (an example of this would be the All Member). If there is no member that is the common ancestor, remove no crossings.