We are very excited to announce version 4.0 of FlexRule is released today.

FlexRuleRuntimeV40

There are big changes in version 4.0 and some of different modules of framework are now officially obsolete.

RETE inference engine revamped

The big change in version 4.0 is all about our new implementation of RETE engine which is much more intuitive. In this new version we still keep supporting all functionality we had but the API model is revamped. The API model not provides a concise way of modeling production rules:

class OlrderAndYoungerProductionRule : ProductionBuildernot 
{

    public override void Compose()
    {
        Person older = null, younger = null;

        When("older and younger")
            .Match(() => older, e => e.Sex == Gender.Female)
            .Match(() => younger, p => p.Age < older.Age, o => o.Sex == Gender.Male);

        Then()
        .Perform(ctx =>
            Console.WriteLine("{0} ({1}) is older than {2} ({3})",
                            older.Name,
                            older.Age,
                            younger.Name,
                            younger.Age)
        );
    }
}

And the high-level language to define production rules is now more comprehensive and extensible:

<inference>
    <reference assembly="FlexRule.Samples.PersonAge.exe"/>
  
    <import type="FlexRule.Samples.Person" />
    <import type="FlexRule.Samples.Gender" />
    <import type="System.Console" />

    
    <defrule name="older and younger">
        <match type="Person" variable="older">
          <e>e.Sex == Gender.Female</e>
        </match>
        <match type="Person" variable="younger">
          <p>p.Age < older.Age</p>
          <o>o.Sex == Gender.Male</o>
        </match>
        <then/>
        <action context="ctx" name="Print result">
          <execute>Console.WriteLine("{0} ({1}) is older than {2} ({3})", older.Name, older.Age, younger.Name, younger.Age)</execute>
        </action>
    </defrule>
</inference>

If you do not like the nosiness of XML modeling then use SExpression models:

(inference
    (reference (@assembly "FlexRule.Samples.PersonAge.exe"))
	
    (import (@type FlexRule.Samples.Person))
    (import (@type FlexRule.Samples.Gender))
    (import (@type System.Console))

    (defrule (@name "older and younger")
        (match (@type Person) (@variable older)
          (e "e.Sex == Gender.Female")
        )
        (match (@type Person) (@variable younger)
          (p "p.Age < older.Age")
          (o "o.Sex == Gender.Male")
        )
        ->
        (action (@context ctx) (@name "Print result")
          (execute 'Console.WriteLine("{0} ({1}) is older than {2} ({3})", older.Name, older.Age, younger.Name, younger.Age)')
        )
    )
)

Obsolete modules

As we introduced the new implementation to our Rete engine, the old one is obsolete: FlexRule.Network.dll and FlexRule.Network.Language.dll.
Also in new version we merged FlexRule.Validation.Language.dll to FlexRule.Validation.dll. So all the references to support natural language is not available via the main assembly.
Shell application also is obsolete, instead there is a FlexRule.Tester application that allows you to test Procedure, validation and flow logic.

Sample Projects

All sample projects have been updated to use the latest API for Inference engine. Since we release other engines, we really did not have time to revisit the sample project for those areas and update them. But this time some of old sample projects are revised to use the latest API in their area e.g. Procedure, validation flow engines.

This is just a beginning, we will have more exciting news coming… Have fun for now…

For more detail information please check the release note inside the installer package.

Last updated December 15th, 2020 at 07:54 am, Published January 20th, 2014 at 07:54 am