Forum OpenACS Q&A: Response to Building a marketplace: NYSE, NASDAQ, CBOT

Posted by Jerry Asher on
Google for rete algorithm forgy ops5.

simple descriptions that aren't terribly helpful

When I was working with production systems, and hooking them into legacy systems and RDBM systems in realtime what struck me was the following.

Consider that you have an application with tons and tons of data. It may have a relatively simple data model. What is not so simple is the business logic, which if you could, could be modeled as many many many triggers. If A and B then update C. If C and not D then delete E.

Well that's a production system, but implemented in an RDBMS, and it's a damn shame the two communities could never speak to one another. Basically these productions systems have all the power of SQL and the SQL is embedded into rules. Another word for a rule would be a trigger. So a rete net has three components: a huge collection of data, a huge collection of IF->THEN rules, and an agenda. The agenda keeps a list of rules that have completely satisfied their IF clause and are ready to fire their THEN clause.

What a rete net does is take those hundreds and thousands of triggers and it precompiles, optimizes, and joins all the queries. So you have this huge network of condition nodes, A, ~A, B, C<2, D>Z, that appear in various rules. Whenever a new piece of data (object, record) enters the system, it trickles through this network. Sometimes that piece of data will find that it completes the match of one of these precomputed queries. When that happens, the "then" portion of that rule is added to the agenda. (There may be various ways to prioritize that agenda, depending perhaps on how complex the rule was, or how salient the system or developer thought the rule was.)

I believe a terrific application for it, might be in building a trading system with many, many different sorts of programmed trades. Trades that could apply depending on various arbitrage, option, or other sorts of conditions.

The problem with these systems is that they have always positioned themselves as better/different from an RDBMS, which is silly since folks that can buy Oracle can buy anything, and since all of these systems have to get their data from somewhere, and store their data back.

I have always wanted to see a data blade/plug in version of one of these things into a popular db: Oracle, DB/2, or PG. Anyway, it's cool stuff, and has usually turned into a way to poor your VC money down the hole slowly.