views:

122

answers:

1

We are currently developing a project in .NET that involves analyzing XML documents against a set of user defined rules. Here is an example:

<Person>
   <Name>Bob</Name>
   <Cars>
      <Car Type="SUV" Color="Black"/>
      <Car Type="Sports" Color="Red"/>
   <Cars/>
</Person>

EG rules: if person's name = "Bob" and has 2 cars then ... if person has as least one SUV and at least one Sports car then ...

We are going to build a "rule builder" wizard that walks the users through the process of creating a rule. In addition to this, one of the other complications is that the schema of the XML documents will be dependent on customer needs so we need a quick way to adapt to new schemas. Can anyone provide some insight into what underlying technologies could best accomplish this? Here are a couple things we have considered:

  1. Dynamic Linq to XML
  2. Shredding XML into SQL tables and generate dynamic SQL statements
  3. Creating some type of custom DSL (Iron Python, Boo, etc)

Biggest concerns are ability to implement rules on the fly, speed, and easy/flexibility authoring the rules.

Ideas?

+1  A: 

Don't build this. Use a forward-chaining rules engine like BRE that comes with BizTalk.

matt eisenberg
I’m commenting on behalf of @Matt. — Rules require a deployment process with BRE and i don't think there is a way to build a custom UI for rule building. Our end users need a dead simple, limited UI for building rules and then something a little bit more sophisticated where developers can jump in an write a rule for complex situations. It seems like other open source rules enginges, eg drools.net and nxbre are more or less abandoned. Commercial ones like ilog and nrule are too expensive.
Timwi