Remember the scenario "mail related to candidates that are interviewing today” that Shishir talked about in one of the previous posts?  If so, have you been wondering “How did they do that?”  My name is Kati Dimitrova, a developer on the WinFS API team, and I’d like to introduce you to one of the WinFS technologies that make that scenario possible: WinFS rules.

For those of you not familiar with this scenario, you can find it in full here.  In summary, Mary is a recruiter who has a dreadful time trying to manage and track candidates throughout her day across multiple applications.  Her day is an ongoing battle with her mailbox, constantly flagging the flood of incoming email in order to ensure the necessary and appropriate follow-ups happen for each candidate. Using WinFS, Mary is able to get her recruiting application and email application to seamlessly cooperate to allow her to automatically track “mail related to candidates that are interviewing today.”

So what are WinFS rules about and how do they enable this scenario? 

First and foremost, WinFS rules are persistable units of logic.  In this scenario, Mary creates the query “candidates that are interviewing today” through her WinFS-enabled recruiting application and persists it.  But how is the query persisted?  As a WinFS item.  In fact, all WinFS rules, including queries, are items.  This has many advantages.  To start with, rules can be created, manipulated, stored and secured in the same manner as all other items.

Further, WinFS rules are about discovery and sharing of persisted logic among applications.  Because rules are WinFS items, they can also be queried for, discovered and shared among applications just like all other WinFS items.  In this scenario, Mary can easily find and use the query “candidates that are interviewing today” from her email application even though she created it through her recruiting application.

Finally, WinFS rules are about re-usability and composition.  Not only can Mary find the query she created in her recruiting application, she can re-use it in her email application to create a new query “mail related to candidates that are interviewing today” that refers to the original query.  Note that composition of rules is true composition; if Mary changes the logic that defines the query “candidates that are interviewing today,” those changes will affect the results of the query “mail related to candidates that are interviewing today.”

Let’s also briefly touch on some other capabilities of WinFS rules that go beyond this scenario.  There are actually several other types of rules besides query.  I will mention just one of them here – property rule.  With property rules you can define new properties on item types without modifying or extending the schema for that type.  The values for these properties are defined as computations over existing item data or other data that can be accessed through WinFS.  For example, an email application can expose capabilities for creating a “Color” property for messages and allow each user to define the value of “Color” using their own logic.  Mary, for example, may wish to color all messages that belong to the results of the query “mail related to candidates that are interviewing today” in red.

I hope this information will entice you to try out WinFS rules, and hopefully facilitate you to develop some really exciting WinFS applications!

[Author: Kati Dimitrova]