Open Exchange
Global Masters
Home > Class Reference > %SYS namespace > %DeepSee.Query.Parser
Private  Storage   


class %DeepSee.Query.Parser extends

Contains the DeepSee MDX query parser and related APIs.
This class contains no publicly accessible code.


Parameters Properties Methods Queries Indices ForeignKeys Triggers
9 38


%Stack Bookmark CubeName InSearch LastToken
Position Query Text Trace

%%OIDGet %AddToSaveSet %AtEnd %BindExport
%BuildEscapedSpec %BuildObjectGraph %ClassIsLatestVersion %ClassName
%Close %ConstructClone %DispatchClassMethod %DispatchGetModified
%DispatchGetProperty %DispatchMethod %DispatchSetModified %DispatchSetMultidimProperty
%DispatchSetProperty %Error %Extends %GetParameter
%GotoBookmark %IncrementCount %IsA %IsArrowToken
%IsModified %IsOperatorChar %IsOperatorToken %IsQuotedIdent
%IsSpecialChar %IsUnaryOperatorToken %New %NextToken
%NormalizeObject %ObjectModified %OriginalNamespace %PackageName
%ParseAXIS %ParseFILTER %ParseFROM %ParseMDX
%ParseMDXExpression %ParseMEMBER %ParseMemberSpec %ParseRETURN
%ParseSELECT %ParseStatement %ParseWHERE %ParseWITH
%PopContext %ProcessMemberNode %PushContext %QuoteIdent
%QuoteTrustedIdent %RemoveFromSaveSet %RemoveParens %SerializeObject
%SetBookmark %SetModified %TestPrecedence %Tokenize
%Trace %TraceMsg %UnquoteIdent %ValidateNamedParm
%ValidateObject %ValidateText


• property %Stack as %Integer [ MultiDimensional ];
Context stack.
• property Bookmark as %Integer;
Current bookmark position within query text.
• property CubeName as %DeepSee.Datatype.entityName;
Cubename within the current query.
• property InSearch as %Boolean [ InitialExpression = 0 ];
Indicates the current tokens are within the %SEARCH context
• property LastToken as %String;
Most recently parsed token (used for error reporting).
• property Position as %Integer;
Current position within query text.
• property Query as %DeepSee.Query.query;
The query object this parser is constructing.
• property Text as %String;
Query text.
• property Trace as %Boolean [ InitialExpression = 0 ];
Debug flag.


• method %AtEnd() as %Boolean
Test if we are the end of the statement.
• classmethod %BuildEscapedSpec(pIdentifierList As %List, Output pStatus As %Status) as %String
Return a spec with escaped identifiers, translating each "]" into a "]]" to escape the closing quote. The argument pIdentifierList may be a list of any length. The method will terminate construction upon encountering the first null entry in the list.
This is not intended to add a "&[]"-enclosed key to the base spec
• method %Error(pMsg As %String, pToken As %String = "") as %Status
Construct a parser error message.
• method %GotoBookmark()
Revert to last set bookmark.
• classmethod %IsArrowToken(token As %String) as %Boolean
Test if token is a special token
• classmethod %IsOperatorChar(char As %String) as %Boolean
Test if char is a part of an operator name
• classmethod %IsOperatorToken(token As %String) as %Boolean
Test if token is an operator name.
• classmethod %IsQuotedIdent(pIdent As %String) as %Boolean
Test whether pIdent is a quoted identifier.
• classmethod %IsSpecialChar(char As %String) as %Boolean
Test if char is a special character
• classmethod %IsUnaryOperatorToken(token As %String) as %Boolean
Test if token is a unary operator name.
• method %NextToken(Output pType As %String, Output tSC As %Status) as %String
Return next token within the query text and its type. Type can be NUM[ber], LIT[eral], STR[ing], QSTR, OP[erator], SPEC[ial], END. If there are comments, they are removed.
• private method %OnNew(text As %RawString) as %Status
This callback method is invoked by the %New method to provide notification that a new instance of an object is being created.

If this method returns an error then the object will not be created.

It is passed the arguments provided in the %New call. When customizing this method, override the arguments with whatever variables and types you expect to receive from %New(). For example, if you're going to call %New, passing 2 arguments, %OnNew's signature could be:

Method %OnNew(dob as %Date = "", name as %Name = "") as %Status

