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:

&lt;inference&gt;
    &lt;reference assembly="FlexRule.Samples.PersonAge.exe"/&gt;
  
    &lt;import type="FlexRule.Samples.Person" /&gt;
    &lt;import type="FlexRule.Samples.Gender" /&gt;
    &lt;import type="System.Console" /&gt;

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

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 January 21st, 2014 at 11:52 am, Published January 20th, 2014 at 11:52 am