Package com.sap.ip.bi.sdk.dac.relational.query

The main package of the Relational Query API, which provides classes to create and execute relational queries independently of the underlying resource adapter (one of the BI Java Connectors).

See:
          Description

Interface Summary
IBICommandProcessor The Relational Command Processor allows for the manipulation of a query object on a high level without exposing the underlying model.
IBIQuery A relational query model based on the Expressions package of the Common Warehouse Metamodel.
IBIQueryExecute Minimal callback between query model and connection to underlying BI Java Connector (resource adapter).
IBIQueryExpression Simple wrapper to provide access to the elements of the query.
IBIQueryExpressionColumnRef A column reference is a column with optional table reference (see table reference), necessary in case of self-joins (for example), to determine the instance of the table in the query to which this column belongs.
IBIQueryExpressionGroupByRef Grouping is necessary for all columns of the selection that are not aggregated, and the order of grouping is specified as a list of column references.
IBIQueryExpressionOrderByRef Ordering of the result set of a query can be specified by column and order direction.
IBIQueryExpressionSelectColumnRef A selection column reference is a column reference with optional aggregation function (COUNT, SUM, MIN, MAX, AVG) and label (for example, in SQL COUNT(<column>) AS <label>).
IBIQueryExpressionTableRef Table references are needed because relational queries can contain multiple instances of the same table (for example, with self-joins) and each instance needs to be individually (and uniquely) referenceable.
IBIQueryRepository Interface between the query model and the Metamodel Repository.
 

Package com.sap.ip.bi.sdk.dac.relational.query Description

The main package of the Relational Query API, which provides classes to create and execute relational queries independently of the underlying resource adapter (one of the BI Java Connectors). This package documentation contains the following sections:

Overview

The Relational Query API consists of a set of classes generated via JMI from the Relational Query Model, which is based on the org.omg.cwm.foundation.expressions package of the Common Warehouse Metamodel (CWM), and loosely on a subset of the SQL standard.

A relational query in this sense is an expression tree of a functional representation of the corresponding SQL-like statement. This allows for simple code generation from the expression tree for the various relational backends (resource adapters, or BI Java Connectors), such as SQL for the BI JDBC Connector and an RFC call via JCo for the BI SAP Query Connector.

Packages of the Relational Query API

This package contains the main classes of the Relational Query API including the Relational Command Processor, and also collects the following supporting sub-packages:

Component Associated SDK Package
Relational Command Processor
SDK extensions to the CWM Expressions package
this package

Interfaces relevant for SAP Query

com.sap.ip.bi.sdk.dac.relational.query.sapq
Interfaces that help represent a WHERE condition in tree form com.sap.ip.bi.sdk.dac.relational.query.tree

Relational Command Processor

The Relational Command Processor hides the complexity of the CWM Expressions package, which forms the basis of the Relational Query Model and assists in instantiating valid query instances. You can rely on the Relational Command Processor for most of your relational querying needs.

Relational Query Model

The Relational Query Model corresponds with the following subset of SQL (specified as a grammar in Backus-Naur Form):

<single-row-select><select-clause> <from-clause> [<where-clause>] [<group-by-clause>] [<order-by-clause>] [<having-clause>]
<select-clause>SELECT [<select-item>,*]<select-item>
<select-item><single-column> | <all-columns>
<single-column><scalar-expr> AS <column>
<all-columns>[<range-var>.]*
<scalar-expr><column-ref> | <aggr-func-ref> |<quoted-value> | <numeric-value>
<aggr-func-ref><count-aggr-func-ref> | <min-aggr-func-ref> | <max-aggr-func-ref> | <avg-aggr-func-ref>
<count-aggr-func-ref>COUNT(<column-ref>)
<min-aggr-func-ref>MIN(<column-ref>)
<max-aggr-func-ref>MAX(<column-ref>)
<avg-aggr-func-ref>AVG(<column-ref>)
<column-ref>[<column-quantifier>.]<column>
<where-clause>WHERE <cond-expr>
<group-by-clause>GROUP BY [<column-ref>,*]<column-ref>
<order-by-clause>ORDER BY [<order-item>,*]<order-item>
<order-item><column>[ <order-dir>]
<order-dir>ASCENDING | DESCENDING
<having-clause>HAVING <cond-expr>
<from-clause>FROM [<table-ref>,*]<table-ref>
<table-ref><table>[ <range-var>]
<catalog><catalog>
<schema>[<catalog>.]<schema>
<table>[<schema>.]<table>
<range-var><rangevar>
<column-quantifier><table>|<range-var>
<column><column>
<cond-expr>[<cond-term> OR ]<cond-term>
<cond-term>[<cond-term> AND ]<cond-factor>
<cond-factor>[NOT ]<cond-test>
<cond-test><cond-primary>[ IS NULL]
<cond-primary><simple-cond> | ( <cond-expr> )
<simple-cond><comparison-cond> | <between-cond> | <like-cond> | <in-cond> | <test-for-null-cond>
<comparison-cond><row-constructor> <comparison-operator> <row-constructor>
<comparison-operator><equals-operator> | <less-than-operator> | <greater-than-operator> | <less-equals-operator> | <greater-equals-operator>
<equals-operator>=
<less-than-operator><
<greater-than-operator>>
<less-equals-operator><=
<greater-equals-operator>>=
<between-cond><row-constructor> BETWEEN <row-constructor> AND <row-constructor>
<like-cond><row-constructor> LIKE <row-constructor>
<escape>ESCAPE <escape>
<in-cond><in-cond-list> | <in-cond-sub-select>
<in-cond-list><row-constructor> IN ([<row-constructor>,*]<row-constructor>)
<in-cond-sub-select><row-constructor> IN <single-row-select>
<test-for-null-cond><row-constructor> IS NULL
<row-constructor><scalar-expr>
<quoted-value><quoted>
<numeric-value><numeric>

Notes:

  1. Non-terminals are in italics, for example: <non-terminal-symbol> .
  2. Terminals are in bold, for example: <terminal-symbol>.
  3. Keywords are in bold, for example: KEYWORD.
  4. "|" separates alternative grammar productions.
  5. "[]" encloses optional grammar productions.
  6. "*" specifies that the preceding grammar production can occur an arbitrary number of times.
  7. The terminal symbols have the following meaning:

    Terminal Symbol Corresponding Java Type
    <catalog> String (valid catalog name, if supported)
    <schema> String (valid schema name, if supported)
    <table> String (valid table name)
    <rangevar> String (valid range-var string)
    <column> String (valid column name)
    <escape> char
    <quoted> String surrounded by single quotes
    <numeric> int,double


  8. The semantics of a query instance correspond with their SQL counterpart.
  9. While WHERE conditions are tree-like expressions (Backus-Naur Form, referenced above, implies binary logical operators and enclosing parentheses), the Relational Command Processor implies a sequential model of query generation and manipulation, hence the WHERE condition is formulated using a logically equivalent postfix representation (a stack-based approach). In other words, the predicates are pushed onto an implied WHERE stack followed by the logical operators (see the Relational Command Processor).

For Additional Information

Since:
3.50


Copyright © 2004-2006 by SAP AG. All Rights Reserved.
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.
These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies (SAP Group) for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.