Replacing lambda expressions in a rete network with corresponding code classes
AssigneeRed Hat, Inc.
InventorsLuca Molteni, Francesco Nigro
Life of this patent
Estimating the term…
Abstract
Lambda expressions in a Rete network class can be replaced with code classes according to some examples herein. In one particular example, a system can generate a Rete network based on a set of rules. The Rete network can include nodes corresponding to conditions defined in the set of rules. The system can generate a network class based on the Rete network, where the network class is source code that includes lambda expressions representing the conditions associated with the nodes. The system can also generate replacement classes based on the lambda expressions. The system can then generate a modified network class by replacing the lambda expressions with the replacement classes in the network class.
Claims17
A non-transitory computer-readable medium comprising program code that is executable by one or more processors for causing the one or more processors to perform operations including:
- generating a Rete network based on a set of rules, the Rete network including nodes corresponding to conditions defined in the set of rules;
- generating a network class based on the Rete network, the network class being source code that includes lambda expressions representing the conditions associated with the nodes;
- generating replacement classes based on the lambda expressions, each of the replacement classes being configured to represent one of the lambda expressions, wherein generating the replacement classes involves:
- parsing the network class to identify a lambda expression in the network class;
- extracting a parameter of the lambda expression from the network class;
- generating a field accessor based on the parameter;
- and
- generating a replacement class that includes the field accessor, the replacement class being one of the replacement classes;
- generating a modified network class by replacing the lambda expressions with the replacement classes in the network class;
- and
- compiling the modified network class into bytecode, wherein a rule engine is configured to execute the compiled bytecode to evaluate input data against the Rete network.
A method comprising:
- generating, by one or more processors, a Rete network based on a set of rules, the Rete network including nodes corresponding to conditions defined in the set of rules;
- generating, by the one or more processors, a network class based on the Rete network, the network class being source code that includes lambda expressions representing the conditions associated with the nodes;
- prior to initiating compilation of the network class, generating, by the one or more processors, replacement classes based on the lambda expressions, each of the replacement classes being source code configured to represent one of the lambda expressions, wherein generating the replacement classes involves:
- parsing the network class to identify a lambda expression in the network class;
- extracting a parameter of the lambda expression from the network class;
- and
- generating a replacement class based on the parameter, the replacement class being one of the replacement classes;
- prior to initiating compilation of the network class, modifying, by the one or more processors, the network class by replacing the lambda expressions with the replacement classes in the network class to thereby generate a modified network class;
- and
- after modifying the network class, compiling the modified network class into byte code, wherein the bytecode is executable by a rule engine to evaluate input data against the Rete Network.
A system comprising:
- one or more processors;
- and
- a memory that includes instructions executable by the one or more processors for causing the one or more processors to perform operations including:
- generating a Rete network based on a set of rules, the Rete network including nodes corresponding to conditions defined in the set of rules;
- generating a network class based on the Rete network, the network class being source code that includes lambda expressions representing the conditions associated with the nodes;
- prior to initiating compilation of the network class, generating replacement classes based on the lambda expressions, each of the replacement classes being source code configured to represent one of the lambda expressions, wherein generating the replacement classes involves:
- parsing the network class to identify a lambda expression in the network class;
- extracting a parameter of the lambda expression from the network class;
- and
- generating a replacement class based on the parameter, the replacement class being one of the replacement classes;
- prior to initiating compilation of the network class, modifying the network class by replacing the lambda expressions with the replacement classes in the network class to thereby generate a modified network class;
- after modifying the network class, compiling the modified network class into bytecode;
- and
- executing, by a rule engine, the compiled bytecode to evaluate input data against the Rete network.
Dependencies are inferred from the claim text.