Topic aliases in DRQL helps you differentiate and reference multiple topics in a rule. You do not require an alias when you use a single topic. You define aliases in a WHEN statement so that you can easily reference multiple topics in other parts of the rule.
In the following example, an alias for stock is not required:
WHEN 1 stock
If a rule uses multiple topics, you must use an alias. You must specify an alias for the first topic, such as s for stock which is a stock event. Specify a second unique alias for the second topic, such as n for news which is a news event.
WHEN 1 stock s, 1 news n
If you use an alias as reference within the condition of a rule, you must also use the alias in the responder parameters as opposed to using the dotted topic name as reference. Avoid mixing the use of one reference type with the other in the same rule.
You can then use these aliases to identify the topic for which you want to evaluate a particular property. For example, in the following rule, s.symbol indicates that you want to evaluate the symbol property of the stock event. Also, n.headline indicates that you want to evaluate the headline property of the News event.
WHEN 1 stock s, 1 news n WITH s.symbol = "XYZ" OR n.headline contains "XYZ"