Saturday, March 12, 2011

Introduction to Biztalk Business Rule Engine Facts

What is fact ?

Facts are discrete pieces of information about the world.  Facts can originate from many sources



Facts are discrete pieces of information about the world. Facts can originate from many sources (event systems, objects in business applications, database tables, and so on), and must be fed into the Business Rule engine in BizTalk Server by using one of the following elements:

Fact types.
  • .NET objects (methods, properties, and fields)

  • XML documents (elements, attributes, and document subsections)

  • Database rowsets (values from table column)

In the Business Rule Composer, you can use the Facts Explorer to browse and bring data into your rules from various sources.

.Net objects
In the Business Rule Composer, you can specify a .NET assembly as a data source

 Engine control functions

  This Engine control functions are allow the application or policy to control the facts in the rule engine's working memory.

Engine controlf functions are

Assert

Retract

RetractByType

Reassert

Update

Halt


Assert
Assertion is  the process  of adding object isntances into Business Rule engine's working memory.


The following table summarizes the assert behavior for the various types, showing the number of resulting instances created in the engine for each asserted entity, as well as the type that is applied to each of those instances to identify them.
Entity Number of instances asserted Instance type
.NET object1 (the object itself)Fully Qualified .NET Class
TypedXmlDocument1-N TypedXmlDocument(s): Based on Selector bindings created and document contentDocumentType.Selector
TypedDataTable1-N TypedDataRow(s):
One for each DataRow in the DataTable
DataSetName.DataTableName
TypedDataRow1 (the TypedDataRow asserted)DataSetName.DataTableName
DataConnection1-N (one for each TypedDataRow returned by querying the DataConnection)DataSetName.DataTableName




Retract:
You can use the Retract funciton to remove objects form the Business rule engine's working copy.

RetractByType
The RetractByType funciton retracts all instances of a specified type in the working memory, where as the Retract function retracts only specific items of a certain type.


Reassert

To reassert means to call the Assert function on an object that is already in the engine's working memory.

Update
When Update function is invoked an object, the object is reasserted into the engine to be re-evaluated, based on the new data and state.

 Halt
You can use the Halt function to halt the current rule engine execution. The Halt function takes one parameter of type Boolean. If you specify the value for the parameter as true, the rule engine also clears the agenda that contains the pending candidate rules.


http://en.wikipedia.org/wiki/Rete_algorithm