Using TopCoder
STATUS KEY :
Specification
Design and Architecture
Development and Testing
Complete
-
Overview
The Rule Engine is the complete set of code necessary to run the TopCoder Rules Engine.
-
Functionality
A rule engine is a system that supports declarative programming through a system of rules and facts. The facts represent the state of the system. The rules are if-then statements about the facts in the system. Rules may cause new facts to be asserted or existing facts retracted when the current set of facts satisfies some criteria. Rules may also cause observable Java events to occur. The rule engine uses the Rete algorithm to quickly process the changes caused by changes to the set of facts, sacrificing storage space for execution speed.
The TCS rule engine consists of multiple components. This component is responsible for compiling the Rete network from a set of rules created by the Rule Engine Persistence component. This component will return the root node of the compiled network.
A rule engine could be useful in implementing an e-commerce site that offers a variety of discounts based on the size of an order, preferred shopper status, and seasonal offers. In such a system, the business logic for determining exactly what the correct discount should be can be complex, and can change from day to day with special promotions. Implementing this logic in Java would be a recurring, error-prone chore. Instead, this logic can be formulated as a set of rules in a rule engine, making it manageable and comprehensible, yet still scriptable. -
Technologies
Availability
Version 1.0
Adobe Acrobat is required to view TopCoder Software specification documentation.
-
Class Diagram
Interface Diagram
Compiler Interface
Compiler Internal
Persistence Rule Persistence
Evaluator Application Interface
Persistence Fact Persistence
Persistence Main
Compiler Main
Evaluator Rete Nodes
-
Component Specification
CS - Rule Engine Walkthrough
CS - Evaluator
CS - Persistence
CS - Compiler
-
Javadocs
Javadocs
-
Requirements Specification
RS - Compiler
RS - Persistence
RS - Evaluator
-
Sequence Diagram
Compiler Compile Rules
Persistence Load Facts From Flat File
Evaluator Create Predicate Node
Persistence Store Rules In Database
Evaluator Create Terminal Node
Persistence Store Facts In Database
Evaluator Retract Facts
Persistence Store Rules In Flat File
Compiler Transform Network When Root Node Is Not Terminal
Evaluator Assert Facts
Evaluator Create Equals Node
Compiler Add Pattern Predicate To Network
Persistence Store Facts In Flat File
Persistence Obtain Connection From DB Connection Factory
Evaluator Validate Subnetwork ForkNode
Evaluator Validate Subnetwork MergeSubnode
Compiler Transform Network When Root Node Is Terminal
Evaluator Create Fork Node
Persistence Retract Facts
Compiler Add Expression Predicate To Network
Persistence Load Facts From Database
Persistence Assert Facts
Evaluator Create Merge Node
Persistence Load Rules From Flat File
Compiler Add Merge Nodes For Given Conditions
Persistence Load Rules From Database
Persistence Compile Rete Network
Evaluator Validate Network
Evaluator Execute Actions
-
Use Case Diagram
Compiler
Evaluator
Persistence