• method %ParseAXIS(Output pAxisNum As %String, Output pAxis As %DeepSee.Query.axis, pMode As %Integer = 0) as %Status
Parse an MDX Axis Specification statement.
pMode specifies context: 0 = axis, 1 = slicer, 2 = %filter, (3 = named set).
• method %ParseFILTER() as %Status
Parse an MDX %FILTER statement. %FILTER is an ISC extension.
• method %ParseFROM() as %Status
Parse an MDX FROM statement.
• classmethod %ParseMDX(pText As %String, pQuery As %DeepSee.Query.query = "", pTrace As %Boolean = 0) as %Status
Simple MDX parser. Convert the MDX query in pText into a set of DeepSee query objects (applied to pQuery).
If pQuery is not supplied, a new query object is created and returned.
• classmethod %ParseMDXExpression(pText As %String, pQuery As %DeepSee.Query.query, pGroup As %DeepSee.Query.group, Output pNode As %DeepSee.Query.node, pCube As %String = "") as %Status
Simple MDX expression parser. Convert the MDX expression in pExpression into a set of DeepSee query objects (applied to pGroup).
pQuery is the outer query context which is calling this. pCube is an optional cube to query, otherwise the one in the query context is used.
• method %ParseMEMBER(pParent As %DeepSee.Query.group, Output pNode As %DeepSee.Query.node, pCloseToken As %String, pMode As %Integer, ByRef pFlags As %String, pLevel As %Integer = 1) as %Status
Parse a member expression within an MDX axis.
This can be a simple member specifier: "[Measures].[Sales]"
A range: "[Time].[2005]:[Time].[2008]"
or an expression: "[Measures].[Sales]>100*[Measures].[X]"
The member expression can contain a function: "FILTER(A.B,C.D)"
or a set: "{A.A,B.B}"
or a range: "{A.A:A.B}"
or a tuple: "(A.A,B.B)"
or some combination of these.
On return, pNode is the newly created query object along with whatever children it needs..
pCloseToken is the token expected to end the tuple (such as ")" for a function).
pMode specifies context: 0 = axis, 1 = slicer, 2 = %filter, 3 = named set.
n.b., mode 2 is not used! If pFlags is present, it contains the set of valid function flags (we are parsing a function call in this case)...
• classmethod %ParseMemberSpec(pText As %String, Output pInfo, Output pQuoted, Output pMemberKey) as %Status
Take a string containing a member specification, "[Member1].[Member2]", and return an array of the member names indexed by ordinal position as well as an array of whether a term was quoted or not.
pMemberKey is array indicating if a member key (&[]) is specified for an item.
This is used later in query processing.
• method %ParseRETURN() as %Status
Parse an MDX RETURN statement (used by DRILLTHROUGH statements). A RETURN statement is basically the SELECT list used against the source table to return rows.
• method %ParseSELECT() as %Status
Parse an MDX SELECT statement.
• method %ParseStatement(pQuery As %DeepSee.Query.query) as %Status
Parse an MDX statement.
Apply the results to pQuery.
• method %ParseWHERE() as %Status
Parse an MDX WHERE statement.
• method %ParseWITH(pMode As %String = "with") as %Status
Parse an MDX WITH statement. If pMode is "with", then this is a WITH clause of a query; If pMode is "set" or "member", then this is a CREATE statement;
• method %PopContext()
Pop the current parsing state restore the prior state.
• method %ProcessMemberNode(pNodeNo As %Integer, ByRef pTree, ByRef pObjList, Output pObj As %DeepSee.Query.node) as %Status
Used by parseMEMBER to convert expression trees into query objects.
pNodeNo is the top node number in the tree.
pTree is the expression tree.
pObjList an array of objects referenced by the tree.
pObj is the newly created object.
• method %PushContext(pText As %String)
Push the current parsing state and use pText as a token source.
• classmethod %QuoteIdent(pIdent As %String) as %String
Return a quoted version of the given identifier. Ignore special "&" character as well as @namedParms Do not add quotes if pIdent is already bounded by a [] pair
• classmethod %QuoteTrustedIdent(pIdent As %String) as %String
Return a quoted version of the given identifier. Do not check to see if the identifier is already quoted Ignore special "&" character as well as @namedParms
• method %RemoveParens(pNodeNo As %Integer, ByRef pTree, pEmpty As %Boolean) as %Status
Remove unneeded parens from tree. pEmpty is set true (1) if the node has only parens and can be removed.
• method %SetBookmark()
Bookmark the current parsing position.
This allows us to push a token back onto the incoming stream.
• classmethod %TestPrecedence(op1 As %String, op2 As %String) as %Boolean
Returns true if op1 has precedence over op2.
• classmethod %Tokenize(pText As %String, Output pTokens As %List) as %Status
Take the text in pText and convert it to a list of tokens using MDX grammar: pTokens(n) = $LB(type,value)
• method %Trace(pText As %String, pIndent As %Integer = 0) as %Boolean
Print a trace message if trace is enabled.
• method %TraceMsg(pText As %String, pIndent As %Integer = 0) as %Boolean
Print out trace message (do not call directly).
• classmethod %UnquoteIdent(pIdent As %String) as %String
Return the string portion of a quoted identifier.
• method %ValidateNamedParm(pParmName As %String) as %Status
Syntactically validate the given named parameter.
• method %ValidateText(pQuery As %DeepSee.Query.query = $$$NULLOREF, pText="") as %Status
Perform initial checks on the MDX text itself to see if there are obvious errors that can be reported without further processing.