ReteEngine 1.0
A rules engine and builder
Loading...
Searching...
No Matches
ReteProgram.JoinKeyExtractor Class Reference

This class is responsible for analyzing a join expression provided by the user and extracting the key selector functions for both sides of the join. The Extract method takes a lambda expression representing the join condition (e.g., (token, fact) => token.Property == fact.Property) and processes it to identify which part of the expression corresponds to the Token and which part corresponds to the Fact. It then compiles these parts into Func delegates that can be used to extract the join keys at runtime when processing tokens and facts in the Rete network. This allows for efficient indexing and matching of facts based on the specified join condition. More...

Public Member Functions

Func< Token, object > Func< object, object > RightKey Extract (Expression< Func< Token, object, bool > > joinExpr)

Public Attributes

Func< Token, object > LeftKey
 Extracts the key selector functions from the provided join expression. The join expression must be a binary expression that compares a property of the Token (first parameter) with a property of the Fact (second parameter) using the equality operator (==). The method identifies which side of the expression corresponds to the Token and which side corresponds to the Fact, and then compiles each side into a Func delegate that can be used to extract the join key at runtime. The resulting tuple contains two functions: one for extracting the key from the Token and one for extracting the key from the Fact. These functions can be used to efficiently index and match facts in the Rete network based on the specified join condition. If the expression does not meet the expected format (e.g., it is not an equality comparison or does not involve both a Token and a Fact), the method throws an exception to indicate that the join expression is not supported or is invalid.

Detailed Description

This class is responsible for analyzing a join expression provided by the user and extracting the key selector functions for both sides of the join. The Extract method takes a lambda expression representing the join condition (e.g., (token, fact) => token.Property == fact.Property) and processes it to identify which part of the expression corresponds to the Token and which part corresponds to the Fact. It then compiles these parts into Func delegates that can be used to extract the join keys at runtime when processing tokens and facts in the Rete network. This allows for efficient indexing and matching of facts based on the specified join condition.

Member Data Documentation

◆ LeftKey

Func<Token, object> ReteProgram.JoinKeyExtractor.LeftKey

Extracts the key selector functions from the provided join expression. The join expression must be a binary expression that compares a property of the Token (first parameter) with a property of the Fact (second parameter) using the equality operator (==). The method identifies which side of the expression corresponds to the Token and which side corresponds to the Fact, and then compiles each side into a Func delegate that can be used to extract the join key at runtime. The resulting tuple contains two functions: one for extracting the key from the Token and one for extracting the key from the Fact. These functions can be used to efficiently index and match facts in the Rete network based on the specified join condition. If the expression does not meet the expected format (e.g., it is not an equality comparison or does not involve both a Token and a Fact), the method throws an exception to indicate that the join expression is not supported or is invalid.

Parameters
joinExprThe expression to extract the keys from.
Returns
The tuple of the left and right keys extracted from the given expression.
Exceptions
NotSupportedExceptionThrown when the expression is not well-formed for extraction
ExceptionThrown when the parameters are not well-formed.

The documentation for this class was generated from the following file:
  • ReteProgram/JoinKeyExtractor.cs