Presentation is loading. Please wait.

Presentation is loading. Please wait.

IBM Research: Software Technology © 2005 IBM Corporation Programming Technologies 1 Temporal Rules Vijay Saraswat IBM TJ Watson July 27, 2012.

Similar presentations


Presentation on theme: "IBM Research: Software Technology © 2005 IBM Corporation Programming Technologies 1 Temporal Rules Vijay Saraswat IBM TJ Watson July 27, 2012."— Presentation transcript:

1 IBM Research: Software Technology © 2005 IBM Corporation Programming Technologies 1 Temporal Rules Vijay Saraswat IBM TJ Watson July 27, 2012

2 META – Middleware for Events, Transactions and Analytics © 2009 IBM Corporation IBM Research 2 Central Problem Need a powerful language for event processing that permits event correlation, detects absence of events (negative information), and permits aggregative queries. Temporal (Relational) Databases: Facts are associated with valid-time and transaction-time Streaming Databases: Streams are infinite tables, with windowed operations Declarative Synchronous Programming: Combines temporality with streaming

3 META – Middleware for Events, Transactions and Analytics © 2009 IBM Corporation IBM Research 3 Timed Concurrent Constraint Programming System Environment Synchrony Hypothesis: Computation happens “instantaneously”. Synchronous Languages System lies inert. Environment supplies stimulus, at time and rate of its choosing. System computes instantaneous reaction and resumption (future behavior). Physical time is realized by driving on the beat of a physical clock (add a new time(M) fact to store at each instant). TCC Concurrent system, agents interact with each other by posting constraints on shared store. A ::= c | if c then A | A,A | new X in A | a A ::= next A | if c else A else allows detection of negative information Gentzen: Constraint system is just database of facts.

4 META – Middleware for Events, Transactions and Analytics © 2009 IBM Corporation IBM Research 4 Example Programs The agent "Every hour checkpoint state" can be formulated as: every hour do checkPointState() This relation holds if p is the price of the most recent (in the past) time instant at which there is a stock(s,_) event. (If there is more than one stock(s,_) event at that time instant, p is the lowest such price.) prevPriceOfStock(s:Stock, p:Price) :- last (some q=> stock(s,q)) do p=(min q=>stock(s,q)). priceDropped(s:Stock) :- some p:Price => some q:Price stock(s,p), prevPriceOfStock(s,q), p < q. Every tenth time the price drops within an hour emit volatility warning. priceDropTenthTime(s:Stock) -: every hour do time next^10 emitVolatilityWarning on always priceDropped(s) watching hour.

5 META – Middleware for Events, Transactions and Analytics © 2009 IBM Corporation IBM Research 5 TCC temporal constructs TCC permits a large number of temporal constructs (including pre- emption based constructs) to be defined always A = A, next always A every c do A = every time c is true, run A first c do A = at the first instant at which c is true, run A do A watching c = run A, and abort it as soon as c is true time A on B = run A on a clock defined by B... Basic Results (93-96): Language is declarative – computation in linear temporal logic Programs can be compiled to finite state automata System can be extended to continuous time (Large number of additional papers since then, on proof systems, abstract interpretation, expressiveness etc)

6 META – Middleware for Events, Transactions and Analytics © 2009 IBM Corporation IBM Research 6 Complex Event Processing: TCC with History System Environment Key Idea Do not forget the past – store records constraints at all past time instants Use TCC constructs to move back and forth in the past. G::= c | G,G | if A then G | past G |... Technical Challenges Compile complex queries about the past to incremental “forward” rules (flat TCC) Share conditions across multiple rules. Conceptually, a “Rete” over time. Past, fully formed, queried in guard Future, operated on by agents

7 META – Middleware for Events, Transactions and Analytics © 2009 IBM Corporation IBM Research 7 Business Rules Rich declarative rules in TCC very suitable for a business logic presentation. Plan: Develop a business language (working with WODM team), using BDSL framework. Business language compiled down into an intermediate representation based on TCC with Past, further compiled into FSMs where appropriate.

8 META – Middleware for Events, Transactions and Analytics © 2009 IBM Corporation IBM Research 8 Next Steps

9 IBM Research: Software Technology © 2005 IBM Corporation Programming Technologies 9 Background

10 META – Middleware for Events, Transactions and Analytics © 2009 IBM Corporation IBM Research 10 Constraint system: Examples  Gentzen  Herbrand –Lists  Finite domain  Propositional logic (SAT)  Arithmetic constraints –Naïve –Linear –Nonlinear  Interval arithmetic  Orders  Temporal Intervals Hash-tables Arrays Graphs Constraint systems are ubiquitous in computer science Type systems (checking, inference) Static analysis Symbolic computation Concurrent system analysis

11 META – Middleware for Events, Transactions and Analytics © 2009 IBM Corporation IBM Research 11 Concurrent Constraint Programming  Use constraints for communication and control between concurrent agents operating on a shared store.  Two basic operations –Tell c: Add c to the store –Ask c then A: If the store is strong enough to entail c, reduce to A. (Agents) A ::= c if (c) A A,B {x:T; A} (Config) G ::= A,…,A G,{x:T;A}  G,A (x not free in G) G, if (c) A  G,A (s(G) |- c) [[A]] = set of fixed points of a closure operator Operational semantics is complete for logical entailment of constraints. Saraswat 89; POPL 87, POPL 90, POPL 91


Download ppt "IBM Research: Software Technology © 2005 IBM Corporation Programming Technologies 1 Temporal Rules Vijay Saraswat IBM TJ Watson July 27, 2012."

Similar presentations


Ads by Google