filter_expression
in the DDSContentFilteredTopic query_expression
in the DDSQueryCondition topic_expression
in the DDSMultiTopicThe following notational conventions are made:
'Terminals'
are quoted and typeset in a fixed width font. They are written in upper case in most cases in the BNF-grammar below, but should be case insensitive.
Expression ::= FilterExpression
| TopicExpression
| QueryExpression
.
FilterExpression ::= Condition
TopicExpression ::= SelectFrom { Where } ';'
QueryExpression ::= { Condition }{ 'ORDER BY'
(FIELDNAME // ',') }
.
SelectFrom ::='SELECT'
Aggregation'FROM'
Selection . Aggregation ::='*'
| (SubjectFieldSpec // ',') . SubjectFieldSpec ::= FIELDNAME | FIELDNAME'AS'
IDENTIFIER | FIELDNAME IDENTIFIER . Selection ::= TOPICNAME | TOPICNAME NaturalJoin JoinItem . JoinItem ::= TOPICNAME | TOPICNAME NaturalJoin JoinItem |'('
TOPICNAME NaturalJoin JoinItem')'
. NaturalJoin ::='INNER JOIN'
|'INNER NATURAL JOIN'
|'NATURAL JOIN'
|'NATURAL INNER JOIN'
. Where ::='WHERE'
Condition . Condition ::= Predicate | Condition'AND'
Condition | Condition'OR'
Condition |'NOT'
Condition |'('
Condition')'
. Predicate ::= ComparisonPredicate | BetweenPredicate . ComparisonPredicate ::= ComparisonTerm RelOp ComparisonTerm . ComparisonTerm ::= FieldIdentifier | Parameter . BetweenPredicate ::= FieldIdentifier'BETWEEN'
Range | FieldIdentifier'NOT BETWEEN'
Range . FieldIdentifier ::= FIELDNAME | IDENTIFIER . RelOp ::='='
|'>'
|'>='
|'<'
|'<='
|'<>'
|'LIKE'
|'MATCH'
. Range ::= Parameter'AND'
Parameter . Parameter ::= INTEGERVALUE | CHARVALUE | FLOATVALUE | STRING | ENUMERATEDVALUE | BOOLEANVALUE | PARAMETER .
Note -- INNER JOIN, INNER NATURAL JOIN, NATURAL JOIN, and NATURAL INNER JOIN are all aliases, in the sense that they have the same semantics. They are all supported because they all are part of the SQL standard.
IDENTIFIER: LETTER (PART_LETTER)* where LETTER: [ "A"-"Z","_","a"-"z" ] PART_LETTER: [ "A"-"Z","_","a"-"z","0"-"9" ]
FIELDNAME: FieldNamePart ( "." FieldNamePart )* where FieldNamePart : IDENTIFIER ( "[" Index "]" )* Index> : (["0"-"9"])+ | ["0x","0X"](["0"-"9", "A"-"F", "a"-"f"])+
Primitive IDL types referenced by FIELDNAME are treated as different types in Predicate according to the following table:
Predicate Data Type | IDL Type |
BOOLEANVALUE | boolean |
INTEGERVALUE | octet, (unsigned) short, (unsigned) long, (unsigned) long long |
FLOATVALUE | float, double |
CHARVALUE | char, wchar |
STRING | string, wstring |
ENUMERATEDVALUE | enum |
TOPICNAME : IDENTIFIER
INTEGERVALUE : (["+","-"])? (["0"-"9"])+ [("L","l")]? | (["+","-"])? ["0x","0X"](["0"-"9", "A"-"F", "a"-"f"])+ [("L","l")]?
CHARVALUE : "'" (~["'"])? "'"
FLOATVALUE : (["+","-"])? (["0"-"9"])* (".")? (["0"-"9"])+ (EXPONENT)? where EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+
STRING : "'" (~["'"])* "'"
ENUMERATEDVALUE : "'" ["A" - "Z", "a" - "z"] ["A" - "Z", "a" - "z", "_", "0" - "9"]* "'"
BOOLEANVALUE : ["TRUE","FALSE"]
PARAMETER : "%" (["0"-"9"])+
BOOLEANVALUE | INTEGERVALUE | FLOATVALUE | CHARVALUE | STRING | ENUMERATEDVALUE | |
BOOLEAN | YES | |||||
INTEGERVALUE | YES | YES | ||||
FLOATVALUE | YES | YES | ||||
CHARVALUE | YES | YES | YES | |||
STRING | YES | YES(*1) | YES | |||
ENUMERATEDVALUE | YES | YES(*2) | YES(*2) | YES(*3) |
MATCH is case-sensitive.
The pattern allows limited "wild card" matching under the following rules:
Character | Meaning |
, | "," separates a list of alternate patterns. The field string is matched if it matches one or more of the patterns. |
/ | "/" in the pattern string matches a / in the field string. This character is used to separate a sequence of mandatory substrings. |
? | "?" in the pattern string matches any single non-special characters in the field string. |
* | "*" in the pattern string matches 0 or more non-special characters in field string. |
[charlist] | Matches any one of the characters from the list of characters in charlist. |
[s-e] | Matches any character any character from s to e, inclusive. |
% | "%" is used to designate filter expressions parameters. |
[!charlist] or [^charlist] | Matches any characters not in charlist (not supported). |
[!s-e] or [^s-e] | Matches any characters not in the interval [s-e] (not supported). |
\ | Escape character for special characters (not supported) |
The syntax is similar to the POSIX fnmatch syntax (1003.2-1992 section B.6). The MATCH syntax is also similar to the 'subject' strings of TIBCO Rendezvous.
Example of a filter_expression (for DDSContentFilteredTopic) or a query_expression (for DDSQueryCondition):
"z < 1000 AND x < 23"
"symbol MATCH 'NASDAQ/GOOG'"
"symbol MATCH 'NASDAQ/[A-M]*'"
"SELECT flight_id, x, y, z AS height FROM 'Location' NATURAL JOIN 'FlightPlan' WHERE height < 1000 AND x <23"