<Insert Picture Here>          A General Extension System for Event Processing Languages          Alexandre Alves - Oracle...
Agenda                                                   DEBS2011        • Scenario 1              •   String manipulation...
Scenario 1:                                   DEBS2011          Programming-in-the-small        • Correlate security price...
Scenario 1:                   DEBS2011          Programming-in-the-small                                     Oracle CQL   ...
Scenario 1:                                                   DEBS2011          Programming-in-the-small        • Problem:...
Java Regular Expressions                                       DEBS2011        • Let’s look at a simple solution to the pr...
Blending CQL with Java                                      DEBS2011       CREATE VIEW filtered_news(message, matcher) AS ...
Blending CQL with Java                                     DEBS2011                                                       ...
Blending CQL with Java                                     DEBS2011                                                       ...
Architecture                                                    DEBS2011                  Pattern.compile("[.,; ][A-Z][A-Z...
Architecture                                                  DEBS2011                Pattern.compile("[.,; ][A-Z][A-Z][A-...
Architecture                                   DEBS2011                        CQL    Parser                              ...
Architecture                                                      DEBS2011                Pattern.compile("[.,; ][A-Z][A-Z...
Architecture                                                      DEBS2011                                                ...
Architecture                                                  DEBS2011                Pattern.compile("[.,; ][A-Z][A-Z][A-...
Architecture                                                   DEBS2011                Pattern.compile("[.,; ][A-Z][A-Z][A...
Architecture                                                                      DEBS2011                                ...
Extensibility                                                          DEBS2011                                  Extensibl...
Scenario 2:                                                   DEBS2011          Spatial Integration        • Targeted mark...
Blending CQL with Spatial                                   DEBS2011      CREATE VIEW CustomerLocation-Stream(point, custI...
Architecture                                         DEBS2011                                                       CQL   ...
Conclusion                                     DEBS2011        • Blending of CQL with other languages allow for the       ...
Upcoming SlideShare
Loading in …5
×

A General Extension System for Event Processing Languages

1,989 views

Published on

Presented at DEBS 2011

Published in: Technology, News & Politics
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,989
On SlideShare
0
From Embeds
0
Number of Embeds
118
Actions
Shares
0
Downloads
19
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

A General Extension System for Event Processing Languages

  1. 1. <Insert Picture Here> A General Extension System for Event Processing Languages Alexandre Alves - Oracle CEPMonday, July 11, 2011
  2. 2. Agenda DEBS2011 • Scenario 1 • String manipulation (programming-in-the-small) • Blending CQL and Java • Architecture • Scenario 2 Text • Geo-fence (extensibility) • Blending CQL and Spatial • Architecture • Q/AMonday, July 11, 2011
  3. 3. Scenario 1: DEBS2011 Programming-in-the-small • Correlate security price changes to real-time event news. TextMonday, July 11, 2011
  4. 4. Scenario 1: DEBS2011 Programming-in-the-small Oracle CQL Processor SELECT * FROM Text news [RANGE 1 HOUR], stock_tick [RANGE 1 HOUR] WHERE /* join-criteria */Monday, July 11, 2011
  5. 5. Scenario 1: DEBS2011 Programming-in-the-small • Problem: the NEWS feed is a unstructured (String), hence not trivial to identify its event properties • For example, a naive join criteria is to look for a stock’s symbol • The problem of parsing a String can be solved using Regular Expressions. Text • Regular Expressions and other programming-in-the- small tasks have long been solved by general purpose programming languages • Can we leverage this within an event processing language (e.g. CQL)?Monday, July 11, 2011
  6. 6. Java Regular Expressions DEBS2011 • Let’s look at a simple solution to the problem using Java: Matcher matcher = Text Pattern.compile("[.,; ][A-Z][A-Z][A-Z][.,; ]").matcher (message); if (matcher.find()) { Matches three letter symbol = message.substring(matcher.start() + 1, symbols, separated by leading and trailing matcher.end() - 1)); white-spaces }Monday, July 11, 2011
  7. 7. Blending CQL with Java DEBS2011 CREATE VIEW filtered_news(message, matcher) AS SELECT message, Pattern.compile("[.,; ][A-Z][A-Z][A-Z][.,; ]").matcher(message) as matcher FROM news [RANGE 1 HOUR] Text SELECT location, item_description, message FROM filtered_news, stock_tick[RANGE 1 HOUR] WHERE matcher.find() = true AND filtered_news.message.substring(matcher.start() + 1, matcher.end() - 1) = stock_tick.symbolMonday, July 11, 2011
  8. 8. Blending CQL with Java DEBS2011 CQL char conversion to Java String CREATE VIEW filtered_news(message, matcher) AS SELECT message, Pattern.compile("[.,; ][A-Z][A-Z][A-Z][.,; ]").matcher(message) as matcher FROM news [RANGE 1 HOUR] Text SELECT location, item_description, message Method invocation FROM filtered_news, stock_tick[RANGE 1 HOUR] WHERE matcher.find() = true AND Static method filtered_news.message.substring(matcher.start() + 1, invocation matcher.end() - 1) = stock_tick.symbolMonday, July 11, 2011
  9. 9. Blending CQL with Java DEBS2011 ‘matcher’ is a Java Object, and treated as CREATE VIEW filtered_news(message, matcher) AS a complex type by SELECT CQL message, Pattern.compile("[.,; ][A-Z][A-Z][A-Z][.,; ]").matcher(message) as matcher FROM news [RANGE 1 HOUR] Text SELECT Overload of CQL ‘+’ location, item_description, message operator to handle FROM filtered_news, stock_tick[RANGE 1 HOUR] Java Integer WHERE matcher.find() = true AND Overload of CQL filtered_news.message.substring(matcher.start() + 1, equality to handle matcher.end() - 1) = stock_tick.symbol Java StringMonday, July 11, 2011
  10. 10. Architecture DEBS2011 Pattern.compile("[.,; ][A-Z][A-Z][A-Z][.,; ]").matcher Pattern.compile("[.,; ][A-Z][A-Z][A-Z][.,; ]").matcher(message) (message) • Is this symbol: • Text A stream attribute (e.g. message)? • A stream alias (e.g. FROM S1 as A) • A CQL function (e.g. SELECT myfunc()) • The l-value of complex type (e.g. myObj.myMethod()) • A constructor • A (static) method • A class nameMonday, July 11, 2011
  11. 11. Architecture DEBS2011 Pattern.compile("[.,; ][A-Z][A-Z][A-Z][.,; ]").matcher Pattern.compile("[.,; ][A-Z][A-Z][A-Z][.,; ]").matcher(message) (message) • To be able to semantically compile symbols, we need to have type information.Text • However, CQL is not aware of Java, nor should it be. • There is a need of a generic type-system, and an extension model for providers to plug-in their own languagesMonday, July 11, 2011
  12. 12. Architecture DEBS2011 CQL Parser Semantic Type Analyzer Registry Text Code Generator Java Type-System Code ExecutorMonday, July 11, 2011
  13. 13. Architecture DEBS2011 Pattern.compile("[.,; ][A-Z][A-Z][A-Z][.,; ]").matcher Pattern.compile("[.,; ][A-Z][A-Z][A-Z][.,; ]").matcher(message) (message) ComplexType “Pattern” Text Type fields Registry methods Java Type-SystemMonday, July 11, 2011
  14. 14. Architecture DEBS2011 ComplexType fields “Pattern” Type Registry methods Text Java Type-System CQL deals with a ‘complex type’ abstraction, and does not know of its ‘Java Language’ binding.Monday, July 11, 2011
  15. 15. Architecture DEBS2011 Pattern.compile("[.,; ][A-Z][A-Z][A-Z][.,; ]").matcher Pattern.compile("[.,; ][A-Z][A-Z][A-Z][.,; ]").matcher(message) (message) Pattern ComplexType fields Text Find a “compile” method and its return type methodsMonday, July 11, 2011
  16. 16. Architecture DEBS2011 Pattern.compile("[.,; ][A-Z][A-Z][A-Z][.,; ]").matcher(message) Pattern Matcher ComplexType ComplexType Text fields fields Store ‘matcher’ as methods methods a stream/view attributeMonday, July 11, 2011
  17. 17. Architecture DEBS2011 Extensible Language stream 1 * attribute Type <<is-of>> ‘matcher’ is an attribute of the view of type ‘java.util.regex.Matcher’ ComplexType Text <<metadata binding>> Extension Java Language CREATE VIEW filtered_news(message, matcher) Java ClassMonday, July 11, 2011
  18. 18. Extensibility DEBS2011 Extensible Language stream 1 * attribute Type <<is-of>> ComplexType Text <<metadata binding>> How do we know which Extension Java Language ‘language extension’ to use? How to provide new Java Class extensions?Monday, July 11, 2011
  19. 19. Scenario 2: DEBS2011 Spatial Integration • Targeted marketing for a mobile subscriber • CEP application checks if the location of the subscriber is within the distance of a registered shop Text Text Oracle Spatial Shop id: CHAR geometry: SDO_GEOMETRYMonday, July 11, 2011
  20. 20. Blending CQL with Spatial DEBS2011 CREATE VIEW CustomerLocation-Stream(point, custId) AS SELECT createPoint@spatial(lng, lat) as point, custId FROM Location-Stream point is a spatial type SELECT loc.custId, shop.id Text FROM CustomerLocation-Stream[NOW] AS loc, Shop as shop WHERE contain@spatial(shop.geometry, loc.point, 2.0d) ‘spatial’ link points to Oracle Spatial ‘extension’, where ‘contain’ function residesMonday, July 11, 2011
  21. 21. Architecture DEBS2011 CQL CQL link specifies language extension, which are plugged into the system as a CQL cartridge Text <<link>> CQL Cartridge Cartridge contain@spatial(shop.geometry, loc.point, 2.0d)Monday, July 11, 2011
  22. 22. Conclusion DEBS2011 • Blending of CQL with other languages allow for the creation of feature-rich CEP applications while still being highly descriptive • Example: • String manipulation using Java Text • Geo-fencing using Oracle Spatial • Generic frameworks allows for the dynamic plugin of extensions (cartridges)Monday, July 11, 2011

×